/* =============================================
   COMPONENTS.CSS — Composants UI réutilisables
   ============================================= */

/* ---- SPLASH ---- */
.splash {
  position: fixed;
  inset: 0;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.splash-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--amber), var(--violet));
  box-shadow: 0 0 60px var(--violet-mid), 0 0 120px var(--violet-dim);
  animation: orb-pulse 2s ease-in-out infinite;
  margin-bottom: 8px;
}

.splash-logo {
  font-family: 'Playfair Display', serif;
  font-size: 38px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-1) 0%, var(--amber) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-sub {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ---- APP SHELL ---- */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.status-spacer {
  height: calc(var(--safe-top) + 8px);
}

/* ---- ROUTER ---- */
.router {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  min-height: 100dvh;
}

/* ---- BOTTOM NAV ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(8, 8, 16, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(123, 97, 255, 0.12);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  z-index: 200;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  color: var(--text-4);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
  position: relative;
}

.nav-item .nav-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.nav-item .nav-icon svg {
  width: 20px;
  height: 20px;
  transition: stroke 0.2s ease;
}

.nav-item.active {
  color: var(--violet);
}

.nav-item.active .nav-icon {
  background: var(--violet-dim);
  transform: translateY(-1px);
}

.nav-item.active .nav-icon svg {
  stroke: var(--violet);
}

/* ---- CARD ---- */
.card {
  background: var(--ink-3);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-pad {
  padding: var(--space-lg);
}

.card + .card {
  margin-top: var(--space-md);
}

/* ---- SECTION LABEL ---- */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--space-md);
  padding: 0 var(--space-md);
}

/* ---- BUTTON ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 24px;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn:active { transform: scale(0.97); opacity: 0.85; }

.btn-primary {
  background: var(--violet);
  color: white;
  box-shadow: 0 4px 20px var(--violet-dim);
  width: 100%;
}

.btn-primary:hover {
  box-shadow: 0 6px 28px var(--violet-mid);
}

.btn-ghost {
  background: var(--ink-4);
  color: var(--text-2);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-4);
  color: var(--text-1);
  border: 1px solid rgba(123,97,255,0.3);
  border-radius: var(--r-full);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 900;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), opacity 0.35s ease;
  box-shadow: var(--shadow-float);
  max-width: calc(100vw - 32px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: var(--ink-3);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1px solid rgba(255,255,255,0.07);
  border-bottom: none;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
  transform: translateY(0);
  animation: slide-up 0.3s cubic-bezier(.34,1.2,.64,1);
}

/* ---- PILL BADGE ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--r-full);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

.pill-violet {
  background: var(--violet-dim);
  color: var(--violet);
  border: 1px solid var(--violet-mid);
}

.pill-amber {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(255,179,71,0.3);
}

.pill-sage {
  background: var(--sage-dim);
  color: var(--sage);
  border: 1px solid rgba(78,205,196,0.3);
}

/* ---- PROGRESS RING (SVG) ---- */
.ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ring-label {
  position: absolute;
  text-align: center;
}

/* ---- DIVIDER ---- */
.divider {
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: var(--space-md) 0;
}

/* ---- SYNC STATUS ---- */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  padding: 0 var(--space-md);
  margin-bottom: var(--space-sm);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.sync-dot.syncing { animation: blink 1s ease infinite; }
.sync-dot.offline  { background: var(--danger); animation: none; }

/* ---- INPUT / TEXTAREA ---- */
.field-textarea {
  width: 100%;
  background: var(--ink-4);
  border: 1.5px solid rgba(255,255,255,0.06);
  border-radius: var(--r-md);
  padding: var(--space-md);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.65;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
  min-height: 140px;
}

.field-textarea::placeholder { color: var(--text-3); }
.field-textarea:focus { border-color: var(--violet-mid); }

.field-input {
  width: 100%;
  background: var(--ink-4);
  border: 1.5px solid rgba(255,255,255,0.06);
  border-radius: var(--r-md);
  padding: 12px var(--space-md);
  color: var(--text-1);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease;
}

.field-input:focus { border-color: var(--violet-mid); }
