/* ============================================================
   GAZE — Character Browser Design System
   Space Grotesk (display) + Inter (body)
   Deep dark, violet-indigo accent palette
   ============================================================ */

/* --- Variables ------------------------------------------------ */
:root {
  /* Backgrounds */
  --bg-base:      #07070f;
  --bg-card:      #0c0c1c;
  --bg-raised:    #111128;
  --bg-input:     #09091a;

  /* Accent — violet */
  --accent:       #8b7eff;
  --accent-dim:   #6c5ce7;
  --accent-bright:#b0a8ff;
  --accent-glow:  rgba(139, 126, 255, 0.14);
  --accent-glow-strong: rgba(139, 126, 255, 0.32);

  /* Borders */
  --border:       #16163a;
  --border-light: #21214a;
  --border-focus: #5548c8;

  /* Text */
  --text:         #e8e8f5;
  --text-muted:   #6a6a9a;
  --text-dim:     #35356a;

  /* Status */
  --success:      #34d399;
  --danger:       #f87171;
  --warning:      #fbbf24;
  --info:         #60c8ff;

  /* Shape */
  --radius:       12px;
  --radius-sm:    8px;

  /* Fonts */
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
}

/* --- Base ----------------------------------------------------- */
body {
  background-color: var(--bg-base);
  /* Subtle radial accent glow — premium depth effect */
  background-image:
    radial-gradient(ellipse at 18% 0%, rgba(139, 126, 255, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 82% 100%, rgba(192, 132, 252, 0.05) 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { color: #c4b5fd; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
h5, h6 { color: var(--text); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  background: rgba(7, 7, 15, 0.97) !important;
  backdrop-filter: blur(24px) saturate(1.3);
  border-bottom: 1px solid var(--border) !important;
  padding: 0.5rem 0;
}

.navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #c084fc 0%, #8b7eff 45%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.navbar-brand:hover {
  background: linear-gradient(135deg, #d8b4fe 0%, #b0a8ff 45%, #93c5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.navbar-logo {
  height: 26px;
  width: auto;
}

/* Nav links — borderless, subtle hover */
.navbar .btn-outline-light {
  border: none;
  color: var(--text-muted) !important;
  background: transparent;
  font-size: 0.79rem;
  font-weight: 500;
  padding: 0.28rem 0.58rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}
.navbar .btn-outline-light:hover,
.navbar .btn-outline-light:focus {
  color: var(--text) !important;
  background: rgba(139, 126, 255, 0.08);
  box-shadow: none;
}

.navbar .btn-outline-light[href="/generator"],
.navbar .btn-outline-light[href="/gallery"] {
  color: var(--accent-bright) !important;
}
.navbar .btn-outline-light[href="/generator"]:hover,
.navbar .btn-outline-light[href="/gallery"]:hover {
  background: var(--accent-glow);
  color: #c4b5fd !important;
}

.navbar .btn-outline-success {
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--success) !important;
  font-size: 0.79rem;
  font-weight: 500;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.navbar .btn-outline-success:hover {
  background: rgba(52, 211, 153, 0.1);
  border-color: var(--success);
  box-shadow: none;
  color: var(--success) !important;
}

.navbar .vr {
  background-color: var(--border-light);
  opacity: 1;
}

/* Queue button */
.queue-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 0.2rem 0.48rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}
.queue-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.queue-btn-active { color: var(--accent-bright) !important; }

/* Queue button generating animation */
.queue-btn-generating .queue-icon {
  animation: queue-pulse 1.5s ease-in-out infinite;
}

@keyframes queue-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
}

.queue-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}
.queue-icon { font-size: 0.88rem; }

/* Queue status dots */
.queue-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.queue-status-pending    { background: var(--text-muted); }
.queue-status-processing { background: var(--warning); animation: pulse 1s infinite; }
.queue-status-paused     { background: var(--text-dim); }
.queue-status-done       { background: var(--success); }
.queue-status-failed     { background: var(--danger); }
.queue-status-removed    { background: var(--border-light); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.btn-xs {
  padding: 0.1rem 0.35rem;
  font-size: 0.7rem;
  border-radius: 4px;
  line-height: 1.4;
}

/* ============================================================
   Checkpoint Bar
   ============================================================ */
.default-checkpoint-bar {
  background:
    linear-gradient(to right,
      rgba(139, 126, 255, 0.04) 0%,
      transparent 25%,
      transparent 75%,
      rgba(139, 126, 255, 0.04) 100%);
  border-bottom: 1px solid var(--border) !important;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--text);
}

.card-header {
  background-color: var(--bg-raised) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
}

.card-header.bg-primary,
.card-header.bg-dark,
.card-header.bg-secondary,
.card-header.bg-success,
.card-header.bg-info {
  background-color: var(--bg-raised) !important;
}

.card-footer {
  background-color: var(--bg-raised) !important;
  border-top: 1px solid var(--border) !important;
  color: var(--text-muted);
}

.card-body { color: var(--text); }

/* ============================================================
   Gallery Cards (.character-card)
   ============================================================ */
.character-card {
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex !important;
  flex-direction: column;
}
.character-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 60px rgba(4, 4, 10, 0.7), 0 0 0 1px var(--accent);
  border-color: var(--accent) !important;
}

/* Gallery card image container — portrait 2:3 ratio */
.character-card .img-container {
  aspect-ratio: 2 / 3;
  height: auto;
  min-height: unset;
  flex-shrink: 0;
}

.character-card .img-container img {
  transition: transform 0.4s ease;
}
.character-card:hover .img-container img {
  transform: scale(1.07);
}

/* Subtle accent tint on hover via pseudo-overlay */
.character-card:hover .img-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 55%, rgba(108, 92, 231, 0.12) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Compact name strip */
.character-card .card-body {
  padding: 0.55rem 0.7rem 0.4rem;
  flex: 1;
}
.character-card .card-title {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.character-card .card-text {
  display: none; /* Hide verbose prompt text — cleaner gallery look */
}
.character-card .card-footer {
  padding: 0.28rem 0.7rem;
}
.character-card .card-footer small {
  font-size: 0.66rem;
  font-family: monospace;
  color: var(--text-dim) !important;
}

/* ============================================================
   Image container (detail pages and standalone use)
   ============================================================ */
.img-container {
  height: 300px;
  overflow: hidden;
  background-color: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
}
.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-container img.fallback-cover {
  opacity: 0.5;
  transition: opacity 0.2s;
}
.character-card:hover .img-container img.fallback-cover {
  opacity: 0.8;
}

/* Assignment badge — shows count of characters using this resource */
.assignment-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  line-height: 1;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.character-card:hover .assignment-badge {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(139, 126, 255, 0.5);
}

/* Generator result container */
#result-container {
  background-color: var(--bg-raised) !important;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ============================================================
   Forms
   ============================================================ */
.form-control,
.form-select {
  background-color: var(--bg-input) !important;
  border-color: var(--border-light) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 0.875rem;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 3px rgba(85, 72, 200, 0.22) !important;
  background-color: var(--bg-input) !important;
  color: var(--text) !important;
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:disabled,
.form-select:disabled {
  background-color: var(--bg-raised) !important;
  color: var(--text-muted) !important;
  opacity: 0.65;
}

.form-label { color: var(--text-muted); font-size: 0.8rem; font-weight: 500; margin-bottom: 0.3rem; }
.form-text  { color: var(--text-dim) !important; font-size: 0.77rem; }

.form-check-input {
  background-color: var(--bg-input);
  border-color: var(--border-light);
}
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(85, 72, 200, 0.22);
  border-color: var(--border-focus);
}
.form-check-label { color: var(--text); font-size: 0.875rem; }

option { background-color: var(--bg-raised); color: var(--text); }

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  border: 1px solid var(--accent-dim);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 126, 255, 0.22);
  color: #fff;
}

.btn-outline-primary {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.btn-outline-primary:hover,
.btn-outline-primary:active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-secondary {
  background-color: var(--bg-raised);
  border-color: var(--border-light);
  color: var(--text);
  font-weight: 500;
}
.btn-secondary:hover {
  background-color: #1c1c38;
  border-color: var(--border-light);
  color: var(--text);
}

.btn-outline-secondary {
  border-color: var(--border-light);
  color: var(--text-muted);
  font-weight: 500;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:active {
  background-color: var(--bg-raised);
  border-color: var(--border-light);
  color: var(--text);
}

/* Active resolution preset */
.btn-secondary.preset-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  border-color: var(--accent-dim);
  color: #fff;
}

.btn-outline-success { border-color: var(--success); color: var(--success); font-weight: 500; }
.btn-outline-success:hover { background-color: rgba(52,211,153,.1); border-color: var(--success); color: var(--success); }
.btn-success { background-color: #059669; border-color: #047857; color: #fff; font-weight: 500; }
.btn-success:hover { background-color: #047857; border-color: #065f46; color: #fff; }

.btn-outline-danger { border-color: var(--danger); color: var(--danger); font-weight: 500; }
.btn-outline-danger:hover { background-color: rgba(248,113,113,.1); border-color: var(--danger); color: var(--danger); }
.btn-danger { background-color: #dc2626; border-color: #b91c1c; color: #fff; font-weight: 500; }
.btn-danger:hover { background-color: #b91c1c; border-color: #991b1b; color: #fff; }

.btn-outline-warning { border-color: var(--warning); color: var(--warning); font-weight: 500; }
.btn-outline-warning:hover { background-color: rgba(251,191,36,.1); border-color: var(--warning); color: var(--warning); }

.btn-light, .btn-outline-light {
  background-color: rgba(255,255,255,.06);
  border-color: var(--border-light);
  color: var(--text);
  font-weight: 500;
}
.btn-light:hover, .btn-outline-light:hover {
  background-color: rgba(255,255,255,.1);
  color: var(--text);
}

.btn-close { filter: invert(1) brightness(0.7); }

/* ============================================================
   Accordion
   ============================================================ */
.accordion-item {
  background-color: var(--bg-card) !important;
  border-color: var(--border) !important;
}
.accordion-button {
  background-color: var(--bg-raised) !important;
  color: var(--text) !important;
  font-size: 0.875rem;
  font-weight: 500;
}
.accordion-button:not(.collapsed) {
  background-color: #181835 !important;
  color: var(--accent-bright) !important;
  box-shadow: inset 0 -1px 0 var(--border);
}
.accordion-button::after,
.accordion-button:not(.collapsed)::after {
  filter: invert(1) brightness(0.6);
}
.accordion-button:focus { box-shadow: none; }
.accordion-body { background-color: var(--bg-card); padding: 0.5rem; }

/* Mix & match list items */
.mix-item { user-select: none; border-radius: var(--radius-sm); }
.mix-item:hover { background-color: rgba(139, 126, 255, 0.1) !important; }
.mix-item .bg-light {
  background-color: var(--bg-raised) !important;
  color: var(--text-dim) !important;
}

/* ============================================================
   Progress Bars
   ============================================================ */
.progress {
  background-color: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.progress-bar {
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease-in-out;
}
.progress-bar.bg-success { background: var(--success) !important; }
.progress-bar.bg-info    { background: var(--info)    !important; }

/* ============================================================
   Badges
   ============================================================ */
.badge.bg-primary   { background-color: var(--accent)  !important; }
.badge.bg-secondary { background-color: #1b1b40        !important; color: var(--text-muted) !important; }
.badge.bg-info      { background-color: var(--info)    !important; color: #0c1a2b !important; }
.badge.bg-success   { background-color: var(--success) !important; color: #012218 !important; }
.badge.bg-danger    { background-color: var(--danger)  !important; }
.badge.bg-warning   { background-color: var(--warning) !important; color: #1a0f00 !important; }
.badge.bg-light     { background-color: var(--bg-raised) !important; color: var(--text-muted) !important; border-color: var(--border) !important; }

/* ============================================================
   Modals
   ============================================================ */
.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(139, 126, 255, 0.08);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-raised);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1.25rem;
}
.modal-footer {
  border-top: 1px solid var(--border);
  background-color: var(--bg-raised);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0.75rem 1.25rem;
}
.modal-title {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

/* ============================================================
   Alerts
   ============================================================ */
.alert-info {
  background-color: rgba(96, 200, 255, 0.08);
  border-color: rgba(96, 200, 255, 0.22);
  color: var(--info);
  border-radius: var(--radius-sm);
}
.alert-success {
  background-color: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.22);
  color: var(--success);
  border-radius: var(--radius-sm);
}
.alert-danger {
  background-color: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.22);
  color: var(--danger);
  border-radius: var(--radius-sm);
}

/* ============================================================
   Pagination
   ============================================================ */
.page-link {
  background-color: var(--bg-card);
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.page-link:hover {
  background-color: var(--bg-raised);
  border-color: var(--border-light);
  color: var(--text);
}
.page-item.active .page-link {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-item.disabled .page-link {
  background-color: var(--bg-card);
  border-color: var(--border);
  color: var(--text-dim);
}

/* ============================================================
   Text / Utility overrides
   ============================================================ */
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent-bright) !important; }
.border-bottom { border-color: var(--border) !important; }
.border-top    { border-color: var(--border) !important; }
.border        { border-color: var(--border) !important; }
hr             { border-color: var(--border); opacity: 1; }
small          { color: var(--text-muted); font-size: 0.8em; }
.font-monospace { color: var(--text); }
.spinner-border.text-secondary { color: var(--text-muted) !important; }

/* List group */
.list-group-item {
  background-color: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
.list-group-item:hover { background-color: var(--bg-raised); }
.list-group-flush .list-group-item {
  border-left: none;
  border-right: none;
}

/* ============================================================
   Gallery Page
   ============================================================ */
.gallery-card {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  background: var(--bg-raised);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.gallery-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 28px var(--accent-glow);
}
.gallery-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}
.gallery-card:hover img { transform: scale(1.04); }
.gallery-card .overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  padding: 32px 10px 10px;
  opacity: 0;
  transition: opacity 0.2s;
}
.gallery-card:hover .overlay { opacity: 1; }
.gallery-card .cat-badge {
  position: absolute; top: 6px; left: 6px;
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: .04em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
@media (min-width: 768px)  { .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
@media (min-width: 1200px) { .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }

/* Lightbox */
#lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.97); z-index: 9999;
  align-items: center; justify-content: center; flex-direction: column;
}
#lightbox.active { display: flex; }
#lightbox-img-wrap { position: relative; }
#lightbox-img {
  max-width: 90vw; max-height: 80vh; object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 80px rgba(139, 126, 255, 0.22);
  cursor: zoom-in; display: block;
}
#lightbox-meta  { color: #eee; margin-top: 12px; text-align: center; font-size: .85rem; }
#lightbox-hint  { color: rgba(255,255,255,.3); font-size: .75rem; margin-top: 4px; }
#lightbox-close { position: fixed; top: 16px; right: 20px; font-size: 2rem; color: #fff; cursor: pointer; z-index: 10000; line-height: 1; }
#lightbox-actions { position: fixed; bottom: 20px; right: 20px; z-index: 10000; display: flex; gap: 8px; }

/* Prompt modal metadata */
.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .85rem; }
.meta-grid .meta-label { color: var(--text-muted); white-space: nowrap; font-weight: 600; }
.meta-grid .meta-value { font-family: monospace; word-break: break-all; color: var(--text); }

.lora-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: 4px; padding: 2px 8px;
  font-size: .8rem; font-family: monospace; margin: 2px;
  color: var(--text);
}
.lora-chip .lora-strength { color: var(--accent-bright); }

/* ============================================================
   Service Status Indicators (navbar)
   ============================================================ */
.service-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: default;
  user-select: none;
  opacity: 0.8;
}
.service-status:hover { opacity: 1; }

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.4s ease;
}
.status-dot.status-ok       { background-color: #34d399; box-shadow: 0 0 5px rgba(52, 211, 153, 0.55); }
.status-dot.status-warning  { background-color: #fbbf24; box-shadow: 0 0 5px rgba(251, 191, 36, 0.55); }
.status-dot.status-error    { background-color: #f87171; box-shadow: 0 0 5px rgba(248, 113, 113, 0.55); }
.status-dot.status-checking { background-color: var(--border-light); animation: status-pulse 1.4s ease-in-out infinite; }

.status-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* ============================================================
   Misc
   ============================================================ */
.vr { opacity: 1; background-color: var(--border-light); }

.btn img { height: 1em; vertical-align: -0.125em; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-icon img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.d-contents { display: contents !important; }

.badge.rounded-pill { font-weight: 400; }

textarea[readonly] {
  background-color: var(--bg-raised) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  resize: vertical;
}

/* ============================================================
   Gallery Navigation Modal
   ============================================================ */
#galleryModal .modal-content {
  background: transparent;
  border: none;
  box-shadow: none;
}

#galleryModal .modal-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
}

#galleryImage {
  max-height: 90vh;
  max-width: 90vw;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

#gallery-prev, #gallery-next {
  font-size: 2rem;
  line-height: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#gallery-prev:hover, #gallery-next:hover {
  opacity: 1 !important;
  transform: translateY(-50%) scale(1.1);
}

#gallery-counter {
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

.hover-opacity-100:hover {
  opacity: 1 !important;
}

/* ============================================================
   GAZE Gallery Enhancement System
   ============================================================ */

/* --- View Mode Selector ------------------------------------- */
.gallery-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.gallery-view-modes {
  display: flex;
  gap: 0.5rem;
}

.gallery-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-view-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.gallery-view-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-bright);
}

.gallery-view-btn svg {
  width: 16px;
  height: 16px;
}

.gallery-slideshow-dropdown {
  position: relative;
}

.gallery-slideshow-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-slideshow-btn:hover {
  box-shadow: 0 4px 12px var(--accent-glow-strong);
  transform: translateY(-1px);
}

.gallery-slideshow-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: none;
}

.gallery-slideshow-menu.open {
  display: block;
}

.gallery-slideshow-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease;
}

.gallery-slideshow-menu-item:hover {
  background: var(--accent-glow);
}

.gallery-slideshow-menu-item:first-child {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.gallery-slideshow-menu-item:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* --- Layout Variants ---------------------------------------- */
.layout-masonry .gallery-card {
  break-inside: avoid;
  margin-bottom: 12px;
}

.layout-justified .gallery-card img,
.layout-collage .gallery-card img {
  aspect-ratio: auto;
  height: 100%;
}

.layout-collage .gallery-card {
  overflow: hidden;
}

.layout-collage .gallery-card:hover {
  z-index: 10;
  transform: scale(1.02);
}

/* --- Enhanced Viewer ---------------------------------------- */
.gaze-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.gaze-viewer.open {
  display: flex;
}

.gaze-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.97);
  backdrop-filter: blur(10px);
}

.gaze-viewer-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gaze-viewer-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 80px 120px;
}

.gaze-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transition: transform 0.3s ease;
  cursor: grab;
  user-select: none;
}

.gaze-viewer-img:active {
  cursor: grabbing;
}

.gaze-viewer-img:active {
  cursor: grabbing;
}

/* --- Viewer Navigation -------------------------------------- */
.gaze-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 100;
}

.gaze-viewer-nav:hover {
  background: rgba(139, 126, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.gaze-viewer-prev { left: 20px; }
.gaze-viewer-next { right: 20px; }

/* --- Viewer Toolbar ----------------------------------------- */
.gaze-viewer-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
  z-index: 100;
}

.gaze-viewer-toolbar-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gaze-viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gaze-viewer-btn:hover {
  background: rgba(139, 126, 255, 0.3);
}

.gaze-viewer-close {
  width: 44px;
  height: 44px;
}

.gaze-viewer-close:hover {
  background: rgba(248, 113, 113, 0.3);
}

.gaze-viewer-counter {
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-display);
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

.gaze-viewer-zoom-level {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  min-width: 3ch;
  text-align: center;
}

/* --- Info Panel --------------------------------------------- */
.gaze-viewer-info {
  position: absolute;
  right: 0;
  top: 80px;
  bottom: 100px;
  width: 300px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 90;
  overflow-y: auto;
}

.gaze-viewer-info.open {
  transform: translateX(0);
}

.viewer-info-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.viewer-info-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.viewer-info-category {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--accent-glow);
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-bright);
}

.viewer-info-slug {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gaze-viewer-info-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* --- Thumbnail Strip ---------------------------------------- */
.gaze-viewer-thumbs {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px 20px;
  z-index: 100;
}

.gaze-viewer-thumbs-track {
  display: flex;
  gap: 8px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.gaze-viewer-thumbs-track::-webkit-scrollbar {
  height: 4px;
}

.gaze-viewer-thumbs-track::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

.gaze-viewer-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.gaze-viewer-thumb:hover {
  opacity: 0.9;
}

.gaze-viewer-thumb.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.gaze-viewer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Slideshow Modes ---------------------------------------- */
.cinema-mode .gaze-viewer-stage {
  padding: 0;
}

.cinema-mode .gaze-viewer-img {
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
}

/* Ambient Glow */
.gaze-ambient-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  transition: background 1s ease;
}

/* Showcase Frame */
.showcase-mode .gaze-viewer-stage {
  background: var(--bg-raised);
}

.gaze-showcase-frame {
  position: absolute;
  inset: 40px;
  border: 20px solid var(--bg-card);
  box-shadow: 
    inset 0 0 60px rgba(0,0,0,0.3),
    0 20px 60px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* Ambient Particles */
.gaze-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.gaze-particle {
  position: absolute;
  border-radius: 50%;
  animation: float-particle linear infinite;
  filter: blur(1px);
}

@keyframes float-particle {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: var(--particle-opacity, 0.5);
  }
  90% {
    opacity: var(--particle-opacity, 0.5);
  }
  100% {
    transform: translateY(-10vh) translateX(20px);
    opacity: 0;
  }
}

/* Ken Burns Effect */
.gaze-viewer-img.ken-burns {
  animation: ken-burns 8s ease-in-out forwards;
}

@keyframes ken-burns {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-3%, -2%) scale(1.15);
  }
}

/* --- Transition Effects ------------------------------------- */
.transition-fade {
  animation: transition-fade 0.8s ease;
}

@keyframes transition-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.transition-slide {
  animation: transition-slide 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes transition-slide {
  from { 
    opacity: 0;
    transform: translateX(50px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

.transition-zoom {
  animation: transition-zoom 0.7s ease;
}

@keyframes transition-zoom {
  from { 
    opacity: 0;
    transform: scale(0.8);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

.transition-cube {
  transform-style: preserve-3d;
  perspective: 1000px;
  animation: transition-cube 0.8s ease;
}

@keyframes transition-cube {
  from { 
    transform: rotateY(-90deg);
    opacity: 0;
  }
  to { 
    transform: rotateY(0);
    opacity: 1;
  }
}

/* --- Comparison Mode ---------------------------------------- */
.gaze-comparison {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}

.gaze-comparison.open {
  display: flex;
}

.gaze-comparison-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.98);
}

.gaze-comparison-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gaze-comparison-images {
  flex: 1;
  position: relative;
  display: flex;
  overflow: hidden;
}

.gaze-compare-pane {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.gaze-compare-pane img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gaze-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: var(--accent);
  cursor: ew-resize;
  z-index: 10;
}

.gaze-compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.gaze-compare-handle::before,
.gaze-compare-handle::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.gaze-compare-handle::before {
  left: 6px;
  border-right: 6px solid white;
}

.gaze-compare-handle::after {
  right: 6px;
  border-left: 6px solid white;
}

.mode-split .gaze-compare-pane-a,
.mode-split .gaze-compare-pane-b {
  width: 50%;
}

.mode-onion .gaze-compare-pane-b {
  position: absolute;
  inset: 0;
  opacity: 0.5;
}

.gaze-comparison-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.gaze-comparison-modes {
  display: flex;
  gap: 0.5rem;
}

.gaze-compare-mode-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gaze-compare-mode-btn:hover,
.gaze-compare-mode-btn.active {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: var(--accent-glow);
}

.gaze-compare-close {
  padding: 0.5rem 1rem;
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gaze-compare-close:hover {
  background: rgba(248, 113, 113, 0.3);
}

/* Info View Metadata */
.gallery-card .info-meta {
  padding: 0.5rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- Mosaic Layout ------------------------------------------ */
.layout-mosaic {
  display: block;
  gap: 0;
  padding: 0;
}

.layout-mosaic .gallery-card {
  border-radius: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.layout-mosaic .gallery-card img {
  border-radius: 0;
  display: block;
}

.layout-mosaic .gallery-card .cat-badge,
.layout-mosaic .gallery-card .overlay,
.layout-mosaic .gallery-card .info-meta {
  display: none;
}

/* --- Responsive --------------------------------------------- */
@media (max-width: 768px) {
  .gaze-viewer-stage {
    padding: 60px 20px;
  }
  
  .gaze-viewer-nav {
    width: 40px;
    height: 40px;
  }
  
  .gaze-viewer-prev { left: 10px; }
  .gaze-viewer-next { right: 10px; }
  
  .gaze-viewer-info {
    width: 100%;
    top: auto;
    bottom: 80px;
    height: auto;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border);
    transform: translateY(100%);
  }
  
  .gaze-viewer-info.open {
    transform: translateY(0);
  }
  
  .gallery-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .gallery-view-modes {
    justify-content: center;
  }
  
  .gallery-slideshow-dropdown {
    align-self: center;
  }
}

/* --- Utility ------------------------------------------------ */
.gaze-hidden {
  display: none !important;
}

.gaze-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================
   Gallery Selection Mode
   ============================================================ */
.gallery-selection-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-card-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--border-light);
  border-radius: 4px;
  appearance: none;
  transition: all 0.2s ease;
}

.gallery-card-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.gallery-card-checkbox:checked::after {
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: bold;
  width: 100%;
  height: 100%;
}

.gallery-card-checkbox:hover {
  border-color: var(--accent);
}

.gallery-card.selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.gallery-grid.selection-mode .gallery-card {
  cursor: pointer;
}

.gallery-grid.selection-mode .gallery-card:hover {
  transform: translateY(-2px);
}

/* --- Tag Widgets (Prompt Builder) -------------------------------- */
.tag-widget-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 38px;
}

.tag-widget {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: var(--font-mono, 'SF Mono', monospace);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.tag-widget.active {
  background: var(--accent-dim);
  color: #fff;
  border-color: var(--accent);
}

.tag-widget.inactive {
  background: var(--bg-raised);
  color: var(--text-muted);
  border-color: var(--border);
  text-decoration: line-through;
  opacity: 0.6;
}

.tag-widget:hover {
  opacity: 1;
  border-color: var(--accent-bright);
}
