/* Global Styles */
:root {
    --font-sans: "Inter", sans-serif;
    --text-color: rgb(25, 25, 24);
    --bg-color: #fafafa;
    --border-color: rgba(55, 53, 47, 0.12);
    --space-16: 16px;
    --space-24: 24px;
    --space-32: 32px;
    --text-muted: rgba(25, 25, 24, 0.9);
    --primary-color: #2383E2;
    --primary-hover: #1B6DC1;
    --primary-active: #155A9E;
    --selection-color: rgba(35, 131, 226, 0.28);
    --hover-surface: rgba(55, 53, 47, 0.08);
}

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

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-32) var(--space-24);
}

/* ========== APP HEADER ========== */
.app-header {
    text-align: center;
    margin-bottom: var(--space-24);
    padding: var(--space-16) var(--space-24);
    margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-color);
    margin: 0;
    padding-bottom: var(--space-16);
}

.app-header__title::after {
    content: "";
    display: block;
    width: 40%;
    height: 1px;
    background: var(--border-color);
    margin: var(--space-16) auto 0;
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: var(--space-24) var(--space-16);
    }

    .app-header {
        padding: 12px var(--space-16);
        margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-24);
    }

    .app-header__title {
        font-size: 28px;
    }
}

/* Input Section */
.input-section {
    margin-bottom: 64px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-label {
    font-size: 18px;
    font-weight: 500;
}

.input-wrapper {
    display: flex;
    gap: 12px;
}

input[type="text"] {
    flex: 1;
    font-size: 18px;
    padding: 12px 16px;
    border: 0.5px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
}

.primary-button {
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 50px;
    background: #000000;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.primary-button:hover {
    background: #1a1a1a;
}

.primary-button:active {
    background: #333333;
}

.primary-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Results Section */
.results-section {
    margin-top: 48px;
}

.result-block {
    margin-bottom: 48px;
}

.section-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 24px;
    border-bottom: 0.5px solid var(--border-color);
    padding-bottom: 8px;
}

.video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.video-card {
    display: flex;
    flex-direction: row;
    gap: 24px;
    padding: 20px;
    border: 0.5px solid var(--border-color);
    border-radius: 12px;
    transition: background-color 0.2s, transform 0.2s, border-color 0.2s;
    text-decoration: none;
    color: inherit;
    align-items: flex-start;
    background: #fff;
}

.video-card:hover {
    background-color: var(--hover-surface);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

/* Secondary results cards should be vertical since they are in a 2-column grid */
.secondary-results .video-card {
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.secondary-results .video-thumbnail {
    width: 100%;
}

.video-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 280px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-thumbnail .video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-content {
    flex: 1;
    min-width: 0;
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.video-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text-color);
    margin-bottom: 4px;
    transition: color 0.2s;
}

.video-card:hover .video-title {
    color: var(--primary-color);
}

.video-duration {
    font-size: 14px;
    background: rgba(0,0,0,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-muted);
}

.video-channel {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.video-explanation {
    font-size: 16px;
    line-height: 1.5;
    color: rgba(25, 25, 24, 0.7);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.secondary-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: stretch;
}

.secondary-results .result-block {
    display: flex;
    flex-direction: column;
}

.secondary-results div[id$="Content"] {
    flex: 1;
}

@media (max-width: 768px) {
    .secondary-results {
        grid-template-columns: 1fr;
    }
    
    .input-wrapper {
        flex-direction: column;
    }

    .video-card {
        flex-direction: column;
        gap: 16px;
    }

    .video-thumbnail {
        width: 100%;
    }
}

/* Loading State */
.hidden {
    display: none;
}

.loading-section {
    text-align: center;
    padding: 40px;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    margin-top: 80px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    border-top: 0.5px solid var(--border-color);
    padding-top: 24px;
}

