/**
 * apple-carousel.css - Apple-style carousel with center focus animation
 * 
 * "Round and round it goes, when it will stop is never" 🎠
 * 
 * Features:
 * - Center card 65% of viewport height, side cards 40%
 * - Only 3 cards visible at a time
 * - Smooth sliding transitions
 * - Infinite loop support
 * - Beautiful depth effect with opacity and z-index
 */

/* ===== APPLE CAROUSEL CONTAINER ===== */
.apple-carousel-container {
    overflow: hidden;
    padding-top: 60px;
    padding-bottom: 40px;
    /* Ensure all content is centered */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== VIEWPORT (Visible Window) ===== */
.apple-carousel-viewport {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 500px; /* Taller to accommodate percentage-based cards */
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    /* Ensure viewport is properly centered */
    margin: 0 auto;
    box-sizing: border-box;
}

/* ===== TRACK (Contains All Cards) ===== */
.apple-carousel-track {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ===== CARD WRAPPER (Positioning Container) ===== */
.apple-carousel-card-wrapper {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transition: none; /* JS controls animation timing */
    will-change: transform, opacity;
}

/* ===== TRANSITION ARROW (Appears before carousel slides) ===== */
.carousel-transition-arrow {
    position: absolute;
    top: 50%;
    z-index: 150;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 170, 0.15);
    border: 2px solid var(--accent, #00d4aa);
    border-radius: 50%;
    opacity: 0;
    transform: translate(0, -50%) scale(0.5);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.carousel-transition-arrow.visible {
    opacity: 1;
    transform: translate(0, -50%) scale(1);
}

.carousel-transition-arrow svg {
    width: 24px;
    height: 24px;
    color: var(--accent, #00d4aa);
    animation: arrow-pulse 0.8s ease-in-out infinite;
}

@keyframes arrow-pulse {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(4px);
    }
}

/* Card frame sizing - height set by JS via --card-height variable, width proportional */
/* IMPORTANT: Use !important to override fixed sizes from landing.css and phone-emulator.css */
/* Cards smoothly grow/shrink as they move through carousel positions - like horses on a merry-go-round */
.apple-carousel-card-wrapper .phone-frame,
.apple-carousel-card-wrapper .gmail-email,
.apple-carousel-card-wrapper .console-window,
.apple-carousel-card-wrapper .placeholder-card-frame {
    height: var(--card-height, 400px) !important;
    max-height: var(--card-height, 400px) !important;
    width: auto !important;
    aspect-ratio: 9 / 16; /* Phone-like aspect ratio */
    min-width: 140px;
    max-width: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    /* Smooth size transition - cards grow/shrink as they come around the carousel */
    transition: height 1.2s cubic-bezier(0.4, 0.0, 0.2, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
    /* Reset any fixed sizing from other stylesheets */
    border-radius: 16px !important;
    padding: 8px !important;
}

/* Phone internal elements - scale proportionally within carousel */
.apple-carousel-card-wrapper .phone-notch {
    width: 50px;
    height: 14px;
    border-radius: 0 0 10px 10px;
    margin-bottom: 4px;
}

.apple-carousel-card-wrapper .phone-notch::before {
    width: 5px;
    height: 5px;
    top: 4px;
}

.apple-carousel-card-wrapper .phone-screen {
    border-radius: 12px;
    height: calc(100% - 18px);
}

.apple-carousel-card-wrapper .phone-app {
    padding: 10px 8px;
}

/* Gmail email internal scaling */
.apple-carousel-card-wrapper .gmail-email {
    border-radius: 8px !important;
}

/* Console window internal scaling */
.apple-carousel-card-wrapper .console-window {
    border-width: 6px !important;
    border-top-width: 8px !important;
    border-bottom-width: 10px !important;
    border-radius: 10px !important;
}

/* Center card gets extra z-index styling */
.apple-carousel-card-wrapper.center {
    z-index: 100 !important;
}

/* Center card is ALWAYS highlighted - the "frame" effect */
.apple-carousel-card-wrapper.center .phone-frame,
.apple-carousel-card-wrapper.center .gmail-email,
.apple-carousel-card-wrapper.center .console-window,
.apple-carousel-card-wrapper.center .placeholder-card-frame {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(0, 212, 170, 0.4),
        0 0 100px rgba(0, 212, 170, 0.2);
    border-color: var(--accent, #00d4aa) !important;
    animation: apple-pulse 2s ease-in-out infinite;
}

/* Side cards subtle shadow */
.apple-carousel-card-wrapper:not(.center) .phone-frame,
.apple-carousel-card-wrapper:not(.center) .gmail-email,
.apple-carousel-card-wrapper:not(.center) .console-window {
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

/* ===== INDICATOR DOTS ===== */
.apple-carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    padding: 8px 16px;
}

.apple-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apple-carousel-dot:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.apple-carousel-dot.active {
    background: var(--accent, #00d4aa);
    width: 28px;
    border-radius: 5px;
}

/* ===== NAVIGATION CONTROLS ===== */
.apple-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 24px;
}

.apple-carousel-nav {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apple-carousel-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent, #00d4aa);
    transform: scale(1.1);
}

.apple-carousel-nav:active {
    transform: scale(0.95);
}

.apple-carousel-nav svg {
    width: 20px;
    height: 20px;
}

/* ===== ACTIVE CARD GLOW (extra intensity when actively animating) ===== */
.apple-carousel-card-wrapper.center .demo-phone.active .phone-frame,
.apple-carousel-card-wrapper.center .demo-email-template.active .gmail-email,
.apple-carousel-card-wrapper.center .demo-server.active .console-window,
.apple-carousel-card-wrapper.center .demo-placeholder-card.active .placeholder-card-frame {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(0, 212, 170, 0.5),
        0 0 120px rgba(0, 212, 170, 0.3);
}

@keyframes apple-pulse {
    0%, 100% {
        box-shadow: 
            0 25px 50px -12px rgba(0, 0, 0, 0.5),
            0 0 60px rgba(0, 212, 170, 0.4),
            0 0 100px rgba(0, 212, 170, 0.2);
    }
    50% {
        box-shadow: 
            0 25px 50px -12px rgba(0, 0, 0, 0.5),
            0 0 80px rgba(0, 212, 170, 0.5),
            0 0 120px rgba(0, 212, 170, 0.3);
    }
}

/* ===== COMPLETED CARD STATE ===== */
.apple-carousel-card-wrapper .demo-phone.completed,
.apple-carousel-card-wrapper .demo-email-template.completed,
.apple-carousel-card-wrapper .demo-server.completed {
    opacity: 1;
}

.apple-carousel-card-wrapper .demo-phone.completed .phone-frame,
.apple-carousel-card-wrapper .demo-email-template.completed .gmail-email,
.apple-carousel-card-wrapper .demo-server.completed .console-window {
    border-color: rgba(0, 212, 170, 0.3);
}

/* ===== SLIDE ANIMATION CLASSES ===== */
.apple-carousel-sliding-left .apple-carousel-card-wrapper {
    animation: slide-left-enter 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes slide-left-enter {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 1024px) {
    .apple-carousel-viewport {
        height: 450px;
    }
    
    .apple-carousel-card-wrapper .phone-frame,
    .apple-carousel-card-wrapper .gmail-email,
    .apple-carousel-card-wrapper .console-window,
    .apple-carousel-card-wrapper .placeholder-card-frame {
        min-width: 140px;
        max-width: 220px;
    }
}

@media (max-width: 768px) {
    .apple-carousel-container {
        padding: 40px 16px;
    }
    
    .apple-carousel-viewport {
        height: 400px;
    }
    
    .apple-carousel-controls {
        gap: 12px;
    }
    
    .apple-carousel-nav {
        width: 40px;
        height: 40px;
    }
    
    .apple-carousel-card-wrapper .phone-frame,
    .apple-carousel-card-wrapper .gmail-email,
    .apple-carousel-card-wrapper .console-window,
    .apple-carousel-card-wrapper .placeholder-card-frame {
        min-width: 120px;
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .apple-carousel-viewport {
        height: 350px;
    }
    
    .apple-carousel-dot {
        width: 8px;
        height: 8px;
    }
    
    .apple-carousel-dot.active {
        width: 24px;
    }
    
    .apple-carousel-card-wrapper .phone-frame,
    .apple-carousel-card-wrapper .gmail-email,
    .apple-carousel-card-wrapper .console-window,
    .apple-carousel-card-wrapper .placeholder-card-frame {
        min-width: 100px;
        max-width: 150px;
    }
}

/* ===== GRADIENT FADE EDGES ===== */
.apple-carousel-viewport::before,
.apple-carousel-viewport::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    z-index: 50;
    pointer-events: none;
}

.apple-carousel-viewport::before {
    left: 0;
    background: linear-gradient(to right, 
        rgba(26, 26, 46, 1) 0%, 
        rgba(26, 26, 46, 0) 100%);
}

.apple-carousel-viewport::after {
    right: 0;
    background: linear-gradient(to left, 
        rgba(26, 26, 46, 1) 0%, 
        rgba(26, 26, 46, 0) 100%);
}

/* Theme-aware edge fades */
.carousel-theme-light .apple-carousel-viewport::before {
    background: linear-gradient(to right, 
        rgba(248, 249, 250, 1) 0%, 
        rgba(248, 249, 250, 0) 100%);
}

.carousel-theme-light .apple-carousel-viewport::after {
    background: linear-gradient(to left, 
        rgba(248, 249, 250, 1) 0%, 
        rgba(248, 249, 250, 0) 100%);
}

/* ===== SCROLLBAR STYLING FOR TALL CARDS ===== */
.apple-carousel-card-wrapper .phone-frame::-webkit-scrollbar,
.apple-carousel-card-wrapper .gmail-email::-webkit-scrollbar,
.apple-carousel-card-wrapper .console-window::-webkit-scrollbar,
.apple-carousel-card-wrapper .placeholder-card-frame::-webkit-scrollbar {
    width: 4px;
}

.apple-carousel-card-wrapper .phone-frame::-webkit-scrollbar-track,
.apple-carousel-card-wrapper .gmail-email::-webkit-scrollbar-track,
.apple-carousel-card-wrapper .console-window::-webkit-scrollbar-track,
.apple-carousel-card-wrapper .placeholder-card-frame::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.apple-carousel-card-wrapper .phone-frame::-webkit-scrollbar-thumb,
.apple-carousel-card-wrapper .gmail-email::-webkit-scrollbar-thumb,
.apple-carousel-card-wrapper .console-window::-webkit-scrollbar-thumb,
.apple-carousel-card-wrapper .placeholder-card-frame::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 170, 0.3);
    border-radius: 2px;
}

.apple-carousel-card-wrapper .phone-frame::-webkit-scrollbar-thumb:hover,
.apple-carousel-card-wrapper .gmail-email::-webkit-scrollbar-thumb:hover,
.apple-carousel-card-wrapper .console-window::-webkit-scrollbar-thumb:hover,
.apple-carousel-card-wrapper .placeholder-card-frame::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 170, 0.5);
}

/* Firefox scrollbar */
.apple-carousel-card-wrapper .phone-frame,
.apple-carousel-card-wrapper .gmail-email,
.apple-carousel-card-wrapper .console-window,
.apple-carousel-card-wrapper .placeholder-card-frame {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 170, 0.3) rgba(255, 255, 255, 0.05);
}
