/*
 * styles/components.css
 * Shared component styles used across multiple pages.
 * Buttons, badges, icon buttons, lang modal, overlay.
 * Import after base.css on every page.
 *
 * Component styles scoped to a root class per Tomás's standard.
 * No !important anywhere — if you need it, the architecture is wrong.
 */

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  gap:             7px;
  padding:         9px 18px;
  border-radius:   var(--radius-sm);
  font-family:     var(--font-body);
  font-size:       13px;
  font-weight:     500;
  cursor:          pointer;
  transition:      all var(--transition-micro);
  border:          none;
  text-decoration: none;
  white-space:     nowrap;
  /* All buttons: fit-content width, never fixed (DDR #004) */
  width:           fit-content;
}

.btn-ghost {
  background: transparent;
  border:     1px solid var(--border-strong);
  color:      var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface2);
  color:      var(--text-primary);
}

.btn-primary {
  background:  var(--accent);
  color:       white;
  box-shadow:  0 2px 8px rgba(232, 68, 26, 0.28);
}
.btn-primary:hover {
  background:  var(--accent-hover);
  transform:   translateY(-1px);
}

.btn-lg {
  padding:       14px 28px;
  font-size:     15px;
  border-radius: var(--radius);
}

.btn-xl {
  padding:       16px 32px;
  font-size:     16px;
  border-radius: var(--radius);
}

/* ── ICON BUTTONS ────────────────────────────────────────────── */
.icon-btn {
  width:           36px;
  height:          36px;
  border-radius:   var(--radius-sm);
  border:          1px solid var(--border-strong);
  background:      transparent;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           var(--text-secondary);
  font-size:       17px;
  transition:      all var(--transition-micro);
}
.icon-btn:hover {
  background: var(--surface2);
  color:      var(--text-primary);
}

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display:         inline-flex;
  align-items:     center;
  gap:             4px;
  padding:         3px 9px;
  border-radius:   6px;
  font-size:       11px;
  font-weight:     500;
  white-space:     nowrap;
}

.badge-accent {
  background: var(--accent-soft);
  color:      var(--accent);
  border:     1px solid var(--accent-soft2);
}

.badge-green {
  background: var(--green-soft);
  color:      var(--green);
  border:     1px solid var(--green-border);
}

.badge-amber {
  background: var(--amber-soft);
  color:      var(--amber);
  border:     1px solid var(--amber-border);
}

.badge-neutral {
  background: var(--surface2);
  color:      var(--text-secondary);
  border:     1px solid var(--border-strong);
}

/* ── OVERLAY (shared modal backdrop) ────────────────────────── */
.overlay {
  display:            none;
  position:           fixed;
  inset:              0;
  z-index:            200;
  background:         rgba(0, 0, 0, 0.45);
  backdrop-filter:    blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items:        center;
  justify-content:    center;
}
.overlay.open { display: flex; }

/* ── MODAL BASE ──────────────────────────────────────────────── */
.modal {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:       28px;
  width:         94%;
  max-width:     440px;
  box-shadow:    var(--shadow-lg);
  animation:     modalIn var(--transition-modal);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* ── LANG MODAL ──────────────────────────────────────────────── */
.lang-modal {
  max-width: 380px;
}

.lang-modal__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  margin-bottom:   20px;
}

.lang-modal__title {
  font-family:     var(--font-display);
  font-size:       20px;
  letter-spacing:  -0.5px;
  color:           var(--text-primary);
}

.lang-modal__close {
  background:      none;
  border:          1px solid var(--border-strong);
  border-radius:   var(--radius-sm);
  width:           32px;
  height:          32px;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           var(--text-tertiary);
  font-size:       16px;
  transition:      all var(--transition-micro);
}
.lang-modal__close:hover {
  background: var(--surface2);
  color:      var(--text-primary);
}

.lang-modal__list {
  display:         flex;
  flex-direction:  column;
  gap:             6px;
  margin-bottom:   20px;
}

.lang-modal__item {
  display:         flex;
  align-items:     center;
  gap:             14px;
  padding:         12px 14px;
  border-radius:   12px;
  cursor:          pointer;
  border:          1.5px solid transparent;
  transition:      all var(--transition-micro);
  background:      var(--surface2);
}
.lang-modal__item:hover {
  background:   var(--accent-soft);
  border-color: var(--accent-soft2);
}
.lang-modal__item.is-active {
  background:   var(--accent-soft);
  border-color: var(--accent);
}

.lang-modal__code {
  font-size:       11px;
  font-weight:     700;
  letter-spacing:  0.5px;
  color:           var(--accent);
  background:      var(--accent-soft);
  border:          1px solid var(--accent-soft2);
  border-radius:   6px;
  padding:         3px 7px;
  flex-shrink:     0;
  min-width:       32px;
  text-align:      center;
}

.lang-modal__labels {
  flex: 1;
}
.lang-modal__native {
  font-size:   15px;
  font-weight: 500;
  color:       var(--text-primary);
}
.lang-modal__english {
  font-size:   12px;
  color:       var(--text-tertiary);
  margin-top:  1px;
}

.lang-modal__check {
  color:      var(--accent);
  font-size:  18px;
  opacity:    0;
  transition: opacity var(--transition-micro);
}
.lang-modal__item.is-active .lang-modal__check { opacity: 1; }

/* Dark mode row inside lang modal */
.lang-modal__dark-row {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         14px;
  border-radius:   12px;
  background:      var(--surface2);
  border:          1px solid var(--border);
  margin-bottom:   16px;
}

.lang-modal__dark-label {
  font-size:   14px;
  font-weight: 500;
  color:       var(--text-primary);
  display:     flex;
  align-items: center;
  gap:         8px;
}

.dark-toggle {
  width:         44px;
  height:        24px;
  background:    var(--border-strong);
  border-radius: 100px;
  position:      relative;
  cursor:        pointer;
  border:        none;
  transition:    background 0.25s;
  flex-shrink:   0;
}
.dark-toggle.is-on { background: var(--accent); }
.dark-toggle::after {
  content:       '';
  position:      absolute;
  top:           3px;
  left:          3px;
  width:         18px;
  height:        18px;
  background:    white;
  border-radius: 50%;
  transition:    transform 0.25s;
  box-shadow:    0 1px 3px rgba(0, 0, 0, 0.25);
}
.dark-toggle.is-on::after { transform: translateX(20px); }

.lang-modal__done {
  width:         100%;
  padding:       12px;
  background:    var(--accent);
  color:         white;
  border:        none;
  border-radius: 10px;
  font-size:     14px;
  font-weight:   600;
  cursor:        pointer;
  font-family:   var(--font-body);
  transition:    background var(--transition-micro);
}
.lang-modal__done:hover { background: var(--accent-hover); }

/* ── SECTION SHARED STYLES ───────────────────────────────────── */
.section-eyebrow {
  display:         inline-flex;
  align-items:     center;
  gap:             7px;
  font-size:       12px;
  font-weight:     600;
  color:           var(--accent);
  text-transform:  uppercase;
  letter-spacing:  0.8px;
  margin-bottom:   14px;
}

/* ── UTILITY ─────────────────────────────────────────────────── */
/* Overflow safe text containers (DDR #004 — all text containers) */
.text-wrap {
  overflow-wrap: break-word;
  word-break:    break-word;
}
.overlay.show { display: flex; }

/* Inline icon — sized and non-shrinking */
.icon-inline { font-size: 18px; flex-shrink: 0; }

/* ── DECAY SYSTEM — shared visual classes ────────────────────
   Architecture decision: Jin-ho + Marta + Tom (v67).
   Single definition. Used by: city-pulse.html, audit-trail.html,
   business-profile.html, and any future surface with decay bars.
   Per-page redefinition is a code smell — do not do it.

   Yuki: GPU-composited opacity and transform only.
         width changes on .decay-fill are acceptable here because
         the fill is a progress-bar child, not in a scroll container,
         and the transition is 400ms on initial render only.
         The rAF loop sets width directly (no CSS transition) for smooth animation.
   Hana: accent color — coral means "this is alive right now."
         As the bar drains, the tourist understands: this information is aging. */

.decay-bar {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.decay-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  /* Initial render transition only — rAF loop bypasses this via direct style set */
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
