/* ═══════════════════════════════════════════════════════════════════
 *  YT Downloader v2 – Frontend Styles
 * ═══════════════════════════════════════════════════════════════════ */

.ytd-container {
    --ytd-primary:     #ff0000;
    --ytd-primary-dk:  #cc0000;
    --ytd-bg:          #ffffff;
    --ytd-surface:     #f8f9fa;
    --ytd-border:      #e0e0e0;
    --ytd-text:        #1a1a1a;
    --ytd-text-muted:  #6c757d;
    --ytd-success:     #00a32a;
    --ytd-error:       #d63638;
    --ytd-warning:     #dba617;
    --ytd-radius:      8px;

    max-width: 720px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--ytd-bg);
    border: 1px solid var(--ytd-border);
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    color: var(--ytd-text);
    position: relative;
    box-sizing: border-box;
}
.ytd-container *, .ytd-container *::before, .ytd-container *::after { box-sizing: border-box; }

/* Dark theme */
.ytd-dark {
    --ytd-bg: #0e1117; --ytd-surface: #1a1d24; --ytd-border: #2d3139;
    --ytd-text: #e6e6e6; --ytd-text-muted: #a3a8b0;
}

/* ── Header ────────────────────────────────────────────────────────── */
.ytd-header { text-align: center; margin-bottom: 1.5rem; }
.ytd-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.25rem; }
.ytd-subtitle { margin: 0; color: var(--ytd-text-muted); font-size: 0.9rem; }

/* ── URL Input ─────────────────────────────────────────────────────── */
.ytd-url-bar { margin-bottom: 1.25rem; }
.ytd-input-wrap {
    display: flex; align-items: center; gap: 8px;
    border: 2px solid var(--ytd-border); border-radius: var(--ytd-radius);
    background: var(--ytd-surface); padding: 0 12px; transition: border-color 0.2s;
}
.ytd-input-wrap:focus-within { border-color: var(--ytd-primary); }
.ytd-input-icon { font-size: 1.1rem; flex-shrink: 0; }
.ytd-input {
    flex: 1; padding: 0.7rem 0; font-size: 1rem;
    border: none; background: transparent; color: var(--ytd-text); outline: none;
}
.ytd-input::placeholder { color: var(--ytd-text-muted); }

.ytd-preview {
    display: flex; align-items: center; gap: 12px;
    margin-top: 10px; padding: 8px 12px;
    background: var(--ytd-surface); border-radius: var(--ytd-radius); border: 1px solid var(--ytd-border);
}
.ytd-preview img { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; }
.ytd-preview span { font-size: 0.85rem; color: var(--ytd-text-muted); }

/* ── Tabs ──────────────────────────────────────────────────────────── */
.ytd-tabs { display: flex; border-bottom: 2px solid var(--ytd-border); margin-bottom: 1.25rem; }
.ytd-tab {
    flex: 1; padding: 0.7rem 1rem; background: none; border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem; font-weight: 600; color: var(--ytd-text-muted);
    cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.ytd-tab:hover { color: var(--ytd-text); background: var(--ytd-surface); }
.ytd-tab-active { color: var(--ytd-primary); border-bottom-color: var(--ytd-primary); }

/* ── Panels ────────────────────────────────────────────────────────── */
.ytd-panel { display: none; }
.ytd-panel-active { display: block; animation: ytd-fadeIn 0.2s ease; }
@keyframes ytd-fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Options Row ───────────────────────────────────────────────────── */
.ytd-options-row { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ytd-checkbox-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.9rem; color: var(--ytd-text); cursor: pointer;
}
.ytd-checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ytd-primary); }
.ytd-select {
    padding: 0.5rem 0.75rem; border: 1px solid var(--ytd-border); border-radius: var(--ytd-radius);
    background: var(--ytd-surface); color: var(--ytd-text); font-size: 0.9rem; font-family: inherit;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.ytd-btn {
    display: inline-block; padding: 0.65rem 1.4rem; font-size: 0.95rem; font-weight: 600;
    border: none; border-radius: var(--ytd-radius); cursor: pointer; text-decoration: none;
    text-align: center; transition: all 0.2s; font-family: inherit; line-height: 1.4;
}
.ytd-btn-primary { background: var(--ytd-primary); color: #fff; }
.ytd-btn-primary:hover { background: var(--ytd-primary-dk); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(255,0,0,0.25); }
.ytd-btn-download {
    display: block; margin-top: 0.6rem; padding: 0.6rem 1rem;
    background: var(--ytd-surface); color: var(--ytd-text); border: 2px solid var(--ytd-border);
    border-radius: var(--ytd-radius); text-align: center; font-weight: 600; font-size: 0.9rem;
    text-decoration: none; transition: all 0.15s;
}
.ytd-btn-download:hover { background: var(--ytd-border); color: var(--ytd-text); }
.ytd-btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; background: var(--ytd-surface); color: var(--ytd-text); border: 1px solid var(--ytd-border); }
.ytd-btn-sm:hover { background: var(--ytd-border); }

/* ── Results ───────────────────────────────────────────────────────── */
.ytd-result {
    margin-top: 1.25rem; padding: 1rem;
    background: var(--ytd-surface); border: 1px solid var(--ytd-border); border-radius: var(--ytd-radius);
}
.ytd-result-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem; font-size: 0.85rem; color: var(--ytd-text-muted);
}
.ytd-output {
    width: 100%; padding: 0.75rem;
    font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
    font-size: 0.85rem; line-height: 1.6;
    background: var(--ytd-bg); color: var(--ytd-text);
    border: 1px solid var(--ytd-border); border-radius: 6px; resize: vertical;
}

/* ── Video Info ────────────────────────────────────────────────────── */
.ytd-video-info { margin-bottom: 1rem; }
.ytd-vi-row { display: flex; gap: 12px; align-items: center; }
.ytd-vi-thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.ytd-vi-text { display: flex; flex-direction: column; gap: 4px; }
.ytd-vi-text strong { font-size: 0.95rem; }
.ytd-vi-duration { font-size: 0.8rem; color: var(--ytd-text-muted); }
.ytd-stream-list { display: flex; flex-direction: column; gap: 0; }
.ytd-note { font-size: 0.8rem; color: var(--ytd-text-muted); margin-top: 0.75rem; }

/* ── Info / Status Boxes ───────────────────────────────────────────── */
.ytd-info-box {
    padding: 0.75rem 1rem; background: #e7f3fe; border-left: 4px solid #2196f3;
    border-radius: 4px; font-size: 0.88rem; margin-bottom: 1rem; color: #1a1a1a;
}
.ytd-dark .ytd-info-box { background: #1a2a3a; color: #c0d8f0; }

.ytd-status { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: var(--ytd-radius); font-size: 0.9rem; }
.ytd-status-success { background: #e6f9e6; border-left: 4px solid var(--ytd-success); color: #1a5c1a; }
.ytd-status-error   { background: #fde8e8; border-left: 4px solid var(--ytd-error);   color: #8b1a1a; }
.ytd-status-warning { background: #fff8e1; border-left: 4px solid var(--ytd-warning); color: #7a5c00; }
.ytd-dark .ytd-status-success { background: #1a2e1a; color: #b0e0b0; }
.ytd-dark .ytd-status-error   { background: #2e1a1a; color: #e0b0b0; }
.ytd-dark .ytd-status-warning { background: #2e2a1a; color: #e0d0b0; }

/* ── Loader ────────────────────────────────────────────────────────── */
.ytd-loader {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.88); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    border-radius: 12px; z-index: 100; backdrop-filter: blur(2px);
}
.ytd-dark .ytd-loader { background: rgba(14,17,23,0.9); }
.ytd-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--ytd-border); border-top-color: var(--ytd-primary);
    border-radius: 50%; animation: ytd-spin 0.8s linear infinite;
}
@keyframes ytd-spin { to { transform: rotate(360deg); } }
#ytd-loader-text { font-size: 0.9rem; color: var(--ytd-text-muted); font-weight: 500; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ytd-container { margin: 1rem; padding: 1.25rem; }
    .ytd-options-row { flex-direction: column; align-items: flex-start; }
    .ytd-tab { font-size: 0.85rem; padding: 0.6rem 0.5rem; }
    .ytd-vi-row { flex-direction: column; }
    .ytd-vi-thumb { width: 100%; height: auto; }
}
