/* ============================================================
   ExamCrack AI - Branding settings page (Phase 4, Aug 2026)
   Two-column layout: logo + color forms (left), live sidebar
   preview (right). Mobile: stacks, preview collapses to a
   horizontal brand bar.
   ============================================================ */

.settings-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.settings-hint {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-3);
  margin: 0 0 14px;
}

.settings-note {
  font-size: 12px;
  color: var(--text-3);
  margin: 10px 0 0;
}

/* ---------- Logo ---------- */
.logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.logo-preview {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--overlay-3);
  border: 1px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-preview-fallback {
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #5e6ad2, #a78bfa);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.url-row {
  display: flex;
  gap: 8px;
}

.url-row .field-input {
  flex: 1;
  min-width: 0;
}

/* ---------- Color ---------- */
.swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, border-color 0.12s ease;
  /* Paint each preset from its data-color attribute (Kishan Aug 29:
     swatches rendered grey - the color was never applied anywhere). */
  background-color: var(--swatch-color, #4f46e5);
}

.swatch[data-color="#4f46e5"] { background-color: #4f46e5; }
.swatch[data-color="#0ea5e9"] { background-color: #0ea5e9; }
.swatch[data-color="#10b981"] { background-color: #10b981; }
.swatch[data-color="#f59e0b"] { background-color: #f59e0b; }
.swatch[data-color="#ef4444"] { background-color: #ef4444; }
.swatch[data-color="#ec4899"] { background-color: #ec4899; }
.swatch[data-color="#8b5cf6"] { background-color: #8b5cf6; }
.swatch[data-color="#0f172a"] { background-color: #0f172a; }

.swatch:hover { transform: scale(1.1); }
/* Selection ring: white gap + accent outer ring so it is visible on ANY
   swatch color (a solid accent border vanishes when the swatch itself
   matches the accent, e.g. red-on-red). */
.swatch.selected {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

/* White theme: panel is white so the inner ring stays white for the
   gap effect (Kishan Aug 29). */
body.light .swatch.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-well {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-3);
}

.color-well input[type="color"] {
  width: 46px;
  height: 46px;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  transform: scale(1.4);
}

.color-row .field-input {
  width: 130px;
  font-size: 13px;
}

/* ---------- Live preview ---------- */
/* Mocks the real admin sidebar. Now that the admin panel is white
   (body.light), the mock uses theme vars so it matches the actual
   sidebar (Kishan Aug 29). */
.preview-shell {
  display: flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  height: 300px;
}

.preview-sidebar {
  width: 38%;
  background: var(--panel);
  border-right: 1px solid var(--border-subtle);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.preview-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand, #4f46e5), var(--accent, #7170ff));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.preview-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-nav-item {
  height: 22px;
  border-radius: 5px;
  background: var(--overlay-3);
}

.preview-nav-item.active {
  background: var(--accent, #7170ff);
  opacity: 0.85;
}

.preview-main {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-heading {
  height: 14px;
  width: 45%;
  border-radius: 4px;
  background: var(--overlay-6);
}

.preview-card {
  flex: 1;
  border-radius: 8px;
  background: var(--overlay-3);
  border: 1px solid var(--border-subtle);
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .preview-shell { height: auto; flex-direction: column; }
  .preview-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .preview-main { min-height: 120px; }
  .url-row { flex-direction: column; }
}
