/* ProImage Converter — Professional UI Styles */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242837;
    --bg-card: #1e2230;
    --bg-hover: #2a2f40;
    --border: #2d3348;
    --border-light: #3d4460;
    --text-primary: #e8eaf0;
    --text-secondary: #9ca3b8;
    --text-muted: #6b7394;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-subtle: rgba(99, 102, 241, 0.15);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f7;
    --bg-card: #ffffff;
    --bg-hover: #f0f2f7;
    --border: #e2e5ef;
    --border-light: #d1d5e4;
    --text-primary: #1a1d2e;
    --text-secondary: #5a6178;
    --text-muted: #8890a8;
    --accent-subtle: rgba(99, 102, 241, 0.08);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Password Gate */
.password-gate {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg-primary);
    display: flex; align-items: center; justify-content: center;
}
.password-gate.hidden { display: none; }
.password-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 40px; text-align: center;
    width: 380px; max-width: 90vw; box-shadow: var(--shadow-lg);
}
.password-card .logo { font-size: 28px; margin-bottom: 8px; }
.password-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.password-card input {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border);
    background: var(--bg-tertiary); color: var(--text-primary);
    border-radius: var(--radius-xs); font-size: 15px; font-family: var(--font);
    text-align: center; margin-bottom: 12px;
}
.password-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.password-error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 20px; }

/* Header */
.header {
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 56px; display: flex; align-items: center;
    justify-content: space-between; position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 20px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.logo span { color: var(--accent); }
.version-badge { font-size: 10px; padding: 2px 8px; background: var(--accent-subtle); color: var(--accent); border-radius: 20px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 6px; }
.header-btn {
    padding: 6px 12px; border: 1px solid var(--border); background: transparent;
    color: var(--text-secondary); border-radius: var(--radius-xs); cursor: pointer;
    font-size: 12px; font-weight: 500; transition: var(--transition);
    display: flex; align-items: center; gap: 5px;
}
.header-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.theme-toggle { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; }

/* Main Layout */
.main-container {
    max-width: 1440px; margin: 0 auto; padding: 20px;
    display: grid; grid-template-columns: 1fr 360px; gap: 20px;
    min-height: calc(100vh - 56px);
}

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.card-body { padding: 16px; }

/* Buttons */
.btn {
    padding: 7px 14px; border: none; border-radius: var(--radius-xs); cursor: pointer;
    font-size: 12px; font-weight: 600; transition: var(--transition);
    display: inline-flex; align-items: center; gap: 5px; font-family: var(--font);
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid transparent; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-lg { padding: 10px 20px; font-size: 14px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 4px; transition: var(--transition); }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-light); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: var(--transition); background: var(--bg-tertiary); position: relative;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-subtle); }
.drop-zone-icon { font-size: 40px; margin-bottom: 8px; opacity: 0.5; }
.drop-zone-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.drop-zone-hint { font-size: 11px; color: var(--text-muted); }
.drop-zone input[type="file"] { display: none; }
.drop-actions { margin-top: 12px; display: flex; gap: 6px; justify-content: center; }

/* File Queue */
.file-queue { margin-top: 12px; }
.file-queue-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; padding: 0 4px; }
.file-count { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.file-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.file-item {
    display: flex; align-items: center; padding: 6px 10px;
    border-bottom: 1px solid var(--border); font-size: 12px; gap: 8px;
    transition: var(--transition); cursor: pointer;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--bg-hover); }
.file-item.selected { background: var(--accent-subtle); border-color: var(--accent); }
.file-icon {
    width: 28px; height: 28px; border-radius: 4px; background: var(--accent-subtle);
    display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; overflow: hidden;
}
.file-icon img { width: 100%; height: 100%; object-fit: cover; }
.file-info { flex: 1; min-width: 0; }
.file-name { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; font-size: 12px; }
.file-meta { font-size: 10px; color: var(--text-muted); }
.file-badges { display: flex; gap: 3px; flex-wrap: wrap; }
.tool-badge { padding: 1px 6px; background: var(--accent-subtle); color: var(--accent); font-size: 9px; font-weight: 600; border-radius: 10px; text-transform: uppercase; }
.file-remove {
    width: 22px; height: 22px; border: none; background: transparent; color: var(--text-muted);
    cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: var(--transition); flex-shrink: 0;
}
.file-remove:hover { background: var(--danger-bg); color: var(--danger); }

/* File Tools Bar */
.file-tools-bar {
    display: flex; align-items: center; gap: 6px; padding: 8px 10px;
    background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-xs);
    margin-top: 8px; flex-wrap: wrap;
}
.file-tools-bar .tools-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-right: 4px; }

/* Settings Panel */
.settings-panel { display: flex; flex-direction: column; gap: 12px; }
.setting-group { display: flex; flex-direction: column; gap: 4px; }
.setting-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.setting-select, .setting-input {
    padding: 7px 10px; border: 1px solid var(--border); background: var(--bg-tertiary);
    color: var(--text-primary); border-radius: var(--radius-xs); font-size: 12px;
    font-family: var(--font); transition: var(--transition); width: 100%;
}
.setting-select:focus, .setting-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

/* Range Slider */
.range-group { display: flex; flex-direction: column; gap: 3px; }
.range-header { display: flex; justify-content: space-between; align-items: center; }
.range-value { font-size: 12px; font-weight: 600; color: var(--accent); font-family: var(--font-mono); }
input[type="range"] { -webkit-appearance: none; width: 100%; height: 5px; border-radius: 3px; background: var(--bg-tertiary); border: 1px solid var(--border); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg-secondary); box-shadow: 0 2px 6px rgba(0,0,0,0.3); }

/* Checkbox */
.checkbox-group { display: flex; flex-direction: column; gap: 6px; }
.checkbox-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    cursor: pointer; transition: var(--transition); font-size: 12px;
}
.checkbox-item:hover { background: var(--bg-hover); border-color: var(--border-light); }
.checkbox-item input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.checkbox-item .check-label { flex: 1; font-weight: 500; color: var(--text-primary); }
.checkbox-item .check-hint { font-size: 10px; color: var(--text-muted); }

/* Presets */
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.preset-chip {
    padding: 5px 8px; border: 1px solid var(--border); background: var(--bg-tertiary);
    color: var(--text-secondary); border-radius: var(--radius-xs); cursor: pointer;
    font-size: 10px; font-weight: 500; transition: var(--transition); text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preset-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
.preset-chip.active { border-color: var(--accent); background: var(--accent-subtle); color: var(--accent); }

/* Format Grid */
.format-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(55px, 1fr)); gap: 4px; }
.format-chip {
    padding: 5px 3px; border: 1px solid var(--border); background: var(--bg-tertiary);
    color: var(--text-secondary); border-radius: var(--radius-xs); cursor: pointer;
    font-size: 10px; font-weight: 600; text-align: center; text-transform: uppercase; transition: var(--transition);
}
.format-chip:hover { border-color: var(--accent); color: var(--accent); }
.format-chip.active { border-color: var(--accent); background: var(--accent-subtle); color: var(--accent); }

/* Progress */
.progress-container { display: none; margin-top: 12px; }
.progress-container.active { display: block; }
.progress-bar-wrapper { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 3px; transition: width 0.3s ease; width: 0%; }
.progress-text { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }

/* Results Gallery */
.results-gallery { display: flex; flex-direction: column; gap: 8px; }
.result-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); transition: var(--transition);
}
.result-item:hover { border-color: var(--border-light); }
.result-thumb {
    width: 48px; height: 48px; border-radius: 4px; overflow: hidden;
    background: var(--bg-primary); flex-shrink: 0;
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-info { flex: 1; min-width: 0; }
.result-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-size: 10px; color: var(--text-muted); }
.result-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Stats */
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat-item { display: flex; flex-direction: column; gap: 1px; }
.stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.stat-value { font-size: 13px; font-weight: 600; font-family: var(--font-mono); color: var(--text-primary); }
.stat-value.highlight { color: var(--success); }

/* History */
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item { display: flex; align-items: center; padding: 10px 12px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); gap: 10px; transition: var(--transition); }
.history-item:hover { border-color: var(--border-light); }
.history-status { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.history-status.completed { background: var(--success); }
.history-status.processing { background: var(--warning); animation: pulse 1.5s infinite; }
.history-status.failed { background: var(--danger); }
.history-info { flex: 1; min-width: 0; }
.history-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 10px; color: var(--text-muted); }
.history-actions { display: flex; gap: 3px; }
.history-btn { width: 26px; height: 26px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; transition: var(--transition); }
.history-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Preview / Comparison */
.preview-area { position: relative; background: var(--bg-tertiary); border-radius: var(--radius-sm); overflow: hidden; min-height: 180px; display: flex; align-items: center; justify-content: center; }
.preview-area img { max-width: 100%; max-height: 380px; object-fit: contain; }
.comparison-container { position: relative; overflow: hidden; border-radius: var(--radius-sm); cursor: ew-resize; user-select: none; }
.comparison-container img { display: block; width: 100%; pointer-events: none; }
.comparison-after { position: absolute; top: 0; left: 0; height: 100%; overflow: hidden; }
.comparison-slider { position: absolute; top: 0; width: 3px; height: 100%; background: white; cursor: ew-resize; z-index: 10; }
.comparison-slider::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.comparison-label { position: absolute; top: 6px; padding: 3px 10px; background: rgba(0,0,0,0.6); color: white; font-size: 10px; font-weight: 600; border-radius: 20px; z-index: 5; }
.comparison-label.before { left: 6px; }
.comparison-label.after { right: 6px; }

/* Modal/Overlay */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 500;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-content {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    max-width: 600px; width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 14px; font-weight: 600; }
.modal-body { padding: 16px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }

/* Histogram */
.histogram-canvas { width: 100%; height: 160px; background: var(--bg-tertiary); border-radius: var(--radius-xs); border: 1px solid var(--border); }

/* Compression chart */
.compression-chart { width: 100%; height: 180px; background: var(--bg-tertiary); border-radius: var(--radius-xs); border: 1px solid var(--border); }

/* EXIF Table */
.exif-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.exif-table th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: 10px; text-transform: uppercase; }
.exif-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.exif-table td:first-child { color: var(--text-secondary); font-weight: 500; white-space: nowrap; }

/* Color picker */
.color-display { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--bg-tertiary); border-radius: var(--radius-xs); }
.color-swatch { width: 36px; height: 36px; border-radius: 6px; border: 2px solid var(--border); }
.color-values { font-family: var(--font-mono); font-size: 12px; }

/* Resize panel */
.resize-inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
.resize-inputs input { width: 100%; }
.lock-btn { width: 28px; height: 28px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.lock-btn.active { color: var(--accent); border-color: var(--accent); }

/* Toasts */
.toast-container { position: fixed; top: 72px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 6px; }
.toast { padding: 10px 16px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; display: flex; align-items: center; gap: 6px; min-width: 260px; }
.toast.success { background: #16a34a; color: white; }
.toast.error { background: #dc2626; color: white; }
.toast.info { background: var(--info); color: white; }

/* Animations */
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* Empty state */
.empty-state { text-align: center; padding: 24px 12px; color: var(--text-muted); }
.empty-state-icon { font-size: 28px; margin-bottom: 6px; opacity: 0.4; }
.empty-state-text { font-size: 12px; }

/* Collapsible */
.collapse-trigger { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 4px; }
.collapse-trigger .arrow { transition: transform 0.2s; display: inline-block; font-size: 10px; }
.collapse-trigger.open .arrow { transform: rotate(90deg); }

/* Responsive */
@media (max-width: 1024px) { .main-container { grid-template-columns: 1fr; padding: 12px; } }
@media (max-width: 640px) {
    .header { padding: 0 12px; }
    .main-container { padding: 8px; gap: 8px; }
    .card-body { padding: 12px; }
    .drop-zone { padding: 24px 12px; }
    .preset-grid { grid-template-columns: 1fr; }
    .result-stats { grid-template-columns: 1fr; }
}
