/* RETOQUE v2 — Obsidian Cyber-Precision (adaptado de Google Stitch) */

body {
  background-color: #090b0e;
  background-image:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(2, 102, 255, 0.12) 0%, transparent 80%),
    radial-gradient(circle 300px at 85% 20%, rgba(0, 242, 254, 0.05) 0%, transparent 70%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #e0e2ea;
  font-family: 'Inter', system-ui, sans-serif;
}

.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; user-select: none; }

.glass-card {
  background: rgba(15, 19, 24, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.glass-input {
  background: rgba(10, 15, 19, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.glass-input:focus-within {
  border-color: #00f2fe;
  box-shadow: 0 0 16px -2px rgba(0, 242, 254, 0.35);
}
.btn-glow-primary {
  background: linear-gradient(135deg, #0266ff 0%, #00f2fe 100%);
  box-shadow: 0 0 24px -4px rgba(0, 242, 254, 0.45);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.btn-glow-primary:hover:not(:disabled) { box-shadow: 0 0 32px 0 rgba(0, 242, 254, 0.6); }
.btn-glow-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-glow-primary:disabled { opacity: 0.55; cursor: wait; }
.tab-active-glow { box-shadow: 0 0 14px -2px rgba(0, 242, 254, 0.35); }

/* Sidebar / bottom nav */
.nav-btn {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.9rem; border-radius: 0.75rem;
  font-size: 14px; font-weight: 500; color: #b9cacb;
  border: 1px solid transparent; transition: all 0.18s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.nav-btn:hover { color: #e0e2ea; background: rgba(255,255,255,0.04); }
.nav-active {
  color: #00f2fe !important;
  background: rgba(0, 242, 254, 0.08) !important;
  border-color: rgba(0, 242, 254, 0.25) !important;
  box-shadow: 0 0 14px -4px rgba(0, 242, 254, 0.4);
}
.bnav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; color: #849495; transition: color 0.18s;
}
.bnav-active { color: #00f2fe !important; }

/* Provider cards */
.provider-card {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.9rem; border-radius: 0.9rem;
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.18s; cursor: pointer; width: 100%;
}
.provider-card:hover { border-color: rgba(0, 242, 254, 0.35); }
.provider-selected {
  border-color: #00f2fe !important;
  box-shadow: 0 0 20px -6px rgba(0, 242, 254, 0.55), inset 0 0 24px rgba(0, 242, 254, 0.05);
}
.pc-radio {
  width: 20px; height: 20px; border-radius: 9999px; flex-shrink: 0; margin-top: 2px;
  border: 2px solid rgba(255,255,255,0.25); transition: all 0.18s; position: relative;
}
.provider-selected .pc-radio { border-color: #00f2fe; background: rgba(0,242,254,0.2); }
.provider-selected .pc-radio::after {
  content: ''; position: absolute; inset: 4px; border-radius: 9999px; background: #00f2fe;
  box-shadow: 0 0 8px rgba(0,242,254,0.8);
}

/* Presets */
.preset-cats { scrollbar-width: thin; scrollbar-color: rgba(0,242,254,0.3) transparent; }
.preset-cats::-webkit-scrollbar { height: 6px; }
.preset-cats::-webkit-scrollbar-thumb { background: rgba(0,242,254,0.25); border-radius: 3px; }
.preset-cat-chip {
  flex-shrink: 0; padding: 0.45rem 0.9rem; border-radius: 9999px;
  font-size: 12px; font-weight: 600; color: #b9cacb;
  background: #161b22; border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.18s; white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.preset-cat-chip:hover { border-color: rgba(0,242,254,0.4); color: #e0e2ea; }
.preset-cat-chip.cat-active {
  color: #00f2fe; border-color: rgba(0,242,254,0.6);
  box-shadow: 0 0 12px -2px rgba(0,242,254,0.5);
}
.preset-card {
  text-align: left; padding: 0.7rem 0.8rem; border-radius: 0.8rem;
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: all 0.16s; cursor: pointer;
}
.preset-card:hover { border-color: rgba(0,242,254,0.5); transform: translateY(-1px); box-shadow: 0 4px 16px -4px rgba(0,242,254,0.35); }
.preset-card:active { transform: scale(0.98); }
.preset-card .pt { display: block; font-size: 12.5px; font-weight: 600; color: #e0e2ea; line-height: 1.3; font-family: 'Plus Jakarta Sans', sans-serif; }
.preset-card .pc { display: block; font-size: 10px; color: #849495; margin-top: 3px; font-family: 'JetBrains Mono', monospace; }

/* Dropzone */
#dropzone.dragover {
  border-color: #00f2fe !important;
  background: rgba(0, 242, 254, 0.06) !important;
  box-shadow: inset 0 0 32px rgba(0, 242, 254, 0.12);
}

/* Compare slider */
.compare-wrap { position: relative; touch-action: none; cursor: ew-resize; background: #000; }
.compare-img { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #000; pointer-events: none; }
.compare-orig { position: absolute; inset: 0; height: 100%; clip-path: inset(0 50% 0 0); }
.compare-line {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: #00f2fe; box-shadow: 0 0 12px rgba(0,242,254,0.6);
  pointer-events: none; transform: translateX(-1px);
}
.compare-handle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 9999px;
  background: rgba(9, 11, 14, 0.85); border: 2px solid #00f2fe;
  display: flex; align-items: center; justify-content: center;
  color: #00f2fe; box-shadow: 0 0 20px rgba(0,242,254,0.6);
  pointer-events: none;
}
.compare-handle .material-symbols-outlined { font-size: 18px; margin: 0 -6px; }
.compare-badge {
  position: absolute; top: 10px; font-size: 10px; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 9999px;
  background: rgba(9, 11, 14, 0.65); border: 1px solid rgba(255,255,255,0.14);
  color: #e0e2ea; font-family: 'JetBrains Mono', monospace; pointer-events: none;
}
.compare-badge.left { left: 10px; }
.compare-badge.right { right: 10px; color: #00f2fe; border-color: rgba(0,242,254,0.4); }

/* Loading shimmer */
.shimmer-bar {
  height: 8px; border-radius: 9999px; overflow: hidden; position: relative;
  background: rgba(255,255,255,0.06);
}
.shimmer-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,242,254,0.7), rgba(0,245,160,0.7), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* History / gallery */
.hist-card {
  border-radius: 0.9rem; overflow: hidden; cursor: pointer;
  background: rgba(22, 27, 34, 0.8); border: 1px solid rgba(255,255,255,0.07);
  transition: all 0.18s; position: relative;
}
.hist-card:hover { border-color: rgba(0,242,254,0.45); transform: translateY(-2px); box-shadow: 0 8px 24px -8px rgba(0,242,254,0.4); }
.hist-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.hist-meta { padding: 0.5rem 0.6rem; }
.hist-del {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px;
  border-radius: 0.6rem; display: flex; align-items: center; justify-content: center;
  background: rgba(9,11,14,0.75); border: 1px solid rgba(255,255,255,0.12);
  color: #ffb4ab; opacity: 0; transition: opacity 0.18s;
}
.hist-card:hover .hist-del { opacity: 1; }
.hist-del:hover { background: rgba(147,0,10,0.6); }
/* En táctil no hay hover: el borrado siempre visible */
@media (hover: none) {
  .hist-del { opacity: 1; }
}
/* Selección múltiple */
.sel-toggle-btn {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; white-space: nowrap;
  color: #00f2fe; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(0,242,254,0.35); background: rgba(0,242,254,0.08);
  transition: all 0.18s;
}
.sel-toggle-btn.active { background: rgba(0,242,254,0.25); }
.sel-check {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px;
  border-radius: 9999px; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); border: 2px solid rgba(255,255,255,0.5); color: transparent;
  transition: all 0.15s; pointer-events: none;
}
.sel-check.on { background: #00f2fe; border-color: #00f2fe; color: #002022; }
.hist-card.selected { outline: 2px solid #00f2fe; outline-offset: -2px; }
.sel-bar {
  position: sticky; bottom: 12px; z-index: 20;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: 100%;
  margin-top: 12px; padding: 10px 12px; border-radius: 14px;
  background: rgba(10,14,20,0.94); border: 1px solid rgba(0,242,254,0.35);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5); backdrop-filter: blur(12px);
}
.sel-bar > * { min-width: 0; }
.sel-bar-btn {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; white-space: nowrap;
  flex-shrink: 0;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15); color: #e8eef2; background: transparent;
}
.sel-bar-btn.danger { border-color: rgba(255,84,73,0.5); color: #ff5449; background: rgba(255,84,73,0.10); }
#hist-selcount, #gal-selcount { margin-right: auto; }
@media (max-width: 480px) {
  #hist-selcount, #gal-selcount { flex: 1 1 100%; margin-right: 0; margin-bottom: 2px; }
  .sel-bar .sel-bar-btn { flex: 1 1 40%; text-align: center; }
}

/* Auth message */
#auth-error.err {
  background: rgba(147,0,10,0.35); border: 1px solid rgba(255,180,171,0.35); color: #ffb4ab;
}
#auth-error.ok {
  background: rgba(0,110,69,0.25); border: 1px solid rgba(22,249,164,0.35); color: #16f9a4;
}

/* Storage widget */
.storage-bar {
  height: 8px; border-radius: 9999px; background: rgba(255,255,255,0.08);
  overflow: hidden; margin: 0.6rem 0;
}
.storage-fill {
  height: 100%; border-radius: 9999px;
  background: linear-gradient(90deg, #0266ff 0%, #00f2fe 60%, #00f5a0 100%);
  box-shadow: 0 0 12px rgba(0,242,254,0.5);
  transition: width 0.6s ease;
}
.backup-btn {
  display: flex; align-items: center; gap: 0.8rem; width: 100%;
  padding: 0.9rem 1rem; border-radius: 0.9rem; text-decoration: none;
  background: rgba(22, 27, 34, 0.8); border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.18s;
}
.backup-btn:hover { border-color: rgba(0,242,254,0.45); box-shadow: 0 0 16px -4px rgba(0,242,254,0.4); }

/* Admin switch */
.admin-switch {
  width: 42px; height: 24px; border-radius: 9999px; flex-shrink: 0;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.14);
  position: relative; transition: all 0.2s; cursor: pointer;
}
.admin-switch .knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 9999px; background: #849495; transition: all 0.2s;
}
.admin-switch[data-on="true"] { background: rgba(0,242,254,0.22); border-color: rgba(0,242,254,0.6); }
.admin-switch[data-on="true"] .knob { left: 20px; background: #00f2fe; box-shadow: 0 0 8px rgba(0,242,254,0.8); }
.admin-switch:disabled { opacity: 0.5; cursor: wait; }
.user-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  color: #849495; border: 1px solid transparent; transition: all 0.18s;
}
.user-del:hover { color: #ff5449; background: rgba(255,84,73,0.10); border-color: rgba(255,84,73,0.35); }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,242,254,0.3); }

input[type="search"]::-webkit-search-cancel-button { filter: invert(0.6); }
