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

:root {
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-tertiary: #24243a;
    --border-color: #2e2e48;
    --border-hover: #6366f1;
    --text-primary: #e0e0e0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #22c55e;
    --error: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --max-w: 640px;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Accessibility ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    z-index: 1000;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 16px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Header ===== */
.site-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    transition: color 0.2s;
}

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

/* ===== Navigation ===== */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.5rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.nav-toggle:hover {
    border-color: var(--border-hover);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-list a {
    display: block;
    padding: 6px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.nav-list a:hover {
    background: var(--accent-glow);
    color: var(--text-primary);
}

.nav-list a.active {
    background: var(--accent);
    color: #fff;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    max-width: var(--max-w);
    width: 100%;
    margin: 0 auto;
    padding: 48px 24px;
}

.converter-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 480px;
    margin: 0 auto;
}

/* ===== Upload Zone ===== */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
    background: var(--bg-secondary);
    position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--border-hover);
    background: var(--accent-glow);
}

.upload-zone:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-subtext {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.file-limit {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 12px;
}

/* ===== File Info ===== */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    animation: fadeIn 0.3s ease;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-remove {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.btn-remove:hover {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
}

/* ===== Progress ===== */
.progress-wrapper {
    animation: fadeIn 0.3s ease;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
    text-align: center;
}

/* ===== Error ===== */
.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--error);
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

.error-icon {
    flex-shrink: 0;
}

/* ===== Convert Button ===== */
.btn-convert {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    font-family: inherit;
}

.btn-convert:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

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

.btn-convert:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Download ===== */
.download-area {
    text-align: center;
    padding: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    animation: fadeIn 0.3s ease;
}

.success-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.download-text {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.btn-download {
    display: inline-block;
    padding: 12px 32px;
    background: var(--success);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
}

.btn-download:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

/* ===== How It Works ===== */
.how-it-works {
    margin-top: 64px;
    padding-top: 48px;
    border-top: 1px solid var(--border-color);
}

.how-it-works h2 {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text-primary);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

.step {
    text-align: center;
    padding: 20px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.3s;
}

.step:hover {
    border-color: var(--border-hover);
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    margin: 0 auto 12px;
}

.step h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.step p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-list {
        display: none;
        width: 100%;
        flex-direction: column;
        padding-top: 8px;
    }

    .nav-list.open {
        display: flex;
    }

    .nav-list a {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    h1 {
        font-size: 1.6rem;
    }

    .upload-zone {
        padding: 36px 16px;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .steps {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 32px 16px;
    }

    .steps {
        grid-template-columns: 1fr;
    }
}
