:root {
    --bg-primary: #0a0e14;
    --bg-secondary: #12161e;
    --bg-tertiary: #1a1f2b;
    --accent-orange: #f47b20;
    --accent-orange-bright: #ff8c3a;
    --accent-cyan: #00d4ff;
    --accent-red: #ff3366;
    --accent-yellow: #ffcc00;
    --text-primary: #e6e8eb;
    --text-secondary: #8b92a0;
    --text-dim: #5a6070;
    --border: #252a35;
    --shadow: rgba(244, 123, 32, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family:
        "Outfit",
        -apple-system,
        sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

#root {
    min-height: 100vh;
}

/* Animated grid background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(139, 146, 160, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 146, 160, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Random grid cell highlights */
.grid-highlight {
    position: fixed;
    width: 50px;
    height: 50px;
    pointer-events: none;
    z-index: 0;
    animation: flash 1.5s ease-out forwards;
}

.grid-highlight.orange {
    background: rgba(244, 123, 32, 0.15);
}

.grid-highlight.blue {
    background: rgba(0, 212, 255, 0.15);
}

@keyframes flash {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 1800px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 2rem;
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    height: 80px;
    width: auto;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
}

.header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

h1 {
    font-family: "JetBrains Mono", monospace;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(
        135deg,
        var(--accent-orange),
        var(--accent-orange-bright)
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .logo {
        height: 60px;
    }

    h1 {
        font-size: 2rem;
    }
}

.subtitle {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.input-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px var(--shadow);
}

.url-input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

input[type="text"] {
    flex: 1;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.1);
}

button {
    background: linear-gradient(
        135deg,
        var(--accent-orange),
        var(--accent-orange-bright)
    );
    border: none;
    border-radius: 8px;
    padding: 1rem 2rem;
    font-family: "Outfit", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(244, 123, 32, 0.3);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

button.stop {
    background: linear-gradient(135deg, var(--accent-red), #ff5577);
}

.error-message {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.875rem;
    color: var(--accent-red);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
}

.status-dot.active {
    background: var(--accent-orange);
    box-shadow: 0 0 10px var(--accent-orange);
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%,
    100% {
        box-shadow: 0 0 10px var(--accent-orange);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 20px var(--accent-orange);
        opacity: 0.8;
    }
}

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

@media (max-width: 1400px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

.video-panel {
    grid-row: span 2;
}

.right-panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.right-panels .panel {
    padding: 0.75rem;
}

.right-panels .panel-header {
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
}

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
}

.panel-header {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

video {
    width: 100%;
    height: 100%;
    display: block;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.metric-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.65rem;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: var(--accent-orange);
    box-shadow: 0 0 15px rgba(244, 123, 32, 0.1);
}

.metric-label {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-family: "JetBrains Mono", monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-orange);
    line-height: 1.1;
}

.metric-unit {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: 0.2rem;
}

.codec-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.codec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.65rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.75rem;
}

.codec-label {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.codec-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.75rem;
}

.chart-container {
    width: 100%;
    height: 250px;
    margin-top: 1rem;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-secondary);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 1rem;
}

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

.full-width {
    grid-column: 1 / -1;
}
