:root {
    --bg-color: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent-color: #6366f1;
    /* Indigo */
    --accent-hover: #4f46e5;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --font-main: 'Outfit', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 0.8s ease-out;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.gradient-text {
    color: var(--accent-color);
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* API Key Section */
.api-key-section {
    max-width: 600px;
    margin: 0 auto 2rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.api-key-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.hint a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Upload Section */
.input-section {
    max-width: 700px;
    margin: 0 auto;
    animation: fadeIn 0.8s ease-out 0.1s backwards;
}

.url-input-container {
    display: flex;
    gap: 0.75rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.url-input-container input {
    border: none;
    box-shadow: none;
}

button {
    padding: 0 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

button:hover {
    background-color: var(--accent-hover);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Split View Layout */
/* Split View Layout */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Side by side */
    gap: 2rem;
    margin-top: 3rem;
    animation: slideUp 0.6s ease-out;
    align-items: start;
}

.player-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;

    /* Sticky behavior for desktop */
    position: sticky;
    top: 2rem;
    z-index: 10;
}

#player {
    width: 100%;
    height: 100%;
}

.result-section {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 400px;
    /* Match approximately video height + extra */
}

/* ... headers/buttons ... */

.result-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.result-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.icon-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
    min-width: auto;
    border-radius: 6px;
}

.icon-btn:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.summary-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Skeleton Loader */
.skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.5s;
    width: 100%;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-line.long {
    width: 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Markdown Styling */
.summary-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.summary-content h3:first-child {
    margin-top: 0;
}

.summary-content ul {
    list-style: none;
    padding: 0;
}

.summary-content li {
    margin-bottom: 1rem;
    position: relative;
    padding-left: 1.25rem;
}

.summary-content li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* Timestamp Chips */
.timestamp-chip {
    display: inline-block;
    padding: 2px 6px;
    background-color: #eef2ff;
    color: var(--accent-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    margin-left: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.timestamp-chip:hover {
    background-color: #e0e7ff;
    text-decoration: none;
}

/* Utilities */
.hidden {
    display: none !important;
}

.error-box {
    margin-top: 1rem;
    text-align: center;
    color: #ef4444;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .split-view {
        display: flex;
        flex-direction: column-reverse;
        /* Summary first, Video second/bottom */
        grid-template-columns: none;
        height: auto;
        gap: 1.5rem;
    }

    .player-container {
        height: auto;
        position: relative;
        top: auto;
        width: 100%;
    }

    .summary-content {
        max-height: 500px;
        /* Scrollable summary on mobile */
    }
}