/* ===== AI VOICE AGENT SHOWCASE STYLES ===== */

/* 
 * BACKGROUND IMAGE CUSTOMIZATION:
 * 
 * To use your own background image, replace the image paths below:
 * - SVG Background: '/static/images/ai-voice-background.svg'
 * - Fallback JPG: '/static/images/ai-voice-background.jpg'
 * 
 * Recommended image specifications:
 * - SVG: Scalable vector graphics (preferred for sharpness)
 * - JPG/PNG: 1920x1080px or larger for fallback
 * 
 * Image types that work well:
 * - Technology/AI themed backgrounds
 * - Abstract geometric patterns
 * - Dark space/tech environments
 * - Subtle circuit board patterns
 */

.ai-voice-showcase {
    padding: var(--spacing-xl) 0;
    /* Base gradient background */
    background: linear-gradient(135deg, #0f1419 0%, #082928 50%, #1a1a1a 100%);
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* SVG Background Image Layer */
.ai-voice-showcase::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/images/ai-voice-background.svg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.1; /* Adjust opacity as needed */
    z-index: 1;
    pointer-events: none;
}

/* Gradient Overlays and Accent Effects */
.ai-voice-showcase::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 30% 40%, rgba(0, 217, 213, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 60%, rgba(64, 224, 208, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(0, 217, 213, 0.03) 0%, transparent 70%);
    z-index: 2;
    pointer-events: none;
}

/* ===== MAIN LAYOUT ===== */
.showcase-layout {
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    gap: var(--spacing-lg);
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 3; /* Ensure content is above background layers */
}

/* ===== LEFT CONTENT AREA ===== */
.showcase-left {
    color: var(--white);
    max-width: 500px;
    justify-self: end;
}

.showcase-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
    color: var(--white);
}

.showcase-title .highlight {
    color: var(--primary-teal);
    display: block;
}

.showcase-description {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
    opacity: 0.9;
    color: #e0e0e0;
}

.showcase-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.showcase-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50px;
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 10px 30px rgba(0, 217, 213, 0.3);
    max-width: fit-content;
}

.showcase-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 217, 213, 0.4);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.contact-link {
    color: var(--primary-teal);
    text-decoration: underline;
    font-weight: 500;
    transition: color var(--transition-fast);
    font-size: 1rem;
}

.contact-link:hover {
    color: var(--accent-turquoise);
}

/* ===== CENTER FEATURES SIDEBAR ===== */
.features-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-self: center;
    height: 400px; /* Match GIF container height */
    justify-content: space-between;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-radius: 12px;
    background: rgba(0, 217, 213, 0.05);
    border: 1px solid rgba(0, 217, 213, 0.15);
    transition: all var(--transition-base);
    cursor: pointer;
    min-width: 120px;
    max-width: 140px;
    height: 90px; /* Fixed height to fit 4 items */
    position: relative;
    flex: 1;
    justify-content: center;
    gap: 0.5rem; /* Space between icon and text */
}

.feature-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    transition: left 0.6s ease;
}

.feature-item:hover::before {
    left: 100%;
}

.feature-item:hover {
    background: rgba(0, 217, 213, 0.1);
    border-color: rgba(0, 217, 213, 0.3);
}

.feature-item.active {
    background: rgba(0, 217, 213, 0.15);
    border-color: var(--primary-teal);
    box-shadow: 0 4px 15px rgba(0, 217, 213, 0.2);
}

.feature-item.active .feature-icon {
    color: var(--primary-teal);
}

.feature-icon {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition-base);
    z-index: 1;
    position: relative;
    flex-shrink: 0;
}

.feature-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--white);
    z-index: 1;
    position: relative;
}

.feature-text span:first-child {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    line-height: 1.2;
}

.feature-text span:last-child {
    font-size: 0.75rem;
    opacity: 0.8;
    line-height: 1.2;
}

/* ===== RIGHT GIF DEMO AREA ===== */
.gif-demo-area {
    justify-self: start;
    max-width: 500px;
    width: 100%;
}

.demo-container {
    position: relative;
    width: 100%;
    height: 400px;
    min-height: 300px; /* Ensure minimum height */
    border-radius: 20px;
    overflow: hidden;
    background: rgba(0, 217, 213, 0.05);
    border: 1px solid rgba(0, 217, 213, 0.15);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure container maintains aspect ratio for GIFs */
.demo-container::before {
    content: '';
    display: block;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio fallback */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    opacity: 0; /* Hidden, just for sizing reference */
}

/* Override for different aspect ratios */
.demo-container.aspect-16-9::before {
    padding-top: 56.25%; /* 16:9 */
}

.demo-container.aspect-4-3::before {
    padding-top: 75%; /* 4:3 */
}

.demo-container.aspect-1-1::before {
    padding-top: 100%; /* 1:1 square */
}

.gif-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    background-size: cover; /* Changed back to cover to fill container */
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gif-placeholder.active {
    opacity: 1;
    visibility: visible;
}

/* Ensure GIF fills the entire container */
.gif-placeholder[style*="background-image"] {
    background-size: cover !important;
    width: 100% !important;
    height: 100% !important;
}

/* Alternative sizing options */
.gif-placeholder.contain-mode {
    background-size: contain; /* Shows entire GIF, may have letterboxing */
}

.gif-placeholder.fill-mode {
    background-size: 100% 100%; /* Stretches GIF to fill container exactly */
}

/* For GIFs that need to maintain aspect ratio but fill container */
.gif-placeholder.cover-mode {
    background-size: cover; /* Default - fills container, may crop slightly */
}

/* Placeholder styling for when GIFs are added */
.gif-placeholder[data-demo="qualify"] {
    /* background-image: url('path/to/qualify-gif.gif'); */
    background: linear-gradient(135deg, rgba(0, 217, 213, 0.2) 0%, rgba(0, 217, 213, 0.05) 100%);
}

.gif-placeholder[data-demo="answers"] {
    /* background-image: url('path/to/answers-gif.gif'); */
    background: linear-gradient(135deg, rgba(32, 178, 170, 0.2) 0%, rgba(32, 178, 170, 0.05) 100%);
}

.gif-placeholder[data-demo="books"] {
    /* background-image: url('path/to/books-gif.gif'); */
    background: linear-gradient(135deg, rgba(64, 224, 208, 0.2) 0%, rgba(64, 224, 208, 0.05) 100%);
}

.gif-placeholder[data-demo="transfers"] {
    /* background-image: url('path/to/transfers-gif.gif'); */
    background: linear-gradient(135deg, rgba(0, 206, 209, 0.2) 0%, rgba(0, 206, 209, 0.05) 100%);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .showcase-layout {
        grid-template-columns: 1fr 180px 1fr;
        gap: var(--spacing-md);
    }
    
    .showcase-title {
        font-size: 3rem;
    }
    
    .demo-container {
        height: 350px; /* Optimal size for tablet GIF display */
    }
}

@media (max-width: 1024px) {
    .showcase-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        text-align: center;
    }
    
    .showcase-left {
        justify-self: center;
        order: 1;
    }
    
    .features-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        justify-content: center;
        order: 3;
        gap: 1rem;
        height: auto; /* Reset height for mobile */
        max-width: 300px;
        margin: 0 auto;
    }
    
    .gif-demo-area {
        justify-self: center;
        order: 2;
    }
    
    .feature-item {
        min-width: 120px;
        max-width: 140px;
        padding: 0.75rem 0.5rem;
        height: 80px; /* Smaller height for mobile */
        gap: 0.25rem; /* Reduced gap between icon and text */
    }
}

@media (max-width: 768px) {
    .ai-voice-showcase {
        padding: var(--spacing-lg) 0;
        min-height: auto;
        /* Simplified background for mobile performance */
        background: 
            linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 100%),
            linear-gradient(135deg, #0f1419 0%, #082928 100%);
        background-attachment: scroll; /* Remove fixed attachment on mobile for better performance */
    }
    
    /* Reduce SVG background opacity on mobile for better text readability */
    .ai-voice-showcase::before {
        opacity: 0.2;
    }
    
    .showcase-title {
        font-size: 2.5rem;
        text-align: center;
    }
    
    .showcase-description {
        font-size: 1rem;
        text-align: center;
    }
    
    .showcase-actions {
        align-items: center;
    }
    
    .showcase-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .demo-container {
        height: 300px; /* Optimized for mobile GIF viewing */
    }
    
    .features-sidebar {
        height: auto; /* Reset height for mobile */
    }
    
    .feature-item {
        min-width: 90px;
        max-width: 100px;
        padding: 0.5rem 0.375rem;
        height: 70px;
        gap: 0.25rem; /* Reduced gap between icon and text */
    }
    
    .feature-text span:first-child {
        font-size: 0.75rem;
    }
    
    .feature-text span:last-child {
        font-size: 0.675rem;
    }
    
    .feature-icon {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .showcase-layout {
        gap: var(--spacing-md);
    }
    
    .showcase-title {
        font-size: 2rem;
    }
    
    .features-sidebar {
        gap: 0.75rem;
    }
    
    .feature-item {
        min-width: 80px;
        padding: 0.5rem 0.25rem;
        gap: 0.25rem; /* Reduced gap between icon and text */
    }
    
    .demo-container {
        height: 250px; /* Compact size for small mobile screens while maintaining GIF visibility */
    }
    
    .gif-demo-area {
        max-width: 100%;
    }
    
    /* Further reduce background opacity for very small screens */
    .ai-voice-showcase::before {
        opacity: 0.15;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .feature-item {
        transition: none;
    }
    
    .gif-placeholder {
        transition: none;
    }
    
    .feature-item::before {
        display: none;
    }
}

/* ===== FOCUS STATES ===== */
.feature-item:focus-visible {
    outline: 2px solid var(--primary-teal);
    outline-offset: 2px;
}

.showcase-btn:focus-visible {
    outline: 2px solid var(--primary-teal);
    outline-offset: 2px;
}

/* ===== LOADING STATES ===== */
.gif-placeholder:not([style*="background-image"])::after {
    content: 'Demo Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-teal);
    font-size: 1.125rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* Hide loading text when GIF is loaded */
.gif-placeholder[style*="background-image"]::after {
    display: none;
}

/* Ensure loaded GIFs are visible and properly sized */
.gif-placeholder[style*="background-image"] {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Loading animation for GIF placeholders */
.gif-placeholder:not([style*="background-image"]) {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        background-color: rgba(0, 217, 213, 0.1);
    }
    50% {
        background-color: rgba(0, 217, 213, 0.2);
    }
}

/* GIF Performance Optimizations */
.gif-placeholder[style*="background-image"] {
    /* Optimize rendering for animated GIFs */
    will-change: opacity;
    backface-visibility: hidden;
    transform: translateZ(0); /* Force hardware acceleration */
}

/* Force GIF containers to be visible when active */
.gif-placeholder.active[style*="background-image"] {
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 1;
}

/* Debugging: Add a border to see container bounds */
.demo-container.debug {
    border: 2px solid red;
}

.gif-placeholder.debug {
    border: 1px solid yellow;
}

/* Ensure GIFs maintain quality */
.gif-placeholder {
    image-rendering: auto;
    image-rendering: smooth;
}

/* For pixel art or low-res GIFs */
.gif-placeholder.pixel-art {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* ===== BACKGROUND IMAGE FALLBACKS ===== */
/* Fallback for browsers that don't support SVG backgrounds */
@supports not (background-image: url('data:image/svg+xml,')) {
    .ai-voice-showcase::before {
        background-image: url('/static/images/ai-voice-background.jpg');
        opacity: 0.3;
    }
}

/* ===== DARK THEME SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .ai-voice-showcase {
        background: linear-gradient(135deg, #0f1419 0%, #082928 100%);
    }
    
    .demo-container {
        background: rgba(0, 217, 213, 0.08);
        border-color: rgba(0, 217, 213, 0.2);
    }
    
    .feature-item {
        background: rgba(0, 217, 213, 0.08);
        border-color: rgba(0, 217, 213, 0.2);
    }
    
    .feature-item:hover {
        background: rgba(0, 217, 213, 0.15);
        border-color: rgba(0, 217, 213, 0.4);
    }
}

/* ===== HIGH CONTRAST SUPPORT ===== */
@media (prefers-contrast: high) {
    .feature-item {
        border-width: 2px;
        border-color: var(--primary-teal);
    }
    
    .demo-container {
        border-width: 2px;
        border-color: var(--primary-teal);
    }
    
    .showcase-btn {
        border: 2px solid var(--primary-teal);
    }
    
    .ai-voice-showcase::before {
        opacity: 0.6; /* Higher opacity for better contrast */
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .ai-voice-showcase {
        background: white !important;
        min-height: auto !important;
    }
    
    .ai-voice-showcase::before,
    .ai-voice-showcase::after {
        display: none !important;
    }
    
    .showcase-title,
    .showcase-description {
        color: #333 !important;
    }
    
    .feature-item {
        border: 1px solid #ddd !important;
        background: #f9f9f9 !important;
    }
}