@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;600&family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette */
    --accent-blue: #0A84FF;
    --accent-blue-rgb: 10, 132, 255;
    --accent-purple: #BF5AF2;
    
    --bg-black: #08080C;
    --bg-darker: #040406;
    --card-bg: rgba(20, 20, 28, 0.7);
    --card-bg-hover: rgba(28, 28, 38, 0.85);
    
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-glow: rgba(10, 132, 255, 0.2);
    
    --text-primary: #FFFFFF;
    --text-secondary: #9696A6;
    --text-muted: #5C5C6E;
    
    --success: #30D158;
    --success-rgb: 48, 209, 88;
    --error: #FF453A;
    --error-rgb: 255, 69, 58;
    --warning: #FFD60A;

    /* Fonts & Radii */
    --font-sans: "Plus Jakarta Sans", "Inter", -apple-system, sans-serif;
    --font-mono: "Fira Code", monospace;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --transition-premium: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-black);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Cosmic Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #080812 0%, var(--bg-darker) 100%);
}

.blob {
    position: absolute;
    filter: blur(120px);
    opacity: 0.12;
    border-radius: 50%;
    pointer-events: none;
}

.blob-1 {
    width: 50vw;
    height: 50vw;
    top: -10%;
    right: 5%;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
}

.blob-2 {
    width: 45vw;
    height: 45vw;
    bottom: -10%;
    left: 5%;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
}

/* Nav */
.glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: rgba(8, 8, 12, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.logo span span {
    color: var(--accent-blue);
    background: linear-gradient(135deg, #FFF 30%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.active-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--success);
    background: rgba(48, 209, 88, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(48, 209, 88, 0.2);
}

/* Container & Sections */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
}

.hero-section {
    text-align: center;
    max-width: 750px;
    margin: 0 auto 4rem;
}

.hero-section h1 {
    font-size: 3.4rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.04em;
    margin-bottom: 1.25rem;
    background: linear-gradient(180deg, #FFFFFF 20%, #B4B4C5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section h1 span {
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transition: var(--transition-premium);
}

/* Upload */
.upload-section {
    padding: 4.5rem 2rem;
    text-align: center;
    cursor: pointer;
    max-width: 700px;
    margin: 0 auto 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.upload-section:hover, .upload-section.drag-over {
    border-color: var(--accent-blue);
    background: var(--card-bg-hover);
    box-shadow: 0 15px 30px rgba(10, 132, 255, 0.05);
    transform: translateY(-2px);
}

.icon-circle {
    width: 70px;
    height: 70px;
    background: rgba(10, 132, 255, 0.1);
    border: 1px solid rgba(10, 132, 255, 0.25);
    color: var(--accent-blue);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: var(--transition-premium);
}

.upload-section:hover .icon-circle {
    background: var(--accent-blue);
    color: #FFFFFF;
    box-shadow: 0 8px 20px rgba(10, 132, 255, 0.35);
}

.upload-section h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.upload-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.browse-link {
    color: var(--accent-blue);
    font-weight: 700;
    text-decoration: underline;
}

.upload-limits {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Loading */
.loader-container {
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.ai-orb-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.ai-orb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    background: radial-gradient(circle, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.5);
    animation: pulseOrb 2.2s ease-in-out infinite;
    z-index: 2;
}

.ai-rings {
    position: absolute;
    width: 100%;
    height: 100%;
}

.ring {
    position: absolute;
    border: 1.5px solid rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    top: 0; left: 0; right: 0; bottom: 0;
    margin: auto;
    animation: rotateRing 8s linear infinite;
}

.ring-1 { width: 80px; height: 80px; border-top-color: var(--accent-blue); animation-duration: 3s; }
.ring-2 { width: 100px; height: 100px; border-right-color: var(--accent-purple); animation-duration: 5s; animation-direction: reverse; }
.ring-3 { width: 120px; height: 120px; border-bottom-color: var(--accent-blue); animation-duration: 7s; }

@keyframes pulseOrb {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; box-shadow: 0 0 45px rgba(10, 132, 255, 0.7); }
}

@keyframes rotateRing {
    to { transform: rotate(360deg); }
}

#loading-status {
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-bar-container {
    width: 100%;
    max-width: 280px;
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border-radius: 10px;
    transition: width 0.4s ease;
}

/* Console Diagnostics */
.logs-console {
    max-width: 700px;
    margin: 1.5rem auto 0;
    background: rgba(4, 4, 6, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    overflow: hidden;
}

.console-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 0.6rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.console-dots {
    display: flex;
    gap: 5px;
}

.console-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.console-dot.red { background: #FF5F56; }
.console-dot.yellow { background: #FFBD2E; }
.console-dot.green { background: #27C93F; }

.console-title {
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.console-body {
    padding: 1.1rem;
    font-size: 0.75rem;
    color: #A0A0B0;
    height: 140px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.console-line {
    display: flex;
    gap: 0.6rem;
}

.console-line .prefix {
    color: var(--accent-blue);
    user-select: none;
}
.console-line.success .prefix { color: var(--success); }
.console-line.error .prefix { color: var(--error); }
.console-line.warning .prefix { color: var(--warning); }

/* Results */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.25rem;
}

.results-header h2 {
    font-size: 1.9rem;
    font-weight: 800;
}

.badge {
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

.badge.safe { background: rgba(48, 209, 88, 0.1); color: var(--success); border: 1px solid rgba(48, 209, 88, 0.2); }
.badge.safe::before { background: var(--success); }

.badge.unsafe { background: rgba(255, 69, 58, 0.1); color: var(--error); border: 1px solid rgba(255, 69, 58, 0.2); }
.badge.unsafe::before { background: var(--error); }

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

.results-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Left Col */
.video-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.video-container {
    padding: 1rem;
    background: rgba(4, 4, 6, 0.3);
}

video {
    width: 100%;
    border-radius: var(--radius-md);
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Timeline */
.timeline-container {
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.timeline-legend {
    display: flex;
    gap: 0.8rem;
    font-size: 0.7rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}
.legend-color.safe { background: var(--success); }
.legend-color.warning { background: var(--warning); }
.legend-color.unsafe { background: var(--error); }

.timeline-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 40px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    cursor: pointer;
}

.timeline-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.timeline-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: #FFFFFF;
    box-shadow: 0 0 5px #FFFFFF;
    pointer-events: none;
    transition: left 0.1s linear;
}

.timeline-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    background: rgba(8, 8, 12, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    color: #FFF;
    font-size: 0.7rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.timeline-tip {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Right Col: Stats */
.stats-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.stat-card {
    padding: 1.75rem;
}

.stat-card label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.4rem;
    background: linear-gradient(180deg, #FFFFFF 0%, #A2A2B2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.class-breakdown-card {
    padding: 1.5rem;
}

.class-breakdown-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.4rem;
}

.class-tags {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.class-tag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.02);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.04);
}

.class-tag-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.class-tag-count {
    background: rgba(255, 69, 58, 0.1);
    color: var(--error);
    border: 1px solid rgba(255, 69, 58, 0.2);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
}

.empty-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Buttons */
.buttons-row {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.btn {
    padding: 0.9rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-premium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: #FFFFFF;
    color: var(--bg-black);
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.05);
}

.btn-primary:hover {
    background: #E5E5E5;
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

/* Footer */
.footer {
    border-top: 1px solid var(--glass-border);
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-darker);
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
}

.credits p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.credits strong {
    color: var(--text-primary);
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* Grid Collapse */
@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
    .hero-section h1 {
        font-size: 2.6rem;
    }
    .container {
        padding-top: 6.5rem;
    }
}

@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 1.9rem;
    }
    .buttons-row {
        flex-direction: column;
    }
    .badge {
        padding: 0.4rem 0.9rem;
        font-size: 0.75rem;
    }
}
