/* Bento Features - 3x3 Grid Layout */

:root {
    --bento-bg: #FFFFFF;
    --bento-border: #f0f4fa;
    --bento-shadow: inset 0 -3px 3px #0013581a, 0 4px 12px #0013580a, 0 3px 6px #0013580a, 0 0.5px 1px #00135826;
    --primary-soft: #FEF2F2;
    --primary-solid: #EF4444;
}

.bento-features {
    padding: var(--space-8) 2%;
    background-color: #fafafa;
}

.bento-features__container {
    max-width: 1200px;
    margin: 0 auto;
    perspective: 1000px;
    /* For GSAP 3D tilt */
}

.bento-features__header {
    text-align: center;
    max-width: var(--container-md);
    margin: 0 auto var(--space-8);
}

.bento-features__title {
    font-family: var(--font-family-heading);
    font-size: var(--section-title);
    font-weight: 600;
    letter-spacing: var(--tracking-tightest);
    line-height: var(--leading-tight);
    color: var(--color-gray-900);
    margin-bottom: var(--space-3);
}

/* Grid Layout */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(280px, auto);
    gap: 24px;
}

@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 280px);
    }
}

/* Card Base */
.bento-card {
    background: var(--bento-bg);
    border: 1px solid var(--bento-border);
    border-radius: 24px;
    padding: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--bento-shadow);
    display: flex;
    flex-direction: column;
    transform-style: preserve-3d;
    /* For child tilt if needed */
    will-change: transform;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.bento-card__insight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
    pointer-events: none;
    transform: translateZ(50px);
    /* Lift the insight text in 3D space */
}

@media (min-width: 1024px) {
    .bento-card:hover .bento-card__insight {
        opacity: 1;
        visibility: visible;
    }
}

.insight-title {
    font-family: var(--font-family-heading);
    font-size: 14px;
    font-weight: 800;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.insight-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-gray-900);
    line-height: 1.4;
    max-width: 240px;
}

@keyframes alert-pulse {
    0% {
        box-shadow: var(--bento-shadow), 0 0 0 0 rgba(239, 68, 68, 0.2);
    }

    70% {
        box-shadow: var(--bento-shadow), 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: var(--bento-shadow), 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.bento-card.alert-pulsing {
    border: 1px solid var(--bento-border);
    box-shadow: var(--bento-shadow);
    animation: alert-pulse 2s infinite;
}

/* "Grayed Out" / Discrete Card for Script Writer */
.bento-card.discrete {
    background: #F8F8F8 repeating-linear-gradient(45deg,
            #F8F8F8,
            #F8F8F8 10px,
            #F3F3F3 10px,
            #F3F3F3 20px);
    border-color: #E5E7EB;
    position: relative;
}

.discrete-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.construction-badge {
    background: #FEF3C7;
    color: #D97706;
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}


/* Content Area */
.bento-card__content {
    z-index: 10;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.bento-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--primary-soft);
    color: var(--primary-solid);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bento-card__badge.coming-soon {
    background: #F3F4F6;
    color: #6B7280;
    border: 1px solid #E5E7EB;
}

.bento-card__badge--beta {
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FCD34D;
}

.bento-card__title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.bento-card__description {
    font-size: 15px;
    color: #6B7280;
    line-height: 1.5;
}

/* Visual Area */
.bento-card__visual {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}


/* --- Specific Visuals --- */

/* 1. Dashboard (2x2) */
.visual-dashboard {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-top: 10px;
}

.dash-window {
    width: 100%;
    height: 100%;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.dash-bar {
    height: 48px;
    background: white;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
}

.dash-title-text {
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-dots {
    display: flex;
    gap: 6px;
}

.dash-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #E5E7EB;
}

/* Dashboard Grid */
.dash-grid-container {
    padding: 24px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #F8F9FA;
}

.dash-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
}

.grid-video-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.grid-video-thumb {
    aspect-ratio: 16/9;
    background: #E5E7EB;
    position: relative;
    overflow: hidden;
}

.grid-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid-video-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.grid-video-meta {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    /* Allow meta to fill space */
}

.grid-video-title {
    font-size: 11px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Dashboard Stats */
.grid-video-stats {
    font-size: 10px;
    color: #6B7280;
    margin-top: auto;
    /* Align to bottom */
    display: flex;
    align-items: center;
    gap: 8px;
}

.grid-video-stats span {
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
}

/* 2. Alerts (Vertical List) */
.visual-alerts-vertical {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Hide cards entering from outside */
}

/* Extra Wrapper for smooth stacking */
.alert-card {
    background: white;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid #F3F4F6;
    width: 90%;
    position: absolute;
    /* Initial state controlled by JS mainly, but default hidden to avoid flash */
    opacity: 0;
}

.alert-icon {
    width: 40px;
    height: 40px;
    background: #FEF2F2;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #EF4444;
    flex-shrink: 0;
}

.alert-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-head {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.alert-sub {
    font-size: 11px;
    color: #6B7280;
}

/* 3. Discovery (Search & Results) */
.visual-discovery-search {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 20px;
}

/* Search Bar State */
.discovery-search-bar {
    background: white;
    padding: 10px 20px;
    border-radius: 100px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6B7280;
    font-size: 13px;
    font-weight: 500;
    width: auto;
    min-width: 240px;
    position: absolute;
    /* Centered initially, will animate */
    transform: translateY(0);
    z-index: 10;
}

.search-icon {
    width: 16px;
    height: 16px;
    color: #9CA3AF;
}

.search-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #E5E7EB;
    border-top-color: #EF4444;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Results Row */
.discovery-results-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 60px;
    /* Space for search bar when it moves up */
    width: 100%;
}

.result-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    /* Hidden init */
    transform: translateY(20px);
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    position: relative;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-match {
    position: absolute;
    bottom: -4px;
    right: -8px;
    background: #10B981;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

.profile-info {
    text-align: center;
}

.profile-name {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
}

.profile-sub {
    font-size: 10px;
    color: #6B7280;
}


/* 4. Script Writer (Beta) */
.visual-writer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.writer-paper {
    width: 78%;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.writer-line {
    height: 8px;
    background: linear-gradient(90deg, #E5E7EB 0%, #D1D5DB 100%);
    border-radius: 6px;
    width: 0%;
    transform-origin: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.writer-line--title.line-1 {
    height: 10px;
    background: linear-gradient(90deg, #FEE2E2 0%, #FECACA 100%);
    border-radius: 6px;
}

.writer-line.line-2 {
    height: 8px;
}

.writer-line.line-3 {
    height: 8px;
    width: 0%;
}

.writer-sources {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    background: #F0FDF4;
    color: #166534;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    width: fit-content;
    opacity: 0;
    transform-origin: left;
}

.writer-sources svg {
    flex-shrink: 0;
}

/* Layout Spans */
@media (min-width: 1024px) {
    .col-span-1 {
        grid-column: span 1;
    }

    .col-span-2 {
        grid-column: span 2;
    }

    .row-span-1 {
        grid-row: span 1;
    }

    .row-span-2 {
        grid-row: span 2;
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 1023px) {
    .bento-grid {
        grid-template-columns: 1fr;
        /* Stack everything */
        gap: 24px;
    }

    /* Reset grid spans for mobile */
    .col-span-1,
    .col-span-2,
    .row-span-1,
    .row-span-2 {
        grid-column: auto;
        grid-row: auto;
    }

    /* Force height for visual containers on mobile to ensure animations fit */
    .bento-card__visual {
        min-height: 250px;
    }

    /* Dashboard Mobile Refinements */
    .dash-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Show only 4 cards on mobile dashboard */
    .dash-cards-grid .grid-video-card:nth-child(n+5) {
        display: none;
    }

    .grid-video-badge {
        font-size: 8px;
        padding: 1px 4px;
    }

    .grid-video-title {
        font-size: 10px;
    }

    /* Adjust discovery results for small screens */
    .discovery-results-row {
        gap: 12px;
    }

    .profile-avatar {
        width: 48px;
        height: 48px;
    }

    .profile-name {
        font-size: 11px;
    }
}

/* Copy Feature Buttons */

/* Desktop In-card Button */
.stat-copy-btn {
    background: var(--primary-soft);
    border: none;
    padding: 2px 8px;
    margin-left: auto;
    /* Push to the right */
    cursor: pointer;
    color: var(--primary-solid);
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.stat-copy-btn:hover {
    background: var(--primary-solid);
    color: white;
}

/* Mobile "Below Dashboard" Button */
.mobile-copy-ui {
    display: none;
    /* Hidden on desktop */
    width: 100%;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 12px 16px;
    margin-top: -2px;
    z-index: 5;
    position: relative;
}

.mobile-copy-btn {
    width: 100%;
    background: var(--primary-solid);
    border: none;
    color: white;
    font-weight: 700;
    font-size: 14px;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    /* For link */
}

.mobile-copy-btn:active {
    transform: scale(0.98);
}

/* Responsive Logic */
@media (min-width: 1024px) {
    .mobile-copy-ui {
        display: none !important;
    }
}

@media (max-width: 1023px) {

    /* Hide the small desktop buttons */
    .stat-copy-btn {
        display: none !important;
    }

    .mobile-copy-ui {
        display: block;
    }

    /* Adjust dash-window to look connected */
    .visual-dashboard .dash-window {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        border-bottom: none;
        height: auto;
    }

    .visual-dashboard {
        height: auto !important;
        min-height: 250px;
    }
}