/**
 * YouTube Video Downloader - Modern SaaS Frontend Stylesheet
 */

:root {
    --ytvd-primary: #ff0000;
    --ytvd-primary-hover: #d90000;
    --ytvd-accent: #7c3aed;
    --ytvd-bg: #ffffff;
    --ytvd-card-bg: #ffffff;
    --ytvd-border: #e2e8f0;
    --ytvd-text: #0f172a;
    --ytvd-text-muted: #64748b;
    --ytvd-input-bg: #f8fafc;
    --ytvd-input-border: #cbd5e1;
    --ytvd-radius: 12px;
    --ytvd-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --ytvd-glow: 0 0 20px rgba(255, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
    .ytvd-container {
        --ytvd-bg: #0f172a;
        --ytvd-card-bg: #1e293b;
        --ytvd-border: #334155;
        --ytvd-text: #f8fafc;
        --ytvd-text-muted: #94a3b8;
        --ytvd-input-bg: #0f172a;
        --ytvd-input-border: #334155;
    }
}

.ytvd-container {
    max-width: 860px;
    margin: 30px auto;
    padding: 32px;
    background: var(--ytvd-card-bg);
    border: 1px solid var(--ytvd-border);
    border-radius: var(--ytvd-radius);
    box-shadow: var(--ytvd-shadow);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ytvd-text);
    box-sizing: border-box;
}

.ytvd-container * {
    box-sizing: border-box;
}

/* Header */
.ytvd-form-header {
    text-align: center;
    margin-bottom: 28px;
}

.ytvd-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 0, 0, 0.08);
    color: var(--ytvd-primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.ytvd-badge-dot {
    width: 6px;
    height: 6px;
    background: var(--ytvd-primary);
    border-radius: 50%;
    animation: ytvd-pulse 1.5s infinite;
}

@keyframes ytvd-pulse {
    0% { transform: scale(0.95); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(0.95); opacity: 1; }
}

.ytvd-title {
    margin: 0 0 8px 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--ytvd-text);
    letter-spacing: -0.5px;
}

.ytvd-desc {
    margin: 0;
    font-size: 15px;
    color: var(--ytvd-text-muted);
    line-height: 1.5;
}

/* Input Form */
.ytvd-field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ytvd-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ytvd-text);
}

.ytvd-req { color: var(--ytvd-primary); }

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

.ytvd-input {
    flex: 1;
    padding: 14px 18px;
    background: var(--ytvd-input-bg);
    border: 1px solid var(--ytvd-input-border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--ytvd-text);
    transition: all 0.2s ease;
    outline: none;
}

.ytvd-input:focus {
    border-color: var(--ytvd-primary);
    box-shadow: var(--ytvd-glow);
    background: var(--ytvd-bg);
}

.ytvd-help-text {
    font-size: 12px;
    color: var(--ytvd-text-muted);
    margin: 4px 0 0 0;
}

.ytvd-field-error {
    font-size: 13px;
    color: #ef4444;
    font-weight: 500;
}

/* Buttons */
.ytvd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.ytvd-btn-primary {
    background: linear-gradient(135deg, #ff0000 0%, #d90000 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 0, 0, 0.3);
}

.ytvd-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
}

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

.ytvd-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

.ytvd-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

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

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

/* Alert Box */
.ytvd-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 14px;
    font-weight: 500;
}

/* Results Section */
.ytvd-results-container {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--ytvd-border);
    animation: ytvd-fadeIn 0.3s ease-out;
}

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

/* Video Meta Card */
.ytvd-video-meta-card {
    display: flex;
    gap: 20px;
    background: var(--ytvd-input-bg);
    border: 1px solid var(--ytvd-border);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 28px;
    align-items: center;
}

.ytvd-thumb-wrap {
    position: relative;
    width: 220px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
}

.ytvd-video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ytvd-duration-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.ytvd-video-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.ytvd-video-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
}

.ytvd-video-author {
    margin: 0;
    font-size: 14px;
    color: var(--ytvd-text-muted);
}

.ytvd-meta-badges {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.ytvd-pill-meta {
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

/* Stream Formats */
.ytvd-format-group {
    margin-bottom: 24px;
}

.ytvd-format-group-title {
    margin: 0 0 14px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ytvd-text);
}

.ytvd-stream-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ytvd-stream-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ytvd-input-bg);
    border: 1px solid var(--ytvd-border);
    padding: 12px 18px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.ytvd-stream-item:hover {
    border-color: var(--ytvd-primary);
}

.ytvd-stream-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ytvd-badge-res {
    background: #ff0000;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 6px;
    text-transform: uppercase;
}

.ytvd-stream-container {
    font-size: 12px;
    font-weight: 700;
    color: var(--ytvd-text-muted);
    text-transform: uppercase;
}

.ytvd-stream-size {
    font-size: 13px;
    color: var(--ytvd-text);
    font-weight: 600;
}

.ytvd-stream-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ytvd-stream-right .ytvd-btn {
    padding: 7px 14px;
    font-size: 13px;
}

/* Toast */
.ytvd-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    background: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    animation: ytvd-slideUp 0.3s ease-out;
}

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

.ytvd-toast-icon { color: #10b981; }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 650px) {
    .ytvd-container {
        padding: 20px;
        margin: 15px auto;
    }

    .ytvd-input-wrapper {
        flex-direction: column;
    }

    .ytvd-video-meta-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .ytvd-thumb-wrap {
        width: 100%;
    }

    .ytvd-stream-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .ytvd-stream-right {
        width: 100%;
    }

    .ytvd-stream-right .ytvd-btn {
        flex: 1;
    }
}
