/**
 * AI Advisor Showcase Section
 * Static homepage section showing real Finmagine AI interactions
 * Inspired by Handa Uncle's integrated chat interface approach
 */

.ai-showcase-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 4rem 0;
    margin: 3rem 0;
    position: relative;
    overflow: hidden;
}

.ai-showcase-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(0, 255, 202, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.ai-showcase-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.ai-showcase-header {
    text-align: center;
    margin-bottom: 3rem;
}

.ai-showcase-header h2 {
    color: #ffffff;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ai-showcase-header .subtitle {
    color: #00ffca;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.ai-showcase-header .description {
    color: #cccccc;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

.ai-chat-container {
    max-width: 1000px;
    margin: 0 auto 2rem auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border-radius: 32px;
    overflow: hidden;
}

.chat-header-card {
    background: #000000;
    border: 1px solid #333;
    border-bottom: none;
    padding: 1.5rem 2rem;
    border-radius: 32px 32px 0 0;
    position: relative;
}

/* macOS-style window controls */
.window-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
}

.window-control.close {
    background: #ff5f57;
}

.window-control.minimize {
    background: #ffbd2e;
}

.window-control.maximize {
    background: #28ca42;
}

.chat-content-card {
    background: #000000;
    border: 1px solid #333;
    border-top: none;
    border-bottom: none;
    padding: 0 2rem 0 2rem;
    border-radius: 0;
    height: clamp(280px, 55vh, 420px);
    max-height: clamp(280px, 55vh, 420px);
    min-height: clamp(280px, 55vh, 420px);
    overflow: hidden !important;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 5%, black 95%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, black 5%, black 95%, transparent 100%);
    position: relative;
    display: flex;
    flex-direction: column;
}

.chat-input-card {
    background: #000000;
    border: 1px solid #333;
    border-top: none;
    border-radius: 0 0 32px 32px;
    position: relative;
}

/* Mask fallback for WebKit quirks */
.chat-content-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: 
        linear-gradient(to bottom, rgba(0,0,0,0.85), rgba(0,0,0,0) 10%),
        linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0) 10%);
    /* Removed mix-blend-mode for better performance */
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #333;
    margin-bottom: 0;
}

.chat-header .ai-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0a4d68, #05bfdb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
    overflow: hidden;
}

.chat-header .ai-icon .finmagine-logo {
    width: 28px;
    height: 28px;
    background: url('/assets/images/branding/logos/finmagine_logo_40x40.png') no-repeat center center;
    background-size: contain;
}

.chat-header .ai-info h3 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.chat-header .ai-info .status {
    color: #00ffca;
    font-size: 0.9rem;
    margin: 0;
}

.chat-messages {
    flex: 1;
    display: block;
    height: auto !important;
    max-height: none !important;
    overflow-y: hidden;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 1rem 2rem 0 2rem;
    position: relative;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

/* New inner track that actually moves */
.chat-track {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    will-change: transform;
}

/* Smooth vertical marquee */
@keyframes trackScroll {
    from { transform: translateY(0); }
    to { transform: translateY(-50%); }
}

/* Turn on animation by adding .auto-scroll to .chat-messages */
.chat-messages.auto-scroll .chat-track {
    animation: trackScroll 18s linear infinite;
}

/* Pause animation on user interaction */
.chat-messages.auto-scroll.is-paused .chat-track {
    animation-play-state: paused;
}

/* Accessibility + tiny screens: slow or disable */
@media (max-width: 480px) {
    .chat-messages.auto-scroll .chat-track {
        animation-duration: 24s;
    }
}

@media (max-height: 420px) {
    .chat-messages.auto-scroll .chat-track {
        animation: none;
    }
}

/* Respect user preference */
@media (prefers-reduced-motion: reduce) {
    .chat-messages.auto-scroll .chat-track {
        animation: none;
    }
}

/* Chat Input Box */
.chat-input-container {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    background: transparent;
    gap: 12px;
    flex-shrink: 0;
    min-height: 76px;
}

.chat-input-box {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 25px;
    padding: 12px 16px;
    color: #cccccc;
    font-size: 0.95rem;
    position: relative;
    min-height: 20px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.chat-input-box:hover {
    border-color: #555;
}

.chat-input-box.typing {
    border-color: #007AFF;
}

.input-text {
    flex: 1;
    line-height: 1.4;
}

.input-cursor {
    width: 2px;
    height: 18px;
    background: #007AFF;
    margin-left: 2px;
    animation: blink 1s infinite;
    display: none;
}

.input-cursor.active {
    display: block;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.chat-send-button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #007AFF, #0056b3);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.chat-send-button:hover {
    background: linear-gradient(135deg, #0056b3, #003d82);
    transform: scale(1.05);
}

.chat-send-button.active {
    opacity: 1;
    transform: scale(1);
}

.chat-message {
    max-width: 85%;
    padding: 1rem 1.5rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: fadeInUp 0.6s ease-out;
}

.chat-message.user {
    background: linear-gradient(135deg, #007AFF, #0056b3);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
    font-weight: 500;
    max-width: 50%;
}

.chat-message.ai {
    background: #1a1a1a;
    color: #ffffff;
    align-self: flex-start;
    border: 1px solid #333;
    position: relative;
}

.chat-message.ai::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #1a1a1a;
}

.company-highlight {
    color: #00ffca;
    font-weight: 700;
}

.finmagine-score {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
    margin: 6px 0;
    color: #22c55e;
}

.recommendation-badge {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
    margin: 6px 0;
    color: #a855f7;
}

.metric-highlight {
    color: #fbbf24;
    font-weight: 600;
}

.showcase-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.showcase-feature {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.showcase-feature:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 255, 202, 0.3);
    transform: translateY(-5px);
}

.showcase-feature .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.showcase-feature h3 {
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.showcase-feature p {
    color: #cccccc;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.cta-section {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #333;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-try-advisor {
    background: linear-gradient(135deg, #007AFF, #0056b3);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.btn-try-advisor:hover {
    background: linear-gradient(135deg, #0056b3, #003d82);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.4);
    text-decoration: none;
    color: white;
}

.btn-learn-more {
    background: transparent;
    color: #00ffca;
    border: 2px solid #00ffca;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-learn-more:hover {
    background: #00ffca;
    color: #1a1a1a;
    text-decoration: none;
    transform: translateY(-2px);
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-showcase-section {
        padding: 3rem 0;
        margin: 2rem 0;
    }
    
    .ai-showcase-header h2 {
        font-size: 2rem;
    }
    
    .ai-showcase-header .subtitle {
        font-size: 1rem;
    }
    
    .ai-showcase-header .description {
        font-size: 1rem;
    }
    
    .ai-chat-container {
        margin: 0 15px 2rem 15px;
        width: calc(100vw - 30px);
        max-width: calc(100vw - 30px);
        overflow: hidden !important;
        box-sizing: border-box;
    }
    
.chat-header-card {
        padding: 1.2rem 1.5rem;
        border-radius: 24px 24px 0 0;
    }
    
    .chat-content-card {
        padding: 0 1.5rem 0 1.5rem;
        border-radius: 0;
        border-bottom: none;
        overflow: hidden !important;
    }
    
    .chat-input-card {
        border-radius: 0 0 24px 24px;
    }
    
    .chat-messages {
        flex: 1 !important;
        height: auto !important;
        overflow: hidden !important;
        padding: 1rem 1.5rem 0 1.5rem !important;
    }
    
    .chat-message {
        max-width: 95% !important;
        padding: 0.8rem 1.2rem !important;
        font-size: 0.9rem !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    .chat-message.ai {
        background: #1a1a1a !important;
        color: #ffffff !important;
        border: 1px solid #333 !important;
        overflow: hidden !important;
    }
    
    .chat-message.user {
        background: #007AFF !important;
        color: white !important;
        overflow: hidden !important;
        align-self: flex-end !important;
        margin-left: auto !important;
        margin-right: 0 !important;
        max-width: 55% !important;
    }
    
    .showcase-features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .showcase-feature {
        padding: 1.5rem;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-try-advisor,
    .btn-learn-more {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    /* Mobile input box adjustments */
    .chat-input-container {
        padding: 0.8rem 1.5rem;
        gap: 10px;
        min-height: 68px;
    }
    
    .chat-input-box {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .chat-send-button {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .ai-showcase-container {
        padding: 0 10px;
    }
    
    .ai-showcase-header h2 {
        font-size: 1.8rem;
    }
    
    .ai-chat-container {
        margin: 0 10px 2rem 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
    }
    
    .chat-header-card {
        padding: 1rem !important;
    }
    
    /* Smaller window controls on mobile */
    .window-controls {
        top: 0.8rem;
        right: 0.8rem;
        gap: 6px;
    }
    
    .window-control {
        width: 10px;
        height: 10px;
    }
    
    .chat-content-card {
        padding: 0 1rem 0 1rem !important;
        border-radius: 0 !important;
        border-bottom: none !important;
    }
    
    .chat-input-card {
        border-radius: 0 0 20px 20px !important;
    }
    
    .chat-header {
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .chat-header .ai-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .chat-header .ai-icon .finmagine-logo {
        width: 24px;
        height: 24px;
    }
    
    .chat-header .ai-info h3 {
        font-size: 1.1rem;
    }
    
    .chat-message {
        max-width: 98% !important;
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
    }
    
    .chat-message.user {
        max-width: 60% !important;
        align-self: flex-end !important;
        margin-left: auto !important;
        margin-right: 0 !important;
    }
    
    /* Smaller mobile input adjustments */
    .chat-input-container {
        padding: 0.6rem 1rem !important;
        gap: 8px !important;
        min-height: 60px !important;
    }
    
    .chat-input-box {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .chat-send-button {
        width: 36px !important;
        height: 36px !important;
    }
}