/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-input: #0f1629;
    --accent: #00b4d8;
    --accent-hover: #00cfff;
    --accent-glow: rgba(0, 180, 216, 0.3);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --error: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(0, 180, 216, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(0, 180, 216, 0.03) 0%, transparent 50%);
}

/* === Container === */
.container {
    width: 100%;
    max-width: 680px;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo h1 span {
    color: var(--accent);
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === Main Card === */
.main-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* === Input Group === */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.input-group input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group button {
    padding: 14px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.input-group button:hover {
    background: var(--accent-hover);
}

.input-group button:active {
    transform: scale(0.97);
}

.input-group button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* === Platform Icons === */
.platforms {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.platform-icon {
    width: 36px;
    height: 36px;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-muted);
    transition: color 0.2s, background 0.2s, transform 0.2s;
    cursor: default;
}

.platform-icon svg {
    width: 100%;
    height: 100%;
}

.platform-icon.active {
    color: var(--accent);
    background: rgba(0, 180, 216, 0.12);
    transform: scale(1.15);
}

/* === Status Area === */
.status-area {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.status-area.hidden {
    display: none;
}

.status-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.3s;
}

.step.active {
    color: var(--accent);
}

.step.done {
    color: var(--success);
}

.step-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid currentColor;
    flex-shrink: 0;
    position: relative;
    transition: background 0.3s, border-color 0.3s;
}

.step.active .step-indicator {
    border-color: var(--accent);
    background: rgba(0, 180, 216, 0.2);
    animation: pulse 1.5s infinite;
}

.step.done .step-indicator {
    border-color: var(--success);
    background: var(--success);
}

.step.done .step-indicator::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 0 6px transparent; }
}

.spinner {
    display: none;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.spinner.visible {
    display: block;
}

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

/* === Error Area === */
.error-area {
    margin-bottom: 24px;
    padding: 14px 18px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 0.9rem;
}

.error-area.hidden {
    display: none;
}

/* === Video Info === */
.video-info {
    display: flex;
    gap: 20px;
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.video-info.hidden {
    display: none;
}

.video-preview {
    position: relative;
    flex-shrink: 0;
    width: 200px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.video-preview img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.video-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.video-details h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-platform {
    font-size: 0.85rem;
    color: var(--accent);
    text-transform: capitalize;
}

.format-select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.format-select label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.format-select select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

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

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: auto;
}

.download-btn:hover {
    background: var(--accent-hover);
}

.download-btn:active {
    transform: scale(0.97);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* === Footer === */
.footer {
    text-align: center;
    margin-top: 32px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer strong {
    color: var(--text-secondary);
}

/* === Responsive === */
@media (max-width: 640px) {
    body {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .main-card {
        padding: 20px;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

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

    .input-group {
        flex-direction: column;
    }

    .input-group button {
        justify-content: center;
    }

    .platforms {
        gap: 10px;
    }

    .platform-icon {
        width: 30px;
        height: 30px;
        padding: 4px;
    }

    .video-info {
        flex-direction: column;
    }

    .video-preview {
        width: 100%;
    }

    .status-steps {
        gap: 8px;
    }
}

@media (max-width: 380px) {
    .logo h1 {
        font-size: 1.1rem;
    }

    .main-card {
        padding: 16px;
    }
}
