/* ============================================
   GIF Enhancer - Blue Theme
   gce- prefixed to avoid custom_styles.css conflicts
   ============================================ */

:root {
    --transition-speed: 0.25s;
    --primary:       #3399cc;
    --primary-light: #e6f4fb;
    --primary-dark:  #2277aa;
    --success:       #339966;
    --success-light: #e6f4ee;
    --warning:       #f59e0b;
    --danger:        #e64e4e;
    --danger-light:  #fce8e8;
    --tag-brightness: #3399cc;
    --tag-saturation: #8b5cf6;
    --tag-sharpness:  #339966;
    --tag-denoise:    #f59e0b;
    --bg:            #f4f8fb;
    --bg-elevated:   #ffffff;
    --bg-secondary:  #eef5fa;
    --bg-tertiary:   #daeaf5;
    --text:          #1a2e3a;
    --text-secondary:#2a4a60;
    --text-muted:    #6a8a9a;
    --border:        #cfe0ec;
    --border-light:  #e0eff8;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.07);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.09);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.1);
    --shadow-primary:       0 4px 14px rgba(51,153,204,0.25);
    --shadow-primary-hover: 0 6px 20px rgba(51,153,204,0.35);
    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 9999px;
    --checker-light: #d8eaf5;
    --checker-dark:  #c5daea;
    --input-bg:     #ffffff;
    --input-border: #cfe0ec;
}

[data-theme="dark"] {
    --primary:       #4db8e8;
    --primary-light: rgba(77,184,232,0.15);
    --primary-dark:  #3399cc;
    --success:       #4ade80;
    --success-light: rgba(74,222,128,0.15);
    --danger:        #f87171;
    --danger-light:  rgba(248,113,113,0.15);
    --tag-brightness: #60c8f0;
    --tag-saturation: #a78bfa;
    --tag-sharpness:  #4ade80;
    --tag-denoise:    #fbbf24;
    --bg:            #0a1520;
    --bg-elevated:   #111e2b;
    --bg-secondary:  #182839;
    --bg-tertiary:   #1e3347;
    --text:          #d8eef8;
    --text-secondary:#a0cce0;
    --text-muted:    #6a9ab0;
    --border:        #1e3347;
    --border-light:  #182839;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.5);
    --shadow-primary:       0 4px 14px rgba(77,184,232,0.2);
    --shadow-primary-hover: 0 6px 20px rgba(77,184,232,0.3);
    --checker-light: #182839;
    --checker-dark:  #1e3347;
    --input-bg:     #182839;
    --input-border: #1e3347;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text);
    line-height: 1.6; margin: 0; padding: 0;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Override custom_styles.css conflicts */
.tool-main { overflow: visible !important; }

/* ─── Header ──────────────────────────────────────── */
.gce-header { text-align: center; margin-bottom: 2rem; }
.gce-title-row { display: flex; align-items: center; justify-content: center; gap: 0.875rem; margin-bottom: 0.875rem; }
.gce-icon-wrap {
    width: 56px; height: 56px; background: var(--primary);
    border-radius: var(--radius-lg); display: flex; align-items: center;
    justify-content: center; color: white; box-shadow: var(--shadow-primary); flex-shrink: 0;
}
.gce-icon-wrap i { width: 26px; height: 26px; }
.gce-title { font-size: clamp(1.6rem, 4vw, 2.25rem); font-weight: 700; margin: 0; color: var(--primary); letter-spacing: -0.02em; }
.gce-description { font-size: 1rem; color: var(--text-muted); max-width: 800px; margin: 0 auto; line-height: 1.7; }
.gce-description a { color: var(--primary); text-decoration: none; }
.gce-description a:hover { text-decoration: underline; }

/* ─── Main card ───────────────────────────────────── */
.gce-main { background: var(--bg-elevated); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; border: 1px solid var(--border); margin-bottom: 2rem; }

/* ─── Mode bar ────────────────────────────────────── */
.gce-mode-bar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem;
}
.gce-mode-toggle { display: flex; background: var(--bg-secondary); border-radius: var(--radius-full); padding: 3px; border: 1px solid var(--border); }
.gce-mode-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.875rem; border: none; background: transparent;
    color: var(--text-muted); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; border-radius: var(--radius-full); transition: all 0.2s;
}
.gce-mode-btn.active { background: var(--primary); color: white; }
.gce-mode-btn:hover:not(.active) { color: var(--text); }

.gce-auto-toggle {
    display: inline-flex; align-items: center; gap: 0.5rem;
    cursor: pointer; font-size: 0.83rem; color: var(--text-muted);
    padding: 0.35rem 0.75rem; background: var(--bg-secondary);
    border-radius: var(--radius-full); border: 1px solid var(--border);
    transition: all 0.2s; user-select: none;
}
.gce-auto-toggle:hover { border-color: var(--primary); color: var(--primary); }
.gce-auto-toggle input { display: none; }
.gce-auto-toggle .gce-chk-custom { width: 16px; height: 16px; flex-shrink: 0; }

/* ─── Upload ──────────────────────────────────────── */
.gce-upload-section { padding: 2rem 2.5rem; }
.gce-upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius-lg);
    padding: 3rem 2rem; text-align: center; cursor: pointer;
    transition: all 0.3s ease; background: var(--bg-secondary);
    position: relative; overflow: hidden;
}
.gce-upload-area::before { content: ''; position: absolute; inset: 0; background: var(--primary-light); opacity: 0; transition: opacity 0.3s; }
.gce-upload-area:hover, .gce-upload-area.dragover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gce-upload-area:hover::before, .gce-upload-area.dragover::before { opacity: 0.5; }
.gce-upload-content { position: relative; z-index: 1; }
.gce-upload-icon { color: var(--primary); margin-bottom: 1.25rem; transition: transform 0.3s; }
.gce-upload-area:hover .gce-upload-icon { transform: translateY(-5px); }
.gce-upload-title { font-size: 1.4rem; font-weight: 600; color: var(--text); margin: 0 0 0.4rem; }
.gce-upload-subtitle { color: var(--text-muted); margin: 0 0 0.875rem; }
.gce-file-types { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.gce-file-badge { background: var(--primary-light); color: var(--primary); padding: 0.3rem 0.8rem; border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 600; }
.gce-upload-hint { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.85rem; }

/* ─── Batch Queue ─────────────────────────────────── */
.gce-batch-queue { margin-top: 1.25rem; background: var(--bg-secondary); border-radius: var(--radius-md); padding: 1rem; }
.gce-batch-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; font-size: 0.875rem; color: var(--text); }
.gce-batch-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 200px; overflow-y: auto; }
.gce-batch-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0.75rem; background: var(--bg-elevated);
    border-radius: var(--radius-sm); font-size: 0.82rem;
}
.gce-batch-item i { color: var(--text-muted); flex-shrink: 0; }
.gce-batch-item-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gce-batch-item-size { color: var(--text-muted); white-space: nowrap; }
.gce-batch-item-remove {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 0.125rem; border-radius: 3px; transition: color 0.2s;
}
.gce-batch-item-remove:hover { color: var(--danger); }
.gce-batch-item.processing { background: var(--primary-light); }
.gce-batch-item.done { background: var(--success-light); }
.gce-batch-item.done i { color: var(--success); }
.gce-batch-item.error { background: var(--danger-light); }
.gce-batch-item.error i { color: var(--danger); }

/* ─── Batch Results ───────────────────────────────── */
.gce-batch-results { padding: 0 0 1.5rem; }
.gce-batch-result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.gce-batch-result-item { background: var(--bg-secondary); border-radius: var(--radius-md); overflow: hidden; text-align: center; }
.gce-batch-result-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.gce-batch-result-info { padding: 0.625rem; }
.gce-batch-result-info p { font-size: 0.75rem; color: var(--text-muted); margin: 0 0 0.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gce-batch-result-info a { display: block; padding: 0.4rem; background: var(--primary); color: white; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; text-decoration: none; text-align: center; transition: filter 0.2s; }
.gce-batch-result-info a:hover { filter: brightness(1.1); }

/* ─── Error ───────────────────────────────────────── */
.gce-error { display: none; margin: 0.75rem 1.5rem; padding: 1rem 1.25rem; background: var(--danger-light); border-radius: var(--radius-md); border: 1px solid rgba(230,78,78,0.2); }
.gce-error-content { display: flex; align-items: flex-start; gap: 0.75rem; color: var(--danger); }
.gce-error-content i { flex-shrink: 0; margin-top: 2px; }
.gce-error-msg { font-weight: 500; }
.gce-error-help { margin: 0.5rem 0 0; font-size: 0.875rem; color: var(--text-muted); }
.gce-error-help a { color: var(--primary); text-decoration: underline; }

/* ─── File Info Bar ───────────────────────────────── */
.gce-file-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; padding: 0.875rem 1.5rem; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.gce-file-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; color: var(--text); }
.gce-file-item i { color: var(--primary); }
.gce-fi-label { color: var(--text-muted); font-size: 0.78rem; }
.gce-file-item strong { color: var(--text); font-weight: 600; }
.gce-change-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.375rem 0.8rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--primary); font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.gce-change-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.gce-btn-startover { background: transparent; color: var(--text-muted); border: 1px solid var(--border); font-size: 0.82rem; padding: 0.55rem 0.875rem; }
.gce-btn-startover:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

/* ─── Editor Grid ─────────────────────────────────── */
.gce-editor-grid { display: grid; grid-template-columns: 1.2fr 1fr; }
.gce-preview-panel { padding: 1.5rem; border-right: 1px solid var(--border); }
.gce-controls-panel { padding: 1.5rem; }
.gce-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.gce-panel-header h3 { display: flex; align-items: center; gap: 0.6rem; font-size: 1rem; font-weight: 600; color: var(--text); margin: 0; }
.gce-panel-header h3 i { color: var(--primary); }

.gce-undo-row { display: flex; gap: 0.375rem; }

/* Preview toggle */
.gce-preview-toggle { display: flex; background: var(--bg-secondary); border-radius: var(--radius-full); padding: 3px; border: 1px solid var(--border); }
.gce-toggle-btn { padding: 0.275rem 0.7rem; border: none; background: transparent; color: var(--text-muted); font-size: 0.78rem; font-weight: 600; cursor: pointer; border-radius: var(--radius-full); transition: all 0.2s; }
.gce-toggle-btn.active { background: var(--primary); color: white; }
.gce-toggle-btn:hover:not(.active) { color: var(--text); }

/* ─── Preview Wrap ────────────────────────────────── */
.gce-preview-container { text-align: center; }
.gce-preview-wrap {
    display: inline-block;
    background-image: linear-gradient(45deg,var(--checker-light) 25%,transparent 25%), linear-gradient(-45deg,var(--checker-light) 25%,transparent 25%), linear-gradient(45deg,transparent 75%,var(--checker-light) 75%), linear-gradient(-45deg,transparent 75%,var(--checker-light) 75%);
    background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); max-width: 100%;
    position: relative;
}
.gce-gif-preview { display: block; max-width: 100%; max-height: 300px; }
canvas.gce-gif-preview { image-rendering: auto; }

/* ─── Compare overlay ─────────────────────────────── */
.gce-compare-wrap { position: relative; display: inline-block; cursor: col-resize; user-select: none; }
.gce-compare-canvas { display: block; max-width: 100%; max-height: 300px; }
.gce-compare-handle {
    position: absolute; top: 50%;
    transform: translate(-50%, -50%);
    left: 50%;
    width: 36px; height: 36px; background: white;
    border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    cursor: col-resize; z-index: 10; color: #555;
    transition: box-shadow 0.2s;
    pointer-events: none;
}
.gce-compare-handle:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
.gce-compare-lbl {
    position: absolute; top: 8px; background: rgba(0,0,0,0.55);
    color: white; font-size: 0.68rem; font-weight: 700;
    padding: 0.15rem 0.5rem; border-radius: var(--radius-sm);
    letter-spacing: 0.03em; pointer-events: none; z-index: 10;
}
.gce-compare-lbl-left  { left: 8px; }
.gce-compare-lbl-right { right: 8px; }

/* ─── Presets ─────────────────────────────────────── */
.gce-presets { margin-top: 1.25rem; background: var(--bg-secondary); border-radius: var(--radius-md); padding: 0.875rem; }
.gce-presets-header { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 0.75rem; }
.gce-presets-header span { display: flex; align-items: center; gap: 0.4rem; }
.gce-presets-header i { color: var(--primary); }
.gce-save-preset-btn { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.6rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--primary); font-size: 0.74rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.gce-save-preset-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

.gce-preset-group { margin-bottom: 0.7rem; }
.gce-preset-group:last-child { margin-bottom: 0; }
.gce-preset-group-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.4rem; }
.gce-preset-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.gce-preset-btn { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.6rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--text-secondary); font-size: 0.74rem; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.gce-preset-btn:hover, .gce-preset-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.gce-preset-btn i { width: 11px; height: 11px; }
.gce-preset-btn.saved { background: var(--bg-secondary); border-color: var(--border); color: var(--text); position: relative; padding-right: 1.5rem; }
.gce-preset-btn-del { position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 0; cursor: pointer; color: var(--text-muted); font-size: 0.65rem; line-height: 1; }
.gce-preset-btn-del:hover { color: var(--danger); }

/* ─── Controls ────────────────────────────────────── */
.gce-controls-scroll { max-height: 480px; overflow-y: auto; padding-right: 0.4rem; }
.gce-controls-scroll::-webkit-scrollbar { width: 5px; }
.gce-controls-scroll::-webkit-scrollbar-track { background: transparent; }
.gce-controls-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.gce-controls-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.gce-settings-grid { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; }
.gce-setting-group { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 0.6rem 0.8rem; min-width: 0; }
.gce-setting-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.375rem; }
.gce-setting-header label { display: flex; align-items: center; gap: 0.4rem; font-weight: 500; color: var(--text); font-size: 0.83rem; }
.gce-setting-header label i { color: var(--primary); width: 13px; height: 13px; }
.gce-setting-val { font-weight: 600; color: var(--primary); background: var(--bg-elevated); padding: 0.125rem 0.45rem; border-radius: var(--radius-sm); font-size: 0.78rem; min-width: 38px; text-align: center; }

.gce-slider { width: 100%; height: 5px; border-radius: var(--radius-full); background: var(--border); outline: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.gce-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%; background: var(--primary); cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
.gce-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.gce-slider::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--primary); cursor: pointer; border: none; }
.gce-slider-labels { display: flex; justify-content: space-between; margin-top: 0.2rem; font-size: 0.68rem; color: var(--text-muted); }
.gce-slider-hue { background: linear-gradient(to right, #ff0000,#ff8000,#ffff00,#80ff00,#00ff00,#00ff80,#00ffff,#0080ff,#0000ff,#8000ff,#ff00ff,#ff0080,#ff0000); }

/* Options section */
.gce-options-section { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.gce-options-header { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.82rem; color: var(--text); margin-bottom: 0.5rem; }
.gce-options-header i { color: var(--primary); width: 13px; height: 13px; }
.gce-options-grid { display: flex; flex-direction: column; gap: 0.45rem; }
.gce-opt-check { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem; padding: 0.6rem 0.8rem; background: var(--bg-secondary); border-radius: var(--radius-md); cursor: pointer; transition: background 0.2s; }
.gce-opt-check:hover { background: var(--bg-tertiary); }
.gce-opt-check input[type="checkbox"] { display: none !important; width: 0 !important; height: 0 !important; min-width: 0 !important; opacity: 0 !important; position: absolute !important; }
.gce-chk-custom { width: 18px !important; height: 18px !important; min-width: 18px !important; border: 2px solid var(--border) !important; border-radius: var(--radius-sm) !important; background: var(--bg-elevated) !important; display: flex !important; align-items: center !important; justify-content: center !important; flex-shrink: 0 !important; transition: all 0.2s !important; }
.gce-chk-custom::after { content: ''; width: 9px; height: 9px; background: var(--primary); border-radius: 2px; opacity: 0; transform: scale(0); transition: all 0.2s; }
.gce-opt-check input[type="checkbox"]:checked ~ .gce-chk-custom { border-color: var(--primary) !important; background: var(--primary-light) !important; }
.gce-opt-check input[type="checkbox"]:checked ~ .gce-chk-custom::after { opacity: 1; transform: scale(1); }
.gce-opt-label { display: flex; align-items: center; gap: 0.4rem; font-weight: 500; color: var(--text); font-size: 0.875rem; flex: 1; }
.gce-opt-label i { color: var(--primary); width: 13px; height: 13px; }
.gce-opt-desc { width: 100%; font-size: 0.72rem; color: var(--text-muted); padding-left: 28px; margin-top: -0.2rem; }
.gce-opt-select { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.6rem; padding: 0.7rem 0.8rem; background: var(--bg-secondary); border-radius: var(--radius-md); }
.gce-opt-select .gce-opt-label { width: 100%; }
.gce-opt-select select { flex: 1; padding: 0.45rem 0.7rem; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.83rem; cursor: pointer; outline: none; transition: border-color 0.2s; min-width: 0; }
.gce-opt-select select:focus { border-color: var(--primary); }
.gce-opt-select .gce-opt-desc { padding-left: 0; }

/* ─── Size estimate ───────────────────────────────── */
.gce-size-estimate {
    display: flex; align-items: center; gap: 0.5rem;
    margin-top: 0.875rem; padding: 0.6rem 0.875rem;
    background: var(--bg-secondary); border-radius: var(--radius-md);
    font-size: 0.82rem; color: var(--text-muted);
}
.gce-size-estimate i { color: var(--primary); flex-shrink: 0; }
.gce-size-estimate strong { color: var(--primary); font-weight: 600; }

/* ─── Action Bar ──────────────────────────────────── */
.gce-action-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.gce-action-left  { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-start; }
.gce-action-center { display: flex; justify-content: center; }
.gce-action-right { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; }

/* ─── Buttons ─────────────────────────────────────── */
.gce-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.8rem 1.6rem; border-radius: var(--radius-full); font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; border: none; }
.gce-btn i { width: 17px; height: 17px; }
.gce-btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.gce-btn-sm i { width: 13px; height: 13px; }
.gce-btn-icon { padding: 0.55rem; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted); border-radius: var(--radius-full); }
.gce-btn-icon:hover { background: var(--bg-tertiary); color: var(--text); }
.gce-btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }
.gce-btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-primary); }
.gce-btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-primary-hover); }
.gce-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.gce-btn-secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.gce-btn-secondary:hover { background: var(--bg-tertiary); }
.gce-btn-reset { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.gce-btn-reset:hover { background: var(--bg-tertiary); color: var(--text); }
.gce-btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.gce-btn-outline:hover { background: var(--primary); color: white; }
.gce-btn-success { background: var(--success); color: white; box-shadow: 0 4px 14px rgba(51,153,102,0.25); }
.gce-btn-success:hover { filter: brightness(1.1); transform: translateY(-2px); }

/* ─── Processing Overlay (stage spinner) ──────────── */
.gce-processing {
    position: fixed; inset: 0; background: rgba(0,0,0,0.65);
    backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9000;
}
.gce-processing-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem 2.25rem;
    min-width: 340px; max-width: 92vw;
    box-shadow: var(--shadow-xl);
    text-align: center;
}
.gce-proc-title {
    font-size: 1.05rem; font-weight: 700;
    color: var(--text); margin: 0 0 1.25rem;
}

/* Stage indicators */
.gce-stages {
    display: flex; align-items: center; justify-content: center;
    gap: 0; margin-bottom: 1.5rem;
}
.gce-stage {
    display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
}
.gce-stage-dot {
    width: 36px; height: 36px; border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); transition: all 0.3s;
    position: relative;
}
.gce-stage-dot i { width: 16px; height: 16px; }
.gce-stage-label { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; transition: color 0.3s; }
.gce-stage-connector {
    width: 40px; height: 2px;
    background: var(--border);
    flex-shrink: 0; margin-bottom: 1.2rem;
    transition: background 0.3s;
}

/* Active stage */
.gce-stage.active .gce-stage-dot {
    border-color: var(--primary); background: var(--primary-light); color: var(--primary);
    box-shadow: 0 0 0 4px rgba(51,153,204,0.15);
}
.gce-stage.active .gce-stage-label { color: var(--primary); }

/* Done stage */
.gce-stage.done .gce-stage-dot {
    border-color: var(--success); background: var(--success-light); color: var(--success);
}
.gce-stage.done .gce-stage-label { color: var(--success); }
.gce-stage.done + .gce-stage-connector { background: var(--success); }

/* Spinner ring on active dot */
.gce-stage.active .gce-stage-dot::after {
    content: '';
    position: absolute; inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    animation: gce-spin 0.9s linear infinite;
}

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

/* Progress bar */
.gce-progress-track {
    height: 8px; background: var(--bg-secondary);
    border-radius: var(--radius-full); overflow: hidden;
    margin-bottom: 0.5rem;
}
.gce-progress-bar {
    height: 100%; background: var(--primary);
    border-radius: var(--radius-full); width: 0%;
    transition: width 0.4s ease;
}
.gce-proc-pct {
    font-size: 1.1rem; font-weight: 700;
    color: var(--primary); margin: 0 0 0.3rem;
}
.gce-proc-sub {
    font-size: 0.83rem; color: var(--text-muted);
    margin: 0; min-height: 1.35em;
}

/* ─── Results ─────────────────────────────────────── */
.gce-results { padding: 2.5rem; text-align: center; }
.gce-results-header { margin-bottom: 2rem; }
.gce-success-icon { width: 64px; height: 64px; background: var(--success); border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; color: white; }
.gce-success-icon i { width: 32px; height: 32px; }
.gce-results-header h2 { font-size: 1.6rem; color: var(--text); margin: 0 0 0.375rem; }
.gce-results-header p { color: var(--text-muted); margin: 0; }
.gce-comparison { display: flex; align-items: center; justify-content: center; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; }
.gce-cmp-item { text-align: center; }
.gce-cmp-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.75rem; }
.gce-cmp-label.result { color: var(--primary); }
.gce-cmp-preview { width: 220px; height: 170px; display: flex; align-items: center; justify-content: center; background-image: linear-gradient(45deg,var(--checker-light) 25%,transparent 25%),linear-gradient(-45deg,var(--checker-light) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--checker-light) 75%),linear-gradient(-45deg,transparent 75%,var(--checker-light) 75%); background-size: 12px 12px; background-position: 0 0,0 6px,6px -6px,-6px 0; border-radius: var(--radius-md); border: 2px solid var(--border); overflow: hidden; }
.gce-cmp-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gce-cmp-stats { margin-top: 0.6rem; font-size: 0.82rem; color: var(--text-muted); }
.gce-cmp-stats.highlight { color: var(--primary); font-weight: 600; }
.gce-cmp-arrow { color: var(--text-muted); }
.gce-cmp-arrow i { width: 22px; height: 22px; }
.gce-results-actions { display: flex; justify-content: center; gap: 0.875rem; flex-wrap: nowrap; }
.gce-results-actions .gce-btn { padding: 0.8rem 1.3rem; }

/* ─── Related Tools ───────────────────────────────── */
.gce-related-tools { margin-bottom: 2rem; }
.gce-related-box {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.gce-related-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.gce-related-label i { color: var(--primary); }
.gce-related-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.gce-related-link { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 0.875rem; background: var(--bg-secondary); border-radius: var(--radius-full); color: var(--text); text-decoration: none; font-size: 0.875rem; transition: all var(--transition-speed); border: 1px solid transparent; }
.gce-related-link:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.gce-related-link i { width: 15px; height: 15px; }

/* ─── Info sections ───────────────────────────────── */
.gce-info-sections { margin-bottom: 2rem; }
.gce-info-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.gce-info-card h2 { display: flex; align-items: center; gap: 0.625rem; font-size: 1.2rem; font-weight: 700; color: var(--text); margin: 0 0 1.25rem; }
.gce-info-card h2 i { color: var(--primary); }
.gce-info-card p { color: var(--text-muted); line-height: 1.7; margin: 0 0 0.75rem; }
.gce-info-card p:last-child { margin-bottom: 0; }
.gce-info-card a { color: var(--primary); text-decoration: none; }
.gce-info-card a:hover { text-decoration: underline; }
.gce-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.gce-steps li { position: relative; padding-left: 3rem; margin-bottom: 1rem; counter-increment: step; color: var(--text-muted); line-height: 1.6; }
.gce-steps li:not(:last-child)::after { content: ''; position: absolute; left: calc(1rem - 1px); top: 2rem; bottom: 0; width: 2px; background: var(--border-light); }
.gce-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; background: var(--primary); color: white; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.85rem; z-index: 1; }
.gce-steps li:last-child { margin-bottom: 0; }
.gce-steps li a { color: var(--primary); text-decoration: none; }
.gce-steps li a:hover { text-decoration: underline; }
.gce-features-list { display: flex; flex-direction: column; gap: 0.875rem; }
.gce-feature-row { display: flex; align-items: flex-start; gap: 1rem; }
.gce-feat-tag { flex-shrink: 0; padding: 0.3rem 0.8rem; border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.gce-feat-tag.brightness { background: rgba(51,153,204,0.12); color: var(--tag-brightness); }
.gce-feat-tag.saturation { background: rgba(139,92,246,0.12); color: var(--tag-saturation); }
.gce-feat-tag.sharpness  { background: rgba(51,153,102,0.12); color: var(--tag-sharpness); }
.gce-feat-tag.denoise    { background: rgba(245,158,11,0.12);  color: var(--tag-denoise); }
.gce-feature-row p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.gce-feature-row a { color: var(--primary); text-decoration: none; }
.gce-feature-row a:hover { text-decoration: underline; }
.gce-features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.gce-feature-card { padding: 1.1rem; background: var(--bg-secondary); border-radius: var(--radius-md); border: 1px solid var(--border); }
.gce-feature-card i { color: var(--primary); display: block; margin-bottom: 0.6rem; }
.gce-feature-card h4 { margin: 0 0 0.3rem; font-size: 0.9rem; font-weight: 600; color: var(--text); }
.gce-feature-card p  { font-size: 0.82rem; margin: 0; line-height: 1.5; color: var(--text-muted); }
.gce-feature-card a { color: var(--primary); text-decoration: none; }

/* ─── FAQ (global handler via _footer.php) ────────── */
.faq-item { background: var(--bg-secondary); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 0.5rem; }
.faq-item .faq-question { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; background: none; border: none; cursor: pointer; font-size: 0.95rem; font-weight: 600; color: var(--text); text-align: left; transition: background var(--transition-speed); gap: 1rem; }
.faq-item .faq-question:hover { background: var(--bg-tertiary); }
.faq-item .faq-question i { color: var(--text-muted); flex-shrink: 0; transition: transform 0.3s; }
.faq-item.open .faq-question { color: var(--primary); }
.faq-item.open .faq-question i { transform: rotate(180deg); color: var(--primary); }
.faq-item .faq-answer { display: none; padding: 0 1.25rem 1rem; }
.faq-item.open .faq-answer { display: block; }
.faq-item .faq-answer p { font-size: 0.9rem; margin: 0; color: var(--text-muted); line-height: 1.6; }
.faq-item .faq-answer a { color: var(--primary); text-decoration: none; }
.faq-item .faq-answer a:hover { text-decoration: underline; }

/* ─── Toast ───────────────────────────────────────── */
.gce-toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--text); color: var(--bg-elevated);
    padding: 0.625rem 1.25rem; border-radius: var(--radius-full);
    font-size: 0.875rem; font-weight: 500; z-index: 9500;
    opacity: 0; transition: opacity 0.25s, transform 0.25s;
    pointer-events: none; white-space: nowrap;
}
.gce-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Animations ──────────────────────────────────── */
@keyframes gce-fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.gce-editor-section, .gce-results { animation: gce-fadein 0.35s ease; }

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 860px) {
    .gce-editor-grid { grid-template-columns: 1fr; }
    .gce-preview-panel { border-right: none; border-bottom: 1px solid var(--border); }
    .gce-controls-scroll { max-height: none; }
}
@media (max-width: 640px) {
    .gce-upload-section { padding: 1.5rem; }
    .gce-upload-area { padding: 2.5rem 1.25rem; }
    .gce-file-bar { gap: 0.75rem; padding: 0.75rem 1rem; }
    .gce-action-bar { padding: 1rem; grid-template-columns: auto 1fr auto; }
    .gce-action-center { display: none; }
    .gce-results-actions { flex-wrap: wrap; }
    .gce-results-actions .gce-btn { flex: 1; min-width: 120px; }
    .gce-cmp-preview { width: 150px; height: 120px; }
    .gce-info-card { padding: 1.25rem; }
    .gce-comparison { flex-direction: column; }
    .gce-cmp-arrow { transform: rotate(90deg); }
    .gce-processing-box { min-width: auto; }
    .gce-stages { gap: 0; }
    .gce-stage-connector { width: 24px; }
}

::selection { background: rgba(51,153,204,0.2); color: var(--text); }
[data-theme="dark"] ::selection { background: rgba(77,184,232,0.3); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ── ZIP download bar for batch results ──────────────────────────────────── */
.gce-zip-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}
.gce-zip-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    color: var(--text);
    flex: 1 1 auto;
    min-width: 0;
}
.gce-zip-info i { color: var(--primary); flex-shrink: 0; }
.gce-zip-info strong { color: var(--primary); font-weight: 700; }
.gce-zip-btn { flex-shrink: 0; }

@media (max-width: 540px) {
    .gce-zip-bar { flex-direction: column; align-items: stretch; text-align: center; }
    .gce-zip-info { justify-content: center; }
    .gce-zip-btn { width: 100%; justify-content: center; }
}

/* Spinning loader for ZIP-building state */
.gce-spin { animation: gce-spin 0.9s linear infinite; }
@keyframes gce-spin { to { transform: rotate(360deg); } }
