/* ==========================================================================
   PROMPTSPHERE — BASE STYLES
   Luxe discret · Crème & Or · Starlight + Babe Sans
   ========================================================================== */

/* ── Custom Fonts ─────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Starlight';
  src: url('Starlight.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Starlight';
  src: url('Starlight-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BabeSans';
  src: url('BabeSans.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  --cream:        #FDFCFA;
  --cream-dark:   #F8F6F3;
  --sand:         #F0EDE8;
  --sand-light:   #F5F3EF;
  --stone:        #8A8070;
  --stone-dark:   #6B6355;
  --charcoal:     #3A3731;
  --ink:          #2B2722;

  --gold:         #D4B896;
  --gold-light:   #E8DCC8;
  --gold-lighter: #F2EDE3;
  --gold-dark:    #C2A77D;
  --gold-deep:    #A8895E;

  --success:      #9FB89C;
  --error:        #D19B9B;

  --font-title:   'Starlight', Georgia, serif;
  --font-body:    'BabeSans', 'Montserrat', sans-serif;

  --text-xs:   0.70rem;
  --text-sm:   0.82rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.35rem;
  --text-2xl:  1.7rem;
  --text-3xl:  2.2rem;
  --text-4xl:  3rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   22px;
  --radius-2xl:  32px;
  --radius-full: 9999px;

  --shadow-xs:   0 1px 3px rgba(59,55,49,0.04);
  --shadow-sm:   0 2px 10px rgba(59,55,49,0.07);
  --shadow-md:   0 6px 20px rgba(59,55,49,0.10);
  --shadow-lg:   0 12px 36px rgba(59,55,49,0.12);
  --shadow-xl:   0 20px 56px rgba(59,55,49,0.14);
  --shadow-gold: 0 8px 28px rgba(194,167,125,0.22);

  --grad-gold:  linear-gradient(135deg, #F2EDE3 0%, #E8DCC8 50%, #D4B896 100%);
  --grad-cream: linear-gradient(160deg, #FDFCFA 0%, #F5F3EF 100%);
  --grad-warm:  linear-gradient(135deg, #F8F6F3 0%, #F0EDE8 100%);

  --ease-fast:   200ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-base:   350ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-slow:   550ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* iOS : empêche le zoom automatique au focus (font-size >= 16px requis) */
@media (max-width: 767px) {
  .form-input, .form-select, .form-textarea,
  .search-inner input, .filter-input, .filter-select,
  .tag-add-input {
    font-size: 16px !important;
  }
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--charcoal);
  background: var(--cream);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink);
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

a { color: var(--gold-dark); text-decoration: none; transition: color var(--ease-fast); }
a:hover { color: var(--gold-deep); }

::selection { background: var(--gold-light); color: var(--ink); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--sand-light); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: var(--radius-full); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  transition: all var(--ease-base);
  text-decoration: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.btn-primary {
  background: var(--charcoal);
  color: var(--cream);
  border-color: var(--charcoal);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--ink);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--grad-gold);
  color: var(--ink);
  border-color: transparent;
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover {
  box-shadow: 0 12px 36px rgba(194,167,125,0.30);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--cream);
  color: var(--stone-dark);
  border-color: var(--gold-light);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--sand-light);
  border-color: var(--gold);
  color: var(--charcoal);
}

.btn-ghost {
  background: transparent; color: var(--stone); border-color: transparent;
}
.btn-ghost:hover { background: var(--sand-light); color: var(--charcoal); }

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: rgba(209,155,155,0.35);
}
.btn-danger:hover { background: rgba(209,155,155,0.08); }

.btn-sm { padding: var(--space-2) var(--space-4); font-size: 0.65rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: var(--space-2);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--cream);
  border: 1px solid var(--gold-light);
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--charcoal);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  box-shadow: var(--shadow-xs);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,184,150,0.16);
}
.form-input::placeholder { color: var(--stone); opacity: 0.55; }
.form-textarea { resize: vertical; min-height: 160px; line-height: 1.8; }
.form-select {
  cursor: pointer;
  /* Supprime l'apparence native du navigateur */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Flèche custom or */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23C2A77D' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-group { margin-bottom: var(--space-5); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-8); right: var(--space-8);
  z-index: 9999;
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-left: 2px solid var(--gold-dark);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--charcoal);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg),
    inset 0 1px 0 rgba(255,255,255,0.9);
  transform: translateX(120%);
  transition: transform var(--ease-spring);
  pointer-events: none;
  letter-spacing: 0.02em;
}
.toast.show { transform: translateX(0); }
.toast.error { border-left-color: var(--error); }

/* ── Loader — tasse de café ───────────────────────────────────────────────── */
.loader {
  position: fixed; inset: 0;
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  z-index: 900;
  transition: opacity var(--ease-slow);
  flex-direction: column; gap: var(--space-8);
}
.loader.hidden { opacity: 0; pointer-events: none; }

.loader-text {
  font-family: var(--font-title);
  font-size: var(--text-lg);
  color: var(--gold-dark);
  letter-spacing: 0.08em;
}

/* La tasse */
.loader-cup {
  width: 48px;
  height: 40px;
  display: inline-block;
  position: relative;
  background: var(--gold-dark);
  border-radius: 15% 15% 35% 35%;
  margin-top: 30px;
}

/* L'anse */
.loader-cup::after {
  content: '';
  box-sizing: border-box;
  position: absolute;
  left: 45px;
  top: 8px;
  border: 4px solid var(--gold-dark);
  width: 16px;
  height: 20px;
  border-radius: 0 4px 4px 0;
}

/* La vapeur */
.loader-cup::before {
  content: '';
  position: absolute;
  width: 1px;
  height: 10px;
  color: var(--gold-dark);
  top: -15px;
  left: 11px;
  box-sizing: border-box;
  animation: steam 1s ease infinite;
}

@keyframes steam {
  0%   { box-shadow: 2px 0px rgba(194,167,125,0),   12px 0px rgba(194,167,125,0.3), 20px 0px rgba(194,167,125,0);   }
  50%  { box-shadow: 2px -5px rgba(194,167,125,0.5), 12px -3px rgba(194,167,125,0.5), 20px -2px rgba(194,167,125,0.6); }
  100% { box-shadow: 2px -8px rgba(194,167,125,0),   12px -5px rgba(194,167,125,0),   20px -5px rgba(194,167,125,0);   }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ── Modal overlay ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(43,39,34,0.40);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  z-index: 200;
  display: none; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--ease-base);
}
.modal-overlay.visible { display: flex; opacity: 1; }

.modal-panel {
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-top: 2px solid var(--gold);
  border-radius: var(--radius-2xl);
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--ease-spring);
  box-shadow:
    var(--shadow-xl),
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 0 0 1px rgba(212,184,150,0.08);
  overflow: hidden;
}
.modal-overlay.visible .modal-panel { transform: translateY(0) scale(1); }

/* ── Tag chips ────────────────────────────────────────────────────────────── */
.tag-chip {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 10px;
  background: var(--gold-lighter);
  border: 1px solid var(--gold-light);
  color: var(--stone-dark);
  border-radius: var(--radius-full);
  display: inline-flex; align-items: center; gap: 4px;
}
.tag-remove { cursor: pointer; color: var(--error); font-size: 12px; line-height: 1; }

/* ── Ornement or ──────────────────────────────────────────────────────────── */
.ornament {
  display: flex; align-items: center; gap: var(--space-4);
  font-family: var(--font-body);
  font-size: 0.6rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold);
}
.ornament::before, .ornament::after {
  content: '';
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}
