/* ============================================
   ANIMATIONS - Tab & Zone Transitions
   Add this to your styles-refactored.css
   ============================================ */

/* ============================================
   TAB TRANSITIONS
   ============================================ */

/* Base state for all tabs */
.tab-panel {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

/* Active tab - visible and animated */
.tab-panel.active {
    display: block;
    animation: tabFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Tab fade in animation */
@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tab fade out animation (when leaving) */
.tab-panel.leaving {
    display: block;
    animation: tabFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes tabFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ============================================
   ZONE TRANSITIONS (A ↔ B)
   ============================================ */

/* Base state for zone content */
.zone-content,
.zone-content-flex {
    display: none;
    opacity: 0;
}

/* Active zone - visible */
.zone-content.active,
.zone-content-flex.active {
    display: block;
    animation: zoneSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.zone-content-flex.active {
    display: flex;
}

/* Zone slide in from right (when going from A to B) */
@keyframes zoneSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zone slide in from left (when going from B to A) */
.zone-content.slide-left,
.zone-content-flex.slide-left {
    animation: zoneSlideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes zoneSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zone slide out (when leaving) */
.zone-content.leaving,
.zone-content-flex.leaving {
    display: block;
    animation: zoneSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.zone-content-flex.leaving {
    display: flex;
}

@keyframes zoneSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* ============================================
   NAVIGATION ITEM TRANSITIONS
   ============================================ */

.nav-item {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active indicator for bottom nav */
.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--black);
    border-radius: 0 0 3px 3px;
    animation: navIndicatorSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes navIndicatorSlide {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 40px;
        opacity: 1;
    }
}

/* Nav icon bounce on click */
.nav-item:active .nav-icon {
    animation: navIconBounce 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes navIconBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
    }
}

/* ============================================
   SYSTEM SELECTOR (Zone Pills) TRANSITIONS
   ============================================ */

.system-pill {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth background transition */
.system-pill.active {
    animation: pillActivate 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pillActivate {
    from {
        background: transparent;
        color: var(--gray-dark);
        transform: scale(0.95);
    }
    to {
        background: var(--black);
        color: var(--white);
        transform: scale(1);
    }
}

/* ============================================
   MODAL TRANSITIONS (Bonus)
   ============================================ */

/* Smooth modal appearance */
.modal {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-content {
    transform: scale(1);
}

/* Mobile modal slide up */
@media (max-width: 640px) {
    .modal-content {
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .modal.active .modal-content {
        transform: translateY(0);
    }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */

/* Fade in utility class */
.fade-in {
    animation: fadeIn 0.3s ease-in-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide up utility class */
.slide-up {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale in utility class */
.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   REDUCE MOTION (Accessibility)
   ============================================ */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATION
   ============================================ */

/* Use GPU acceleration for animations */
.tab-panel,
.zone-content,
.zone-content-flex,
.modal-content {
    will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.tab-panel.active,
.zone-content.active,
.zone-content-flex.active {
    will-change: auto;
}

