/* ============================================================================
   PHASE 5: ANIMATIONS & TRANSITIONS
   Enhanced visual feedback for strategy table board interactions
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. DRAG-DROP ANIMATIONS
   ---------------------------------------------------------------------------- */

/* Smooth transitions for all kanban items */
.choice-box,
.decision-box,
.group-container {
    transition: transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s ease,
                box-shadow 0.2s ease;
}

/* Item being dragged - visual elevation */
    .choice-box.dragging,
    .decision-box.dragging,
    .group-container.dragging {
        transform: scale(1.05);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
        opacity: 0.9;
        z-index: 1000;
        cursor: grabbing;
        padding-right: 5px;
        margin-bottom: 5px;
    }

/* Drag handle cursor */
.choice-box:hover,
.decision-box:hover {
    cursor: grab;
}

/* Drop target highlight */
.decision-column.drag-over {
    background-color: rgba(13, 110, 253, 0.1);
    border: 2px dashed #0d6efd;
}

.group-container.drag-over {
    background-color: rgba(13, 110, 253, 0.05);
    border: 2px dashed #0d6efd;
}

/* ----------------------------------------------------------------------------
   2. CRUD OPERATION ANIMATIONS
   ---------------------------------------------------------------------------- */

/* Fade in animation for new items */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.choice-box.new-item,
.decision-column.new-item,
.group-container.new-item {
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Delete animation - fade out and shrink */
@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
}

.choice-box.deleting,
.decision-column.deleting,
.group-container.deleting {
    animation: fadeOutDown 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none; /* Prevent interaction during deletion */
}

/* Update/save animation - brief highlight flash */
@keyframes highlightFlash {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(25, 135, 84, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

.choice-box.updated,
.decision-box.updated,
.group-header.updated {
    animation: highlightFlash 0.5s ease;
}

/* ----------------------------------------------------------------------------
   3. EDIT MODE TRANSITIONS
   ---------------------------------------------------------------------------- */

/* Smooth expansion when entering edit mode */
.editable-input {
    transition: width 0.2s ease, padding 0.2s ease;
}

/* Focus state enhancement */
.editable-input:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* ----------------------------------------------------------------------------
   4. MENU ANIMATIONS
   ---------------------------------------------------------------------------- */

/* Dropdown menu slide in */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.strategy-table-menu-dropdown {
    animation: slideDown 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Menu button hover */
.strategy-table-menu button {
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.strategy-table-menu button:hover {
    transform: scale(1.1);
}

.strategy-table-menu button:active {
    transform: scale(0.95);
}

/* ----------------------------------------------------------------------------
   5. LOADING STATE ANIMATIONS
   ---------------------------------------------------------------------------- */

/* Skeleton loader pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.strategy-table-loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    z-index: 1100;
    animation: pulse 1.5s cubic-bezier(0.4, 0.0, 0.6, 1) infinite;
}

.strategy-table-loading p {
    margin: 0;
}

/* Spinner rotation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner-border {
    animation: spin 0.75s linear infinite;
}

/* ----------------------------------------------------------------------------
   6. STRATEGY CIRCLES ANIMATIONS
   ---------------------------------------------------------------------------- */

/* Strategy circles pop in */
@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.strategy-circle {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.strategy-circle.new {
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bounce effect */
}

.strategy-circle:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ----------------------------------------------------------------------------
   7. UNDO/REDO TOOLBAR ANIMATIONS
   ---------------------------------------------------------------------------- */

/* Toolbar slide in from top */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.undo-redo-toolbar {
    animation: slideInFromTop 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Button press animation */
.undo-redo-toolbar button {
    transition: transform 0.1s ease, background-color 0.15s ease;
}

.undo-redo-toolbar button:active:not(:disabled) {
    transform: scale(0.95);
}

.undo-redo-toolbar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ----------------------------------------------------------------------------
   8. REAL-TIME COLLABORATION INDICATORS
   ---------------------------------------------------------------------------- */

/* Active user badges fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.user-badge {
    animation: fadeIn 0.3s ease;
    transition: transform 0.2s ease;
}

.user-badge:hover {
    transform: scale(1.1);
}

/* Lock indicator pulse */
@keyframes lockPulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.lock-indicator {
    animation: lockPulse 2s ease infinite;
    transition: all 0.3s ease;
}

.choice-box.locked {
    opacity: 0.6;
    pointer-events: none;
    border: 2px dashed #ffc107;
}

/* Real-time update flash */
@keyframes realtimeFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

.choice-box.realtime-update,
.decision-box.realtime-update {
    animation: realtimeFlash 0.6s ease;
}

/* ----------------------------------------------------------------------------
   9. ERROR/SUCCESS TOAST ANIMATIONS
   ---------------------------------------------------------------------------- */

/* Toast slide in from right */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Toast slide out */
@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ----------------------------------------------------------------------------
   10. RESPONSIVE HOVER EFFECTS
   ---------------------------------------------------------------------------- */

/* Only apply hover effects on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .choice-box:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }
    
    .decision-box:hover {
        background-color: rgba(0, 0, 0, 0.03);
    }
    
    .group-header:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }
}

/* ----------------------------------------------------------------------------
   11. PERFORMANCE OPTIMIZATION
   ---------------------------------------------------------------------------- */

/* Use GPU acceleration for frequently animated elements */
.choice-box,
.decision-box,
.group-container {
    will-change: transform;
}

/* Reduce motion for users who prefer it (accessibility) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ----------------------------------------------------------------------------
   12. UTILITY CLASSES
   ---------------------------------------------------------------------------- */

/* Smooth any custom animations */
.animate-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Quick animations */
.animate-fast {
    transition: all 0.15s ease;
}

/* Slow animations */
.animate-slow {
    transition: all 0.5s ease;
}

/* Disable animations */
.no-animation {
    animation: none !important;
    transition: none !important;
}
