/*
  YouTube Transcript Generator - Professional Responsive UI
*/

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --success-bg: #F0FDF4;
    --success-text: #166534;
    --error-bg: #FEF2F2;
    --error-text: #991B1B;
    --text-main: #111827;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --bg-page: #F9FAFB;
    --bg-nav: #FFFFFF;
    --bg-card: #FFFFFF;
    --border: #E5E7EB;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 9999px;
    --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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.ad-space {
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: 2px dashed var(--text-muted);
    margin: 20px 0;
}

.ad-top {
    height: 90px;
}

.ad-sidebar {
    height: 600px;
    position: sticky;
    top: 90px;
}

/* Skeleton Loader */
.skeleton-loader {
    padding: 32px;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-page) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    margin-bottom: 12px;
    border-radius: 4px;
}

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

/* Theme Toggle Support */
.theme-dark {
    --bg-page: #111827;
    --bg-nav: #1F2937;
    --bg-card: #1F2937;
    --text-main: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-muted: #9CA3AF;
    --border: #374151;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle-btn:hover {
    background-color: var(--border);
    color: var(--primary);
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
}

@media (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .sidebar-ads {
        display: none;
    }
}

.main-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* 5️⃣ NAVBAR */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

/* 2️⃣ HERO SECTION */
.hero {
    padding: 60px 0 40px;
    text-align: center;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* 3️⃣ LANGUAGE SELECTOR + INPUT */
.search-section {
    max-width: 700px;
    margin: 0 auto;
}

.language-selector-wrapper {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.language-selector-wrapper label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.lang-dropdown {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.lang-dropdown:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.lang-dropdown:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.search-input-group {
    background: var(--bg-card);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 8px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.search-input-group:focus-within {
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    border-color: var(--primary);
}

.input-inner {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    width: 20px;
    height: 20px;
}

input[type="text"] {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: none;
    font-size: 1rem;
    outline: none;
    color: var(--text-main);
    background: transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 32px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 160px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 4️⃣ TRANSCRIPT AREA */
.content-container {
    padding-bottom: 80px;
}

.transcript-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--primary);
    color: white;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.transcript-info-badge i {
    width: 16px;
    height: 16px;
}

.video-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 0 auto 32px;
    border: 1px solid var(--border);
    max-width: 800px;
}

.video-aspect-ratio {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.video-aspect-ratio iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.action-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.pill-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.pill-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #F5F3FF;
}

.transcript-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.transcript-box {
    max-height: 500px;
    overflow-y: auto;
    padding: 32px;
}

.transcript-line {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 24px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.transcript-line:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.timestamp {
    font-family: monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-page);
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    height: fit-content;
}

.text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-main);
}

/* Status Messages */
.status-msg {
    max-width: 800px;
    margin: 0 auto 24px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-msg.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #FECACA;
}

.status-msg.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #BBF7D0;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* FOOTER */
.footer {
    background: #111827;
    color: #9CA3AF;
    padding: 60px 0 30px;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand {
    flex: 1;
}

.footer-brand .footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 16px;
}

.footer-brand p {
    max-width: 320px;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.footer-links {
    display: flex;
    gap: 60px;
}

.footer-col h4 {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-col a {
    text-decoration: none;
    color: inherit;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 30px;
    text-align: center;
    font-size: 0.875rem;
}

/* RESPONSIVE */
@media (min-width: 769px) {
    .language-selector-wrapper {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
    .lang-dropdown {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 36px; }
    .footer-container { flex-direction: column; gap: 32px; }
    .footer-links { gap: 40px; }
    .search-input-group { flex-direction: column; padding: 12px; gap: 12px; }
    .btn-primary { width: 100%; min-width: unset; height: 50px; }
}

@media (max-width: 480px) {
    .main-wrapper { padding-left: 16px; padding-right: 16px; }
    .nav-links { display: none; }
    .hero h1 { font-size: 28px; }
    .transcript-box { padding: 20px; }
    .transcript-line { grid-template-columns: 1fr; gap: 8px; }
    .timestamp { width: 60px; }
}
