/* ========================================
   File Converter PWA - Professional Theme
   Clean, minimal, elegant design
   ======================================== */

:root {
    /* Colors - Clean dark theme */
    --bg-primary: #09090b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-card: #141416;
    --bg-hover: #1f1f23;

    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Accent - Clean cyan/teal */
    --accent: #06b6d4;
    --accent-hover: #22d3ee;
    --accent-muted: rgba(6, 182, 212, 0.15);
    --accent-glow: rgba(6, 182, 212, 0.25);

    /* Status */
    --success: #10b981;
    --success-muted: rgba(16, 185, 129, 0.15);
    --error: #ef4444;
    --warning: #f59e0b;

    /* Borders */
    --border: #27272a;
    --border-hover: #3f3f46;

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

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
}

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

/* Ensure hidden attribute always works */
[hidden] {
    display: none !important;
}

html {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
}

::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ========================================
   Layout
   ======================================== */

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Header
   ======================================== */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo svg {
    width: 28px;
    height: 28px;
}

.logo span {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--success-muted);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--success);
}

.privacy-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Main Content
   ======================================== */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    gap: 24px;
}

/* ========================================
   Dropzone
   ======================================== */

.dropzone {
    width: 100%;
    max-width: 520px;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.dropzone:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.dropzone.dragover {
    border-color: var(--accent);
    border-style: solid;
    background: var(--accent-muted);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.dropzone-content {
    text-align: center;
    padding: 24px;
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    color: var(--text-muted);
    transition: color var(--transition);
}

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

.dropzone-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.dropzone h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.dropzone p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.supported-formats {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.format-chip {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ========================================
   Panel
   ======================================== */

.panel {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* ========================================
   File List
   ======================================== */

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: border-color var(--transition-fast);
}

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

.file-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 16px;
    flex-shrink: 0;
}

.file-icon.image { background: rgba(6, 182, 212, 0.1); }
.file-icon.audio { background: rgba(168, 85, 247, 0.1); }
.file-icon.video { background: rgba(249, 115, 22, 0.1); }

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

.file-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.file-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.file-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.file-remove svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   Options
   ======================================== */

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-group label {
    font-size: 13px;
    font-weight: 500;
    min-width: 80px;
    color: var(--text-secondary);
}

.select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

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

.select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.quality-slider {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quality-slider input[type="range"] {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.quality-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
    box-shadow: 0 0 0 3px var(--bg-card);
}

.quality-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.quality-slider span {
    font-family: var(--font-mono);
    font-size: 12px;
    min-width: 36px;
    color: var(--accent);
    text-align: right;
}

/* ========================================
   Progress
   ======================================== */

.progress-container {
    margin-bottom: 20px;
}

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

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

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

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

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-full {
    width: 100%;
}

.actions {
    display: flex;
    gap: 10px;
}

.actions .btn {
    flex: 1;
}

/* ========================================
   Results
   ======================================== */

.results {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.results h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 6px;
}

.results h3::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--success-muted);
}

.result-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.result-info svg {
    width: 16px;
    height: 16px;
    color: var(--success);
    flex-shrink: 0;
}

.result-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-size {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.result-download {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-left: 12px;
}

.result-download:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

/* ========================================
   Footer
   ======================================== */

.footer {
    padding: 16px 24px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ========================================
   Loading Overlay
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 1000;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ========================================
   Responsive - Tablet
   ======================================== */

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }

    .main {
        padding: 24px 16px;
    }

    .dropzone {
        min-height: 240px;
    }

    .panel {
        padding: 16px;
    }
}

/* ========================================
   Responsive - Mobile
   ======================================== */

@media (max-width: 480px) {
    .header {
        height: auto;
        padding: 12px 16px;
        flex-direction: column;
        gap: 10px;
    }

    .header-badge {
        font-size: 11px;
        padding: 5px 10px;
    }

    .main {
        padding: 16px;
    }

    .dropzone {
        min-height: 200px;
    }

    .dropzone-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
    }

    .dropzone h2 {
        font-size: 16px;
    }

    .dropzone p {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .format-chip {
        font-size: 11px;
        padding: 3px 8px;
    }

    .panel {
        padding: 14px;
    }

    .file-list {
        max-height: 180px;
    }

    .file-item {
        padding: 8px 10px;
        gap: 10px;
    }

    .file-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .file-name {
        font-size: 12px;
    }

    .file-size {
        font-size: 11px;
    }

    .option-group {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .option-group label {
        min-width: auto;
    }

    .actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn {
        padding: 12px 16px;
    }

    .result-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .result-info {
        width: 100%;
    }

    .result-download {
        margin-left: auto;
    }

    .footer {
        padding: 14px 16px;
    }
}

/* ========================================
   Animations
   ======================================== */

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

.panel {
    animation: fadeIn 0.2s ease;
}

.file-item {
    animation: fadeIn 0.15s ease;
}

.result-item {
    animation: fadeIn 0.2s ease;
}

/* ========================================
   Focus States (Accessibility)
   ======================================== */

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

button:focus:not(:focus-visible) {
    outline: none;
}
