/* ==========================================================================
   OptimizeGIF.com - Shared Tool UI Stylesheet
   Used by all tool pages (compress, enhance, upscale, url-downloader, ...)
   Builds on top of /css/style.css variables - inherits dark mode automatically.
   ========================================================================== */

/* ===== TOOL HERO ===== */
.tool-hero {
    padding: 48px 0 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.tool-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 50% at 50% -10%, rgba(var(--primary-rgb), 0.10) 0%, transparent 70%);
    pointer-events: none;
}
.tool-hero__inner { position: relative; }

.tool-hero__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
}
.tool-hero__icon i { width: 30px; height: 30px; color: #fff; }

.tool-hero__title {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 14px;
    line-height: 1.15;
}
.tool-hero__title em { font-style: normal; color: var(--primary); }

.tool-hero__desc {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.65;
}
.tool-hero__desc a { color: var(--primary); font-weight: 600; }

/* ===== TOOL APP ===== */
.tool-app {
    padding: 24px 0 48px;
}
.tool-app__inner {
    max-width: 920px;
    margin: 0 auto;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed var(--border-mid);
    border-radius: var(--radius-xl);
    padding: 56px 24px;
    text-align: center;
    background: var(--card-bg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    position: relative;
}
.upload-area:hover,
.upload-area.is-drag {
    border-color: var(--primary);
    background: var(--primary-xlight);
}
.upload-area__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: var(--primary-xlight);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-area__icon i { width: 32px; height: 32px; color: var(--primary); }
.upload-area__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.upload-area__subtitle {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.upload-area__badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.upload-area__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--primary-xlight);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 14px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-family: var(--font-mono);
}
.upload-area__hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-light);
    font-weight: 500;
}
.upload-area__hint i { width: 14px; height: 14px; }

/* ===== URL UPLOAD (optional second mode) ===== */
.upload-url {
    margin-top: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.upload-url__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}
.upload-url__label i { width: 16px; height: 16px; color: var(--primary); }
.upload-url__input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: border-color 0.15s;
}
.upload-url__input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== EDITOR / FILE LIST ===== */
.editor {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.editor__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--card-secondary);
}
.editor__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}
.editor__title i { width: 18px; height: 18px; color: var(--primary); }
.editor__actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.files-list { padding: 16px 20px; }
.file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}
.file-item:last-child { margin-bottom: 0; }
.file-item__thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}
.file-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-item__thumb i { width: 22px; height: 22px; color: var(--text-light); }
.file-item__info { flex: 1; min-width: 0; }
.file-item__name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-item__meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.file-item__remove {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 6px 8px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.file-item__remove:hover { color: var(--color-1); border-color: var(--color-1); }
.file-item__remove i { width: 14px; height: 14px; display: block; }

/* ===== SETTINGS PANEL ===== */
.settings {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-alt);
}
.settings__group { margin-bottom: 22px; }
.settings__group:last-child { margin-bottom: 0; }
.settings__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.settings__label i { width: 16px; height: 16px; color: var(--primary); }

/* Preset cards (no border-left!) */
.presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.preset {
    padding: 12px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    font-family: var(--font-body);
}
.preset:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.preset.is-active {
    border-color: var(--primary);
    background: var(--primary-xlight);
    box-shadow: 0 0 0 1px var(--primary);
}
.preset__name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.preset__desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Range / sliders */
.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.range-row__title {
    flex: 1 1 200px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.range-row__value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 56px;
    text-align: right;
}
.range-input {
    flex: 1 1 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 3px;
    background: var(--border-mid);
    outline: none;
}
.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb), 0.4);
}
.range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb), 0.4);
}

/* Select / inputs */
.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field__label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}
.field__input,
.field__select {
    padding: 9px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font-body);
    transition: border-color 0.15s;
}
.field__input:focus,
.field__select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Checkbox / toggle row */
.toggle-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}
.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: border-color 0.15s, background 0.15s;
}
.toggle:hover { border-color: var(--primary); }
.toggle input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.toggle.is-on {
    border-color: var(--primary);
    background: var(--primary-xlight);
    color: var(--primary);
}

/* ===== EDITOR FOOTER ===== */
.editor__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--card-secondary);
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s, color 0.15s, border-color 0.15s;
    font-family: var(--font-body);
    text-decoration: none;
}
.btn i { width: 16px; height: 16px; }
.btn--primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.35);
}
.btn--primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.45);
    color: #fff;
    text-decoration: none;
}
.btn--secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-mid);
}
.btn--secondary:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-xlight);
    text-decoration: none;
}
.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn--ghost:hover { color: var(--primary); text-decoration: none; }
.btn--danger {
    background: transparent;
    color: var(--color-1);
    border-color: rgba(230, 78, 78, 0.3);
}
.btn--danger:hover { background: rgba(230, 78, 78, 0.08); border-color: var(--color-1); text-decoration: none; }
.btn[disabled],
.btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== RESULTS ===== */
.results {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-top: 20px;
}
.results__header {
    text-align: center;
    margin-bottom: 22px;
}
.results__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--primary-xlight);
    display: flex;
    align-items: center;
    justify-content: center;
}
.results__icon i { width: 26px; height: 26px; color: var(--primary); }
.results__title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.results__subtitle { font-size: 0.92rem; color: var(--text-muted); }

.results__items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.result-card {
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.result-card__thumb {
    width: 100%;
    aspect-ratio: 16/10;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}
.result-card__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.result-card__name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.result-card__stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
}
.result-card__before { color: var(--text-muted); text-decoration: line-through; }
.result-card__after { color: var(--text-primary); font-weight: 700; }
.result-card__savings {
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 800;
}
.result-card__savings.is-neg { background: var(--color-1); }
.result-card__actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.result-card__actions .btn { flex: 1; justify-content: center; padding: 7px 10px; font-size: 0.78rem; }

.results__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ===== PROCESSING OVERLAY ===== */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 26, 18, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.processing-overlay__card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.processing-overlay__spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-overlay__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.processing-overlay__subtitle { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 14px; }
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-bar__fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}
.progress-text { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }

/* ===== INFO / CONTENT SECTIONS ===== */
.info-section { padding: 56px 0; }
.info-section--alt { background: var(--bg-alt); }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}
.info-card {
    padding: 22px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}
.info-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary-xlight);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.info-card__icon i { width: 20px; height: 20px; color: var(--primary); }
.info-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.info-card__text {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.info-card__text a { color: var(--primary); font-weight: 600; }

/* Related tools */
.related-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.related-tool {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.related-tool:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.10);
    text-decoration: none;
}
.related-tool__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary-xlight);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.related-tool__icon i { width: 18px; height: 18px; color: var(--primary); }
.related-tool__name { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.related-tool__desc { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }

/* ===== ERROR / ALERT (no border-left 4px) ===== */
.tool-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    margin: 14px 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.tool-alert--error { border-color: rgba(230, 78, 78, 0.4); background: rgba(230, 78, 78, 0.06); }
.tool-alert--warn  { border-color: rgba(245, 166, 35, 0.4); background: rgba(245, 166, 35, 0.06); }
.tool-alert--info  { border-color: rgba(51, 153, 204, 0.4); background: rgba(51, 153, 204, 0.06); }
.tool-alert__icon { flex-shrink: 0; padding-top: 1px; }
.tool-alert__icon i { width: 18px; height: 18px; }
.tool-alert--error .tool-alert__icon i { color: var(--color-1); }
.tool-alert--warn  .tool-alert__icon i { color: var(--accent-gold); }
.tool-alert--info  .tool-alert__icon i { color: var(--color-2); }
.tool-alert__title { font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.tool-alert a { color: var(--primary); font-weight: 700; }
.tool-alert--dismissible { padding-right: 38px; position: relative; }
.tool-alert__close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
}
.tool-alert__close i { width: 14px; height: 14px; }

/* ===== TOOL HEADING (within content) ===== */
.tool-section__heading {
    text-align: center;
    margin-bottom: 32px;
}
.tool-section__label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 8px;
    font-family: var(--font-mono);
}
.tool-section__title {
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.tool-section__subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 580px;
    margin: 0 auto;
}

/* Prose block for SEO content */
.prose {
    max-width: 760px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.75;
}
.prose h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 10px;
    letter-spacing: -0.2px;
}
.prose p { margin-bottom: 14px; }
.prose ul { margin: 0 0 14px 22px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--primary); font-weight: 600; }
.prose strong { color: var(--text-primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .tool-hero { padding: 32px 0 18px; }
    .upload-area { padding: 36px 16px; }
    .editor__header, .editor__footer { padding: 12px 14px; }
    .files-list, .settings { padding: 14px; }
    .info-section { padding: 40px 0; }
    .results { padding: 18px; }
}
