@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root, [data-theme="dark"] {
    --bg-dark: #0f0f0f;
    --card-bg: #1f1f1f;
    --card-border: #2e2e2e;
    --input-bg: #121212;
    --badge-bg: #272727;
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --accent-red: #ff0000;
    --accent-red-hover: #cc0000;
    --accent-glow: rgba(255, 0, 0, 0.25);
    --success-green: #2ea043;
    --success-green-hover: #238636;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
    --radius-lg: 12px;
    --radius-md: 8px;
    --transition: all 0.2s ease-in-out;
}

[data-theme="light"] {
    --bg-dark: #f5f6f8;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --input-bg: #f8fafc;
    --badge-bg: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent-red: #ff0000;
    --accent-red-hover: #cc0000;
    --accent-glow: rgba(255, 0, 0, 0.15);
    --success-green: #2ea043;
    --success-green-hover: #238636;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 36px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--badge-bg);
    border: 1px solid var(--card-border);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.brand-badge svg {
    width: 18px;
    height: 18px;
    fill: var(--accent-red);
}

.app-title {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.app-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 400;
}

/* Theme Switcher Button */
.theme-toggle-btn {
    background: var(--badge-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.theme-toggle-btn:hover {
    transform: scale(1.08);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-main);
}

/* Ad Banner Button */
.btn-ad-cta {
    background: var(--badge-bg);
    color: var(--text-main);
    border: 1px solid var(--card-border);
    text-decoration: none;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-ad-cta:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}


/* Main Card */
.converter-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    margin-bottom: 40px;
    transition: var(--transition);
}

/* Input Form */
.url-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.url-input {
    width: 100%;
    background: var(--input-bg);
    border: 2px solid var(--card-border);
    padding: 16px 20px 16px 50px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.url-input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 12px var(--accent-glow);
}

.input-icon {
    position: absolute;
    left: 18px;
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.url-input:focus ~ .input-icon {
    fill: var(--accent-red);
}

.btn-submit {
    background: var(--accent-red);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover {
    background: var(--accent-red-hover);
    transform: translateY(-1px);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Video Details Section */
.video-preview {
    display: none;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--card-border);
    animation: fadeIn 0.3s ease-out;
}

.preview-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 640px) {
    .preview-grid {
        grid-template-columns: 1fr;
    }
}

.thumbnail-box {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #000;
    border: 1px solid var(--card-border);
}

.thumbnail-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.meta-tags {
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.meta-tag {
    background: var(--badge-bg);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
}

/* Format & Quality Selector */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.options-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.select-custom {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.select-custom:focus {
    border-color: var(--accent-red);
}

/* Progress Section */
.progress-container {
    display: none;
    margin-top: 24px;
    animation: fadeIn 0.3s ease;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: var(--badge-bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-red);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.status-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

/* Download Result Box */
.result-box {
    display: none;
    margin-top: 24px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.btn-download {
    background: var(--success-green);
    color: white;
    text-decoration: none;
    padding: 16px 36px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-download:hover {
    background: var(--success-green-hover);
    transform: translateY(-1px);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 60px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--card-border);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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