/* FileConverter - Clean, Optimized CSS */

/* ===== CSS Variables & Theme Config ===== */
:root {
    /* Dimensions */
    --container-max: 720px;
    --header-max: 1200px; /* Wider header for desktop */
    --header-height: 64px;

    /* Dark Mode (Default) */
    --color-bg: #0a0a0b;
    --color-bg-elevated: #141416;
    --color-bg-hover: #1a1a1d;
    --color-surface: #1e1e21;
    --color-border: #2a2a2e;
    --color-border-hover: #3a3a3f;

    --color-text-primary: #fafafa;
    --color-text-secondary: #a1a1a6;
    --color-text-muted: #6b6b70;

    --color-accent: #6366f1;
    --color-accent-hover: #818cf8;
    --color-accent-muted: rgba(99, 102, 241, 0.15);

    --color-success: #22c55e;
    --color-success-muted: rgba(34, 197, 94, 0.15);
    --color-error: #ef4444;
    --color-error-muted: rgba(239, 68, 68, 0.15);
    --color-warning: #f59e0b;

    /* Header Background */
    --header-bg: rgba(10, 10, 11, 0.8);

    /* Typography */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Radius & Shadows */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Light Mode Overrides (Fixed Contrast) */
[data-theme="light"] {
    --color-bg: #ffffff;
    --color-bg-elevated: #f8fafc;
    --color-bg-hover: #f1f5f9;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;

    --color-text-primary: #0f172a; /* Darker Black */
    --color-text-secondary: #334155; /* Darker Gray */
    --color-text-muted: #64748b; /* Improved Visibility */

    --color-accent: #4f46e5;
    --color-accent-hover: #4338ca;
    --color-accent-muted: rgba(79, 70, 229, 0.1);

    --header-bg: rgba(255, 255, 255, 0.85);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-sans); background-color: var(--color-bg); color: var(--color-text-primary); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; transition: background-color var(--transition-normal), color var(--transition-normal); }
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-accent-hover); }

/* ===== Header (Fixed Width) ===== */
.header { position: sticky; top: 0; z-index: 100; background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--color-border); height: var(--header-height); transition: background-color var(--transition-normal), border-color var(--transition-normal); }
.header-content {
    max-width: var(--header-max); /* WIDER ON DESKTOP */
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: var(--space-sm); color: var(--color-text-primary); font-weight: 600; font-size: 1.125rem; }
.logo:hover { color: var(--color-text-primary); }
.logo-icon { width: 24px; height: 24px; color: var(--color-accent); }
.nav { display: flex; align-items: center; gap: var(--space-md); }
.nav-link.active { color: var(--color-accent); font-weight: 600; }
.nav-status { font-size: 0.875rem; color: var(--color-text-muted); padding: var(--space-xs) var(--space-md); background: var(--color-bg-elevated); border-radius: var(--radius-full); border: 1px solid var(--color-border); }

/* Theme Toggle */
.theme-btn { background: transparent; border: none; color: var(--color-text-muted); cursor: pointer; padding: 6px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast); }
.theme-btn:hover { color: var(--color-accent); background: var(--color-bg-hover); }
.theme-btn svg { width: 20px; height: 20px; }

/* ===== Main Content ===== */
.main { flex: 1; padding: var(--space-2xl) var(--space-lg); }
.container { max-width: var(--container-max); margin: 0 auto; }

/* Hero */
.hero { text-align: center; margin-bottom: var(--space-2xl); }
.hero-title { font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 700; letter-spacing: -0.02em; margin-bottom: var(--space-md); background: linear-gradient(135deg, var(--color-text-primary) 0%, var(--color-text-secondary) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-subtitle { font-size: 1.125rem; color: var(--color-text-secondary); max-width: 500px; margin: 0 auto; }

/* Upload Section */
.upload-section { margin-bottom: var(--space-2xl); }
.upload-form { display: flex; flex-direction: column; gap: var(--space-lg); }
.dropzone { position: relative; border: 2px dashed var(--color-border); border-radius: var(--radius-xl); padding: var(--space-3xl) var(--space-xl); text-align: center; cursor: pointer; transition: all var(--transition-normal); background: var(--color-bg-elevated); }
.dropzone:hover, .dropzone.dragover { border-color: var(--color-accent); background: var(--color-accent-muted); }
.dropzone-content { pointer-events: none; }
.dropzone-icon { width: 48px; height: 48px; color: var(--color-text-muted); margin-bottom: var(--space-md); }
.dropzone:hover .dropzone-icon { color: var(--color-accent); }
.dropzone-text { font-size: 1rem; color: var(--color-text-secondary); margin-bottom: var(--space-sm); }
.dropzone-browse { color: var(--color-accent); font-weight: 500; }
.dropzone-hint { font-size: 0.875rem; color: var(--color-text-muted); }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Upload Button Style */
.btn-upload { background-color: var(--color-bg); color: var(--color-text-primary); border: 1px solid var(--color-border); padding: 10px 20px; border-radius: var(--radius-md); font-weight: 500; cursor: pointer; margin: 10px 0; transition: all 0.2s; font-family: var(--font-sans); }
.dropzone:hover .btn-upload { background-color: var(--color-accent); color: white; border-color: var(--color-accent); }

/* File List & Items */
.file-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-md); }
.list-title { font-size: 1rem; font-weight: 600; color: var(--color-text-secondary); }
.header-actions { display: flex; gap: 10px; align-items: center; }
.clear-all-btn { background: transparent; border: none; color: var(--color-error); font-size: 0.875rem; cursor: pointer; font-weight: 500; }
.download-zip-btn { background-color: var(--color-accent); color: white; border: none; padding: 6px 12px; border-radius: var(--radius-md); font-size: 0.875rem; cursor: pointer; font-weight: 500; display: none; transition: background-color 0.2s; }
.download-zip-btn:hover { background-color: var(--color-accent-hover); }
.file-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.file-item { display: flex; align-items: center; gap: var(--space-md); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-sm) var(--space-md); transition: background var(--transition-fast); }
.file-item-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--color-bg-elevated); border-radius: var(--radius-md); color: var(--color-text-secondary); font-weight: 700; font-size: 0.75rem; border: 1px solid var(--color-border); }
.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-weight: 500; font-size: 0.9375rem; color: var(--color-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-meta { font-size: 0.75rem; color: var(--color-text-muted); }
.file-item-status { font-size: 0.875rem; font-weight: 500; color: var(--color-text-muted); min-width: 80px; text-align: right; }
.status-processing { color: var(--color-accent); } .status-success { color: var(--color-success); } .status-error { color: var(--color-error); }
.file-item-action { margin-left: var(--space-xs); }
.remove-btn { width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent; color: var(--color-text-muted); cursor: pointer; font-size: 1.25rem; display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast); }
.remove-btn:hover { background: var(--color-bg-hover); color: var(--color-error); }
.file-download-btn { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--color-success-muted); color: var(--color-success); display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast); }
.file-download-btn:hover { background: var(--color-success); color: white; }
.file-download-btn svg { width: 18px; height: 18px; }

/* Options & Controls */
.options-section { display: flex; flex-direction: column; gap: var(--space-lg); }
.option-group { display: flex; flex-direction: column; gap: var(--space-sm); }
.option-label { font-size: 0.875rem; font-weight: 500; color: var(--color-text-secondary); }
.format-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: var(--space-sm); }
.format-btn { padding: var(--space-sm) var(--space-md); background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text-secondary); font-size: 0.875rem; font-weight: 500; text-transform: uppercase; cursor: pointer; transition: all var(--transition-fast); text-align: center; }
.format-btn:hover { border-color: var(--color-border-hover); background: var(--color-bg-hover); }
.format-btn.active { background: var(--color-accent); border-color: var(--color-accent); color: white; }
.options-toggle { display: flex; align-items: center; justify-content: center; gap: var(--space-sm); padding: var(--space-sm); background: transparent; border: none; color: var(--color-text-muted); font-size: 0.875rem; cursor: pointer; transition: color var(--transition-fast); }
.options-toggle:hover { color: var(--color-text-secondary); }
.toggle-icon { width: 16px; height: 16px; transition: transform var(--transition-fast); }
.options-toggle.active .toggle-icon { transform: rotate(180deg); }
.advanced-options { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-lg); }
.options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
@media (max-width: 480px) { .options-grid { grid-template-columns: 1fr; } }
.option-item { display: flex; flex-direction: column; gap: var(--space-xs); }
.option-input, .option-select { padding: var(--space-sm) var(--space-md); background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text-primary); font-size: 0.875rem; font-family: inherit; transition: border-color var(--transition-fast); }
.option-input:focus, .option-select:focus { outline: none; border-color: var(--color-accent); }
.option-input::placeholder { color: var(--color-text-muted); }
.range-container { display: flex; align-items: center; gap: var(--space-md); }
.option-range { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; background: var(--color-bg-elevated); border-radius: var(--radius-full); cursor: pointer; }
.option-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; background: var(--color-accent); border-radius: 50%; cursor: pointer; transition: transform var(--transition-fast); }
.option-range::-webkit-slider-thumb:hover { transform: scale(1.1); }
.range-value { font-size: 0.875rem; font-family: var(--font-mono); color: var(--color-text-secondary); min-width: 40px; }
.color-input-wrapper { display: flex; gap: var(--space-sm); }
.color-input { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; background: transparent; }
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: none; border-radius: var(--radius-sm); }
.color-text { flex: 1; font-family: var(--font-mono); text-transform: uppercase; }

/* Convert Button */
.convert-btn { width: 100%; padding: var(--space-md) var(--space-xl); background: var(--color-accent); border: none; border-radius: var(--radius-lg); color: white; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all var(--transition-fast); display: flex; align-items: center; justify-content: center; gap: var(--space-sm); min-height: 52px; }
.convert-btn:hover:not(:disabled) { background: var(--color-accent-hover); box-shadow: var(--shadow-glow); }
.convert-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-loader { display: flex; align-items: center; gap: var(--space-sm); }
.spinner { width: 20px; height: 20px; animation: spin 1s linear infinite; }
.spinner-circle { stroke-dasharray: 45; stroke-dashoffset: 45; animation: dash 1.5s ease-in-out infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes dash { 0% { stroke-dashoffset: 45; } 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -45; } }

/* Formats Info */
.formats-info { text-align: center; }
.formats-title { font-size: 1.25rem; font-weight: 600; margin-bottom: var(--space-lg); color: var(--color-text-secondary); }
.formats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
@media (max-width: 600px) { .formats-grid { grid-template-columns: 1fr; } }
.format-category { padding: var(--space-lg); background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.format-category h3 { font-size: 0.875rem; font-weight: 600; color: var(--color-accent); margin-bottom: var(--space-sm); text-transform: uppercase; letter-spacing: 0.05em; }
.format-category p { font-size: 0.875rem; color: var(--color-text-muted); }

/* Promo Banner */
.promo-section { margin-top: 3rem; }
.promo-banner { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.2) 100%); border: 1px solid var(--color-accent-muted); padding: 20px 30px; border-radius: var(--radius-lg); text-decoration: none; transition: transform 0.2s, box-shadow 0.2s; }
.promo-banner:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--color-accent); }
.promo-content h3 { color: var(--color-text-primary); margin-bottom: 4px; font-size: 1.1rem; }
.promo-content p { color: var(--color-text-secondary); font-size: 0.9rem; margin: 0; }
.promo-badge { background: var(--color-accent); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; font-weight: bold; margin-right: 8px; vertical-align: middle; }
.promo-arrow { color: var(--color-accent); font-weight: 600; }

/* Footer */
.footer { background: var(--color-bg-elevated); border-top: 1px solid var(--color-border); padding: var(--space-xl) var(--space-lg); margin-top: auto; transition: background-color var(--transition-normal); }
.footer-content { max-width: var(--container-max); margin: 0 auto; text-align: center; }
.footer-links { display: flex; justify-content: center; gap: var(--space-lg); margin-bottom: var(--space-md); flex-wrap: wrap; }
.footer-links a { font-size: 0.875rem; color: var(--color-text-muted); transition: color var(--transition-fast); }
.footer-links a:hover { color: var(--color-text-primary); }
.footer-copyright { font-size: 0.75rem; color: var(--color-text-muted); }

/* PDF Dashboard Styles */
.pdf-dashboard { background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-lg); margin-top: var(--space-xl); display: none; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-md); border-bottom: 1px solid var(--color-border); padding-bottom: var(--space-sm); }
.tool-tabs { display: flex; gap: var(--space-md); }
.tool-tab { background: transparent; border: none; color: var(--color-text-secondary); font-weight: 600; padding: var(--space-sm) var(--space-md); cursor: pointer; border-radius: var(--radius-md); transition: all var(--transition-fast); }
.tool-tab:hover { color: var(--color-text-primary); background: var(--color-bg-hover); }
.tool-tab.active { background: var(--color-accent-muted); color: var(--color-accent); }
.close-btn { background: transparent; border: none; color: var(--color-text-muted); cursor: pointer; padding: 8px; border-radius: 50%; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.close-btn:hover { background: var(--color-error-muted); color: var(--color-error); }
.pdf-pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--space-md); max-height: 500px; overflow-y: auto; padding: var(--space-sm); background: var(--color-bg); border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.pdf-page-card { position: relative; cursor: pointer; border-radius: var(--radius-md); overflow: hidden; border: 2px solid transparent; transition: all var(--transition-fast); }
.pdf-page-card img { width: 100%; height: auto; display: block; opacity: 0.8; }
.pdf-page-card:hover img { opacity: 1; }
.pdf-page-card.selected { border-color: var(--color-accent); box-shadow: 0 0 0 4px var(--color-accent-muted); }
.pdf-page-card.selected img { opacity: 1; }
.page-number { position: absolute; bottom: 5px; right: 5px; background: rgba(0,0,0,0.7); color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.pdf-page-card.selected .page-number { background: var(--color-accent); }
.pdf-actions { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--color-border); }
.selection-info { font-size: 0.875rem; color: var(--color-text-muted); }
.btn-group { display: flex; gap: 10px; }
.compression-control { padding: var(--space-lg); background: var(--color-bg); border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.slider-labels { display: flex; justify-content: space-between; margin-bottom: var(--space-sm); font-size: 0.875rem; font-weight: 500; color: var(--color-text-secondary); }
.range-slider { width: 100%; -webkit-appearance: none; height: 6px; background: var(--color-border); border-radius: 3px; outline: none; }
.range-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--color-accent); border-radius: 50%; cursor: pointer; transition: transform 0.2s; }
.range-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.current-value { text-align: center; margin-top: var(--space-sm); color: var(--color-accent); font-weight: 600; }

/* Toast Notifications */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--color-surface); border: 1px solid var(--color-border); border-left: 4px solid var(--color-accent); padding: 16px 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); color: var(--color-text-primary); min-width: 300px; display: flex; align-items: center; gap: 12px; animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards; }
.toast.error { border-left-color: var(--color-error); }
.toast.success { border-left-color: var(--color-success); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }
