/* ============================================================
   Freecvt.com — MP4-to-GIF Converter  ·  Dark Theme CSS
   ============================================================ */

/* ---------- 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: var(--bg-primary);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ---------- Skip Link ---------- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-sm);
    z-index: 1000;
    font-weight: 600;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0.75rem;
}

/* ---------- Container ---------- */
.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ---------- Header / Nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 15, 20, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}
.logo:hover { color: var(--accent-hover); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: 0.3s;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    list-style: none;
    align-items: center;
}
.nav-links li a {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.nav-links li a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.nav-links li a.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

@media (max-width: 900px) {
    .nav-toggle {
        display: flex;
    }
    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 1rem 1.25rem;
        gap: 0.25rem;
        max-height: 70vh;
        overflow-y: auto;
    }
    .nav-links.open { display: flex; }
    .nav-links li a { font-size: 0.85rem; padding: 0.5rem 0.75rem; }
}

/* ---------- Main ---------- */
.main {
    flex: 1;
    padding: 2.5rem 0 3rem;
}

/* ---------- Page Title ---------- */
.page-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Converter Wrapper ---------- */
.converter-wrapper {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    transition: border-color 0.3s;
}

/* ---------- Upload Zone ---------- */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
    position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--border-hover);
    background: var(--accent-glow);
}
.upload-zone:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    color: var(--accent);
}

.upload-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.upload-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ---------- File List ---------- */
.file-list {
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.file-info {
    flex: 1;
    min-width: 0;
}

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

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

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s;
    line-height: 1;
    font-size: 1.1rem;
}
.file-remove:hover {
    color: var(--error);
}

/* ---------- Actions ---------- */
.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
    color: var(--text-primary);
}

/* ---------- Progress ---------- */
.progress-container {
    margin-top: 1.25rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ---------- Results ---------- */
.results-grid {
    margin-top: 1.25rem;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    border: 1px solid var(--success);
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.result-download {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: var(--success);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.result-download:hover {
    background: #16a34a;
}

/* ---------- Error ---------- */
.error-msg {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 0.85rem;
}

/* ---------- How It Works ---------- */
.how-it-works {
    margin-top: 3rem;
    text-align: center;
}
.how-it-works h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.step {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
}

.step-num {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.step h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

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

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

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

/* ---------- Spinner ---------- */
.spinner-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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