/* Palette, fonts, reset and the footer/cookie chrome all come from
   /themeV0.01.css, which every page loads first. */

:root[data-theme="dark"]        { --imgr-log-ink: #cfe3ff; }
:root { --imgr-log-ink: #1d1d1f; }

body {
    padding: 20px;
}

/* ---- nav strip ---- */
.nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.nav a {
    padding: 8px 16px;
    background: var(--panel);
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid var(--border);
    transition: all .15s ease;
}

.nav a:hover {
    background: var(--panel-light);
    color: var(--text);
}

.nav a.active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
}

    h1, h2, h3, h5 {
    margin-bottom: 6px;
    margin-top: 0;
    font-weight: 600;
    color: var(--text-strong);
}

    .container {
      max-width: 900px;
      margin: auto;
      padding: 24px 0 40px;
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 18px;
      margin-bottom: 20px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }

    .controls {
      margin-bottom: 10px;
    }

    input[type="file"] {
      background: var(--panel-light);
      padding: 6px;
      border-radius: 6px;
      border: 1px solid var(--border);
      color: var(--text);
    }

    #dropZone {
      border: 2px dashed var(--border);
      padding: 25px;
      margin-bottom: 15px;
      text-align: center;
      color: var(--text-dim);
      cursor: pointer;
      border-radius: 10px;
      background: var(--panel-light);
      transition: all 0.2s ease;
    }

    #dropZone.dragover {
      border-color: var(--accent);
      background: rgba(59,130,246,0.1);
      color: var(--accent-soft);
    }

    label {
      display: inline-block;
      margin-right: 15px;
      cursor: pointer;
      color: var(--text-dim);
    }

    input[type="radio"] {
      margin-right: 6px;
    }

  .section {
      margin-bottom: 20px;
      padding: 18px;
      background: var(--panel);
      border-radius: 12px;
      border: 1px solid var(--border);
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  }

    hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 15px 0;
    }

    input[type="range"] {
      width: 220px;
      accent-color: var(--accent);
    }

    select {
      background: var(--panel-light);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 6px;
      border-radius: 6px;
    }

    button {
      background: var(--accent);
      border: none;
      color: var(--on-accent);
      padding: 8px 16px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 500;
      transition: all 0.2s ease;
    }

    button:hover {
      background: var(--accent-soft);
    }

    button:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    #downloadBtn {
      margin-left: 10px;
    }

    #progressBarContainer {
      width: 100%;
      height: 10px;
      background: var(--bg-deep);
      border-radius: 6px;
      margin-top: 12px;
      overflow: hidden;
    }

    #progressBar {
        height: 100%;
        width: var(--progress-width, 0%);
        background: linear-gradient(90deg, var(--accent), var(--accent-soft));
        display: flex;
        align-items: center;
        justify-content: center;
        transition: width 0.2s;
    }

    #logBox {
      margin-top: 10px;
      width: 100%;
      height: 140px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      color: var(--imgr-log-ink);
      border-radius: 8px;
      padding: 10px;
      font-family: monospace;
      font-size: 12px;
    }

    .preview-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 12px;
      margin-top: 15px;
    }

    .preview-item {
      background: var(--panel);
      border: 1px solid var(--border);
      padding: 10px;
      border-radius: 10px;
      text-align: center;
      transition: transform 0.15s ease;
      word-break:break-all;
    }

    .preview-item:hover {
      transform: translateY(-3px);
    }

    img {
      max-width: 100%;
      border-radius: 6px;
      margin-bottom: 6px;
    }

    #fileInfo, #resPreview, #estimatedSize {
      color: var(--text-dim);
    }

    .stats {
      margin-top: 10px;
      display: flex;
      gap: 20px;
      flex-wrap: wrap;
    }
    .img-modal {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.85);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
    }

    .img-modal.hidden {
      display: none;
    }

    .img-modal img {
      max-width: 90%;
      max-height: 90%;
      border-radius: 8px;
    }

    #imgModalClose {
      position: absolute;
      top: 20px;
      right: 30px;
      font-size: 42px;
      color: #fff;   /* always on the dark modal scrim */
      cursor: pointer;
      font-weight: bold;
    }
.hint {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* FOOTER */
.footer {
    margin-top: 40px;
    padding: 20px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
    text-align: center;
}.footer {
    margin-top: 40px;
    padding: 24px 20px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
}
.msg-status {
    transition: color .15s ease;
}.file-input {
    margin-bottom: 18px;
}

.drop-zone {
    margin-bottom: 15px;
}

.file-info {
    margin-bottom: 20px;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.option-box {
    margin-top: 16px;
}

.is-hidden {
    display: none;
}.range-group {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 14px;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
}

.select-label {
    margin-right: 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.progress-container {
    margin-top: 18px;
}

.img-modal-close {
    line-height: 1;
}

.img-modal-image {
    display: block;
}

.section-spaced {
    margin-top: 30px;
}
.is-hidden {
    display: none !important;
}

.progress-reset {
    width: 0%;
}

.progress-complete {
    width: 100%;
}
.is-clickable {
    cursor: pointer;
}

    #compressBtn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity .2s ease;
    }

    #compressBtn.loading {
        pointer-events: none;
        opacity: 0.85;
    }

    /* spinner */
    #compressBtn.loading::after {
        content: "";
        width: 16px;
        height: 16px;
        border: 2px solid rgba(255,255,255,.35);
        border-top-color: var(--on-accent);
        border-radius: 50%;
        animation: compressSpin .7s linear infinite;
    }

    /* optional text dim */
    #compressBtn.loading span {
        opacity: 0.9;
    }

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

/* ---- Custom strategy / Custom preset: px resolution + typed quality ---- */
.range-label {
    min-width: 96px;
    color: var(--text-dim);
}

.num-input {
    width: 96px;
    background: var(--panel-light);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: 6px;
    font: inherit;
}

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

.num-input-sm {
    width: 70px;
}

.dim-sep,
.unit {
    color: var(--text-dim);
    font-size: 13px;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 0;
    font-size: 13px;
}

.inline-check input[type="checkbox"] {
    accent-color: var(--accent);
    margin: 0;
}

/* Keeps a box and its separator/unit on the same line when the row wraps. */
.field-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 560px) {
    .range-label {
        min-width: 100%;
    }

    .num-input {
        width: 76px;
    }

    input[type="range"] {
        width: 180px;
    }
}
