/* ============================================
   GIF to JPG Converter
   Light Mode Default + Dark Mode Support
   Theme: Blue (#3399cc)
   ============================================ */

/* CSS Variables - Light Mode */
:root {
    --transition-speed: 0.25s;

    --primary: #3399cc;
    --primary-light: #e0f4ff;
    --primary-dark: #2980b9;

    --success: #339966;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #e64e4e;
    --danger-light: #fee2e2;

    --bg: #f0f8ff;
    --bg-elevated: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;

    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --border: #cce5f0;
    --border-light: #e2e8f0;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --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: #f0f0f0;
    --checker-dark: #e0e0e0;
    --input-bg: #ffffff;
    --input-border: #cce5f0;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #5dade2;
    --primary-light: rgba(93, 173, 226, 0.15);
    --primary-dark: #3399cc;

    --success: #4ade80;
    --success-light: rgba(74, 222, 128, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);

    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-secondary: #334155;
    --bg-tertiary: #475569;

    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border: #334155;
    --border-light: #475569;

    --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);

    --checker-light: #334155;
    --checker-dark: #475569;
    --input-bg: #334155;
    --input-border: #475569;
}

* { box-sizing: border-box; }

/* =============================================
   KEY OVERRIDES FOR custom_styles.css
   ============================================= */

/* Prevent tool-main from clipping content (custom_styles sets overflow:hidden) */
.tool-main {
    overflow: visible !important;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    position: relative;
}

.tool-description {
    max-width: 800px !important;
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0 auto;
    line-height: 1.7;
}

.tool-description a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.tool-description a:hover { text-decoration: underline; }

/* Icon wrapper - single color, no gradient */
.tool-icon-wrapper {
    background: var(--primary) !important;
    box-shadow: var(--shadow-primary) !important;
    background-image: none !important;
}

/* Title - single color, no gradient */
.tool-title {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    background-clip: unset !important;
    color: var(--primary) !important;
}

/* =============================================
   UPLOAD SECTION
   ============================================= */
.upload-section { padding: 2.5rem; }

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--bg-secondary);
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-content { position: relative; z-index: 1; }

.upload-icon {
    color: var(--primary);
    margin-bottom: 1.25rem;
    transition: transform 0.25s ease;
}

.upload-area:hover .upload-icon { transform: translateY(-4px); }

.upload-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.4rem;
}

.upload-subtitle {
    color: var(--text-secondary);
    margin: 0 0 0.875rem;
    font-size: 0.95rem;
}

.file-types {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.875rem;
}

.file-type-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

.upload-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =============================================
   EDITOR SECTION
   ============================================= */
.editor-section { background: var(--bg-elevated); }

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.files-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.files-header-left i { color: var(--primary); }

.btn-text {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.btn-text:hover { background: var(--primary-light); }

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.875rem;
    padding: 1.25rem 1.75rem;
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid var(--border);
}

.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    position: relative;
    min-width: 0;
}

.file-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-preview {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    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: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    margin-bottom: 0.625rem;
}

.file-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-info { text-align: center; width: 100%; min-width: 0; }

.file-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

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

.file-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--danger-light);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0;
}

.file-item:hover .file-remove { opacity: 1; }
.file-remove:hover { background: var(--danger); color: white; }

/* =============================================
   SETTINGS PANEL
   ============================================= */
.settings-panel { padding: 1.75rem; }

.panel-header { margin-bottom: 1.25rem; }

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.panel-header h3 i { color: var(--primary); }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
    min-width: 0;
}

.settings-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-label i { color: var(--primary); }

.input-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.input-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 0.6rem;
    line-height: 1.5;
}

/* =============================================
   EXTRACTION OPTIONS
   ============================================= */
.extraction-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.extraction-option { cursor: pointer; }
.extraction-option input { display: none; }

.extraction-option .option-box {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.extraction-option .option-box i { color: var(--text-muted); flex-shrink: 0; }
.extraction-option .option-label { font-weight: 600; font-size: 0.875rem; color: var(--text); }
.extraction-option .option-desc { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }

.extraction-option:hover .option-box { border-color: var(--primary); }

.extraction-option input:checked + .option-box {
    background: var(--primary-light);
    border-color: var(--primary);
}

.extraction-option input:checked + .option-box i { color: var(--primary); }

/* Frame inputs */
.frame-input-section {
    margin-top: 0.875rem;
    padding: 0.875rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.frame-input-row, .range-input-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.range-separator { font-size: 0.875rem; color: var(--text-muted); font-weight: 500; }

.frame-input {
    width: 90px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.875rem;
    text-align: center;
}

.frame-input:focus { outline: none; border-color: var(--primary); }
.frame-hint { font-size: 0.78rem; color: var(--text-muted); }

/* Static info */
.static-info {
    display: flex;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    color: var(--primary);
}

.static-info i { flex-shrink: 0; margin-top: 2px; }
.static-info .info-text { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; }

/* =============================================
   QUALITY SECTION
   ============================================= */
.output-section { display: flex; flex-direction: column; gap: 1rem; }

.quality-slider-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 0.4rem;
}

.quality-slider {
    flex: 1;
    height: 6px;
    border-radius: var(--radius-full);
    background: linear-gradient(to right, var(--danger), var(--warning), var(--success));
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2.5px solid var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s;
}

.quality-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2.5px solid var(--primary);
    cursor: pointer;
}

.quality-value-display {
    min-width: 52px;
    padding: 0.4rem 0.625rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 700;
    text-align: center;
    font-size: 0.9rem;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.quality-presets {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.preset-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.preset-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover { border-color: var(--primary); color: var(--primary); }
.preset-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* =============================================
   BACKGROUND COLOR PICKER
   ============================================= */
.background-section { display: flex; flex-direction: column; gap: 0; }

.bg-color-options {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.bg-option {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.83rem;
}

/* Hide the actual radio input */
.bg-option input[type="radio"] { display: none; }

.bg-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.bg-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    display: inline-block;
}

.bg-swatch.white  { background: #ffffff; }
.bg-swatch.black  { background: #000000; }

.bg-label {
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.bg-option:has(input:checked) .bg-label { color: var(--primary); }

/* Native color input inside the "Custom" label */
.color-picker {
    width: 24px;
    height: 20px;
    padding: 1px;
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    background: none;
    vertical-align: middle;
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 2px; }
.color-picker::-moz-color-swatch { border: none; border-radius: 2px; }

/* GIF Info Card */
.gif-info-card {
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.gif-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.gif-info-row:last-child { border-bottom: none; }

.gif-info-row .info-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
}

.gif-info-row .info-label i { color: var(--primary); }
.gif-info-row .info-value { font-weight: 600; color: var(--text); }

/* Quality Info Box */
.quality-info {
    display: flex;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-md);
}

.quality-info .info-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.quality-info a { color: var(--primary); text-decoration: none; font-weight: 500; }
.quality-info a:hover { text-decoration: underline; }

/* =============================================
   ACTION BAR
   ============================================= */
.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 0.875rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
}

.btn i { flex-shrink: 0; }

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary-hover);
    color: white;
}

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

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

/* =============================================
   PROCESSING OVERLAY
   position: absolute keeps it scoped to tool-main
   ============================================= */
.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.93);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--radius-xl);
}

[data-theme="dark"] .processing-overlay {
    background: rgba(15, 23, 42, 0.93);
}

.processing-content { text-align: center; padding: 2rem; }

.processing-spinner-icon { animation: gtj-spin 0.9s linear infinite; }

@keyframes gtj-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.processing-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 1rem 0 0.4rem;
}

.processing-subtext {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 1.1rem;
}

.progress-bar-container {
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.5rem;
    width: 260px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: var(--radius-full);
}

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

/* =============================================
   RESULTS SECTION
   ============================================= */
.results-section {
    padding: 2.5rem;
    text-align: center;
    animation: gtj-fadeIn 0.35s ease;
}

.results-header { margin-bottom: 1.75rem; }

.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;
}

.results-header h2 {
    font-size: 1.6rem;
    color: var(--text);
    margin: 0 0 0.4rem;
}

.results-header p { color: var(--text-muted); margin: 0; }

/* Frame controls */
.frame-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.frame-control-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.frame-control-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.frame-selection-count { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }

/* Converted frames grid */
.converted-frames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.875rem;
    margin-bottom: 1.75rem;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.25rem;
    text-align: left;
}

.converted-frame-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.625rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.converted-frame-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.converted-frame-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.converted-frame-item.selected::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: var(--radius-full);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M6.5 11.5L3 8l1-1 2.5 2.5 5-5 1 1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.frame-preview {
    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: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    margin-bottom: 0.4rem;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.frame-preview img {
    max-width: 100%;
    max-height: 72px;
    object-fit: contain;
    display: block;
}

.frame-preview .frame-number {
    position: absolute;
    bottom: 2px;
    left: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 0 3px;
    border-radius: 2px;
}

.frame-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.frame-size {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.frame-download {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.28rem 0.6rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.frame-download:hover { background: var(--primary-dark); }

/* Results Stats */
.results-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.stat-item { text-align: center; }

.stat-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.stat-item.highlight .stat-value { color: var(--primary); }
.stat-arrow { color: var(--text-muted); }

.results-actions {
    display: flex;
    justify-content: center;
    gap: 0.875rem;
    flex-wrap: wrap;
}

/* =============================================
   ERROR MESSAGE
   ============================================= */
.error-message {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 1.25rem 1.75rem;
    padding: 0.875rem 1.1rem;
    background: var(--danger-light);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 0.9rem;
    text-align: left;
}

.error-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-contact {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-left: 1.5rem;
}

.error-contact a { color: var(--primary); text-decoration: none; font-weight: 500; }
.error-contact a:hover { text-decoration: underline; }

/* =============================================
   RELATED TOOLS
   ============================================= */
.related-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.875rem;
    padding: 1.1rem 1.375rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    margin-bottom: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.related-label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.related-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.875rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.related-link:hover { background: var(--primary); color: white; border-color: var(--primary); }
.related-link i { width: 14px; height: 14px; }

/* =============================================
   INFO SECTIONS (white cards with border)
   ============================================= */
.info-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: var(--bg-elevated) !important;
    border-radius: var(--radius-xl);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border) !important;
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.2rem;
    color: var(--text);
    margin: 0 0 1.25rem;
}

.info-card h2 i { color: var(--primary); flex-shrink: 0; }

/* Steps */
.steps-list {
    counter-reset: gtj-step;
    list-style: none;
    padding: 0;
    margin: 0;
}

.steps-list li {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1rem;
    counter-increment: gtj-step;
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: 0.95rem;
}

.steps-list li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(0.875rem - 1px);
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.steps-list li::before {
    content: counter(gtj-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.875rem;
    height: 1.875rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    z-index: 1;
}

.steps-list li:last-child { margin-bottom: 0; }
.steps-list li a { color: var(--primary); text-decoration: none; }
.steps-list li a:hover { text-decoration: underline; }

.steps-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    background: var(--warning-light);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.steps-tip i { color: var(--warning); flex-shrink: 0; margin-top: 2px; }
.steps-tip a { color: var(--warning); font-weight: 600; text-decoration: none; }
.steps-tip a:hover { text-decoration: underline; }

/* Format / Quality tags */
.format-explanations,
.quality-explanations {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.format-explain,
.quality-explain {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.format-tag,
.quality-tag {
    flex-shrink: 0;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    color: white;
}

.format-tag.gif  { background: #9b59b6; }
.format-tag.jpg  { background: var(--primary); }
.quality-tag.high   { background: var(--success); }
.quality-tag.good   { background: var(--primary); }
.quality-tag.medium { background: var(--warning); }
.quality-tag.low    { background: var(--danger); }

.format-explain p,
.quality-explain p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: 0.9rem;
}

.format-explain a,
.quality-explain a { color: var(--primary); text-decoration: none; }
.format-explain a:hover,
.quality-explain a:hover { text-decoration: underline; }

/* =============================================
   FAQ
   ============================================= */
.faq-list { display: flex; flex-direction: column; gap: 0.6rem; }

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.1rem;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    transition: all 0.2s;
}

.faq-question span { flex: 1; }
.faq-question:hover { background: var(--primary-light); color: var(--primary); }
.faq-question i { color: var(--primary); flex-shrink: 0; transition: transform 0.3s; }
.faq-item.open .faq-question i { transform: rotate(180deg); }

.faq-answer {
    display: none;
    padding: 0 1.1rem 0.875rem;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}

.faq-item.open .faq-answer { display: block; }

.faq-answer p {
    margin: 0.5rem 0 0;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.9rem;
}

.faq-answer a { color: var(--primary); text-decoration: none; }
.faq-answer a:hover { text-decoration: underline; }

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes gtj-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.editor-section,
.results-section { animation: gtj-fadeIn 0.35s ease; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 860px) {
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .tool-container { padding: 1rem; }
    .upload-section { padding: 1.75rem 1.25rem; }
    .settings-panel { padding: 1.25rem; }
    .results-section { padding: 1.75rem 1.25rem; }

    .action-bar { flex-direction: column; padding: 1.25rem; }
    .btn { width: 100%; }
    .results-actions { flex-direction: column; }
    .results-actions .btn { width: 100%; }
    .related-tools { flex-direction: column; }
    .results-stats { flex-direction: column; gap: 0.875rem; }
    .stat-arrow { transform: rotate(90deg); }
    .format-explain, .quality-explain { flex-direction: column; gap: 0.4rem; }
    .converted-frames-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
