/* ===========================================================
   Advanced Image Resizer — styles
   All classes are namespaced with "ari-" and scoped under
   #ari-app so they won't clash with your website's theme.
   =========================================================== */

:root {
  --ari-bg-1: #06121a;
  --ari-bg-2: #0a2230;
  --ari-bg-3: #04141a;
  --ari-glass: rgba(255, 255, 255, 0.055);
  --ari-glass-2: rgba(255, 255, 255, 0.09);
  --ari-border: rgba(255, 255, 255, 0.12);
  --ari-text: #eaf6f4;
  --ari-muted: #9fb4b8;
  --ari-dim: #6f878c;
  --ari-emerald: #10b981;
  --ari-teal: #14b8a6;
  --ari-cyan: #06b6d4;
  --ari-grad: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --ari-radius: 16px;
  --ari-shadow: 0 22px 50px -22px rgba(0, 0, 0, 0.65);
  --ari-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ari-display: 'Space Grotesk', var(--ari-font);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

body {
  font-family: var(--ari-font);
  color: var(--ari-text);
  overflow: hidden; /* full-screen app — internal sections scroll instead */
  background:
    radial-gradient(1150px 780px at 84% -10%, rgba(16, 185, 129, 0.22), transparent 60%),
    radial-gradient(950px 720px at -6% 112%, rgba(6, 182, 212, 0.22), transparent 55%),
    linear-gradient(160deg, var(--ari-bg-1), var(--ari-bg-2) 52%, var(--ari-bg-3));
  background-attachment: fixed;
}

/* Full-screen app shell */
#ari-app {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: 1640px;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hidden { display: none !important; }

/* ---------- Header ---------- */
.ari-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.ari-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ari-logo {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--ari-grad);
  color: #fff;
  box-shadow: 0 12px 24px -10px rgba(6, 182, 212, 0.75);
}
.ari-logo svg { width: 24px; height: 24px; }
.ari-brand-text { min-width: 0; }
.ari-brand-text h1 {
  margin: 0;
  font-family: var(--ari-display);
  font-size: clamp(18px, 2.4vw, 25px);
  font-weight: 700;
  line-height: 1.1;
}
.ari-brand-text p { margin: 3px 0 0; color: var(--ari-muted); font-size: 13px; }
.ari-header-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.ari-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ari-text);
  background: var(--ari-glass);
  border: 1px solid var(--ari-border);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.ari-btn:hover { background: var(--ari-glass-2); transform: translateY(-1px); }
.ari-btn:active { transform: translateY(0); }
.ari-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.ari-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.ari-btn-primary {
  background: var(--ari-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 26px -12px rgba(6, 182, 212, 0.8);
}
.ari-btn-primary:hover { filter: brightness(1.08); background: var(--ari-grad); }
.ari-btn-ghost { background: transparent; }
.ari-btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.ari-btn:focus-visible { outline: 2px solid var(--ari-cyan); outline-offset: 2px; }

/* ---------- Controls ---------- */
.ari-controls { flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.ari-top-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: stretch; }

.ari-dropzone {
  flex: 1 1 340px;
  min-width: 280px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--ari-radius);
  padding: 16px 20px;
  background: var(--ari-glass);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.ari-dropzone:hover { border-color: var(--ari-emerald); background: var(--ari-glass-2); }
.ari-dropzone:focus-visible { outline: 2px solid var(--ari-cyan); outline-offset: 3px; }
#ari-app.ari-dragging .ari-dropzone {
  border-color: var(--ari-cyan);
  background: rgba(6, 182, 212, 0.12);
  transform: scale(1.005);
}
.ari-drop-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--ari-grad);
  color: #fff;
  box-shadow: 0 12px 22px -10px rgba(6, 182, 212, 0.75);
}
.ari-drop-icon svg { width: 22px; height: 22px; }
.ari-drop-text { min-width: 0; }
.ari-drop-text strong { color: #fff; }
.ari-drop-text .ari-link { color: var(--ari-cyan); text-decoration: underline; }
.ari-drop-text small { display: block; color: var(--ari-dim); font-size: 12px; margin-top: 3px; }

/* Settings panel */
.ari-settings {
  flex: 1 1 460px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: flex-start;
  background: var(--ari-glass);
  border: 1px solid var(--ari-border);
  border-radius: var(--ari-radius);
  padding: 12px 16px;
}
.ari-set-group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ari-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ari-dim);
  font-weight: 700;
}
.ari-set-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ari-field { display: flex; flex-direction: column; gap: 5px; }
.ari-field > label { font-size: 11.5px; color: var(--ari-muted); font-weight: 600; white-space: nowrap; }
.ari-field > label span { color: var(--ari-cyan); }
.ari-field input[type="number"],
.ari-field select {
  font-family: inherit;
  font-size: 14px;
  color: var(--ari-text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--ari-border);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
  width: 96px;
  transition: border-color 0.2s;
}
.ari-field select { width: auto; min-width: 120px; cursor: pointer; }
.ari-field input[type="number"]:focus,
.ari-field select:focus { border-color: var(--ari-cyan); }
.ari-field select option { color: #111; }
.ari-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 500 !important; color: var(--ari-text) !important; }
.ari-check input { width: 16px; height: 16px; accent-color: var(--ari-emerald); cursor: pointer; }

.ari-field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
  margin: 9px 0 2px;
}
.ari-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ari-cyan);
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.ari-field input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ari-cyan);
  border: 2px solid #fff;
  cursor: pointer;
}
.ari-color-wrap { display: flex; align-items: center; gap: 8px; }
.ari-color-wrap input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--ari-border);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.ari-color-hex { font-size: 12px; color: var(--ari-muted); font-family: monospace; }

.ari-hint { font-size: 11.5px; color: var(--ari-dim); min-height: 14px; max-width: 360px; }

/* Presets */
.ari-presets-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--ari-glass);
  border: 1px solid var(--ari-border);
  border-radius: var(--ari-radius);
  padding: 10px 14px;
}
.ari-presets-label { font-size: 12px; color: var(--ari-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.ari-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ari-chip {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ari-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ari-border);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, color 0.18s;
}
.ari-chip:hover { background: var(--ari-grad); border-color: transparent; color: #fff; transform: translateY(-1px); }
.ari-chip.active { background: var(--ari-grad); border-color: transparent; color: #fff; }

/* ---------- Results ---------- */
.ari-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--ari-glass);
  border: 1px solid var(--ari-border);
  border-radius: var(--ari-radius);
}
.ari-results::-webkit-scrollbar { width: 10px; }
.ari-results::-webkit-scrollbar-track { background: transparent; }
.ari-results::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 10px; }
.ari-results::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); }

.ari-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: rgba(8, 28, 36, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--ari-border);
  border-radius: 12px;
}
.ari-status { color: var(--ari-muted); font-size: 14px; font-weight: 500; }
.ari-sep { margin: 0 6px; color: var(--ari-dim); }
.ari-toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Grid + cards ---------- */
.ari-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.ari-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ari-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  animation: ari-pop 0.3s ease both;
}
.ari-card:hover {
  transform: translateY(-3px);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: var(--ari-shadow);
}
@keyframes ari-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.ari-card-thumb {
  position: relative;
  height: 150px;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.05) 75%),
    linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.05) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  background-color: #0e1a22;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ari-card-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.ari-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  color: #fff;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ari-card-badge.good { background: rgba(16, 185, 129, 0.92); }
.ari-card-badge.bad { background: rgba(245, 158, 11, 0.92); }
.ari-thumb-loading, .ari-thumb-error { display: grid; place-items: center; width: 100%; }
.ari-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--ari-cyan); animation: ari-spin 0.8s linear infinite; }
@keyframes ari-spin { to { transform: rotate(360deg); } }
.ari-thumb-error { font-size: 30px; color: rgba(239, 68, 68, 0.8); }

.ari-card-info { padding: 10px 12px 4px; }
.ari-card-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ari-card-row { font-size: 11.5px; color: var(--ari-muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.ari-card-row.muted { color: var(--ari-dim); }
.ari-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 5px;
}
.ari-tag.was { background: rgba(255, 255, 255, 0.1); color: var(--ari-dim); }
.ari-tag.now { background: rgba(16, 185, 129, 0.2); color: var(--ari-emerald); }
.ari-card-actions { display: flex; gap: 8px; padding: 8px 12px 12px; margin-top: auto; }
.ari-card-actions .ari-btn { flex: 1; justify-content: center; }

/* ---------- Empty state ---------- */
.ari-empty {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 24px;
  color: var(--ari-muted);
}
.ari-empty-art { font-size: 52px; }
.ari-empty h2 { color: var(--ari-text); font-family: var(--ari-display); margin: 14px 0 4px; font-size: 20px; }
.ari-empty p { max-width: 500px; margin: 0; font-size: 14px; line-height: 1.5; }
.ari-features {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.ari-features li {
  font-size: 12.5px;
  color: var(--ari-muted);
  background: var(--ari-glass);
  border: 1px solid var(--ari-border);
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---------- Progress ---------- */
.ari-progress-wrap { margin-bottom: 14px; }
.ari-progress-info { display: flex; justify-content: space-between; font-size: 13px; color: var(--ari-muted); margin-bottom: 7px; }
.ari-progress-bar { height: 9px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; overflow: hidden; }
.ari-progress-fill { height: 100%; width: 0; background: var(--ari-grad); border-radius: 10px; transition: width 0.25s ease; }

/* ---------- Footer ---------- */
.ari-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ari-dim);
  padding: 0 4px;
}

/* ---------- Lightbox ---------- */
.ari-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(4, 12, 16, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  z-index: 1000;
}
.ari-lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 12px; box-shadow: var(--ari-shadow); }
.ari-lb-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ari-glass);
  border: 1px solid var(--ari-border);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.ari-lb-close:hover { background: var(--ari-glass-2); transform: rotate(90deg); }
.ari-lb-meta { color: var(--ari-muted); font-size: 13px; text-align: center; }

/* ---------- Toast ---------- */
.ari-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: rgba(8, 28, 36, 0.96);
  border: 1px solid var(--ari-border);
  color: var(--ari-text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1100;
  box-shadow: var(--ari-shadow);
  max-width: 92vw;
  text-align: center;
}
.ari-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ari-toast.error { border-color: rgba(239, 68, 68, 0.6); }
.ari-toast.success { border-color: rgba(16, 185, 129, 0.6); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  #ari-app { padding: 12px; gap: 10px; }
  .ari-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .ari-settings { flex-basis: 100%; }
  .ari-dropzone { flex-basis: 100%; }
  .ari-brand-text p { display: none; }
}

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