/* ─── BEA Enchères — CSS Mobile-first (fond clair, header/footer bleu nuit) ── */

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

:root {
  /* Fond clair (comme l'admin) + orange du logo BEA */
  --bg:          #F7F3EE;   /* fond clair crème */
  --surface:     #FFFFFF;   /* cartes */
  --surface2:    #EEE9E3;   /* panneaux secondaires */
  --border:      #D8D2CA;   /* bordures claires */
  --accent:      #ff8a1e;   /* orange logo - CTA, badges */
  --accent-light:#ff6b35;   /* hover (plus soutenu) */
  --green:       #16a34a;   /* succès / "vous gagnez" */
  --green-dim:   #15803d;
  --orange:      #ff8a1e;
  --text:        #1A1612;   /* texte foncé */
  --text-muted:  #6B6358;
  --text-dim:    #9A9188;
  --white:       #ffffff;
  /* Bleu nuit - header & footer uniquement */
  --night:       #13294a;
  --night-text:  #eef3fb;
  --night-muted: #9fb1cc;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 2px 12px rgba(0,0,0,.08);
}

/* iOS : empêche le zoom au focus sur les inputs */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari */
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;     /* empêche iOS de changer la taille de police */
  padding-bottom: 4rem;
  /* Scrolling fluide sur iOS */
  -webkit-overflow-scrolling: touch;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--night);
  border-bottom: 3px solid var(--accent);
  padding: .875rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.brand-logo {
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: .8rem;
  letter-spacing: .1em;
  padding: .25rem .55rem;
  border-radius: var(--radius-sm);
}

.brand-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--night-text);
}

/* ─── Timer ────────────────────────────────────────────────────────────────── */
.timer-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.timer-label {
  font-size: .65rem;
  color: var(--night-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.timer-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: .05em;
  line-height: 1;
}

.timer-value.timer-urgent {
  color: #f87171;
  animation: pulse 1s infinite;
}

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

/* ─── Status banner ────────────────────────────────────────────────────────── */
.status-banner {
  padding: .75rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  text-align: center;
}

.banner-blind {
  background: #FFF3E0;
  border-bottom: 2px solid #F97316;
  color: #C2410C;
}

.banner-ended {
  background: #F1F5F9;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.hidden { display: none !important; }

/* ─── Barre horaire ────────────────────────────────────────────────────────── */
.time-bar {
  background: var(--surface2);
  padding: .45rem 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-bottom: 1px solid var(--border);
}

.time-bar-label { font-size: .75rem; color: var(--text-muted); }
.time-bar-value {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ─── Main ─────────────────────────────────────────────────────────────────── */
.app-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ─── Sections ─────────────────────────────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* ─── Labels & inputs ──────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
}

.field-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  /* 16px minimum pour éviter le zoom automatique sur iOS Safari */
  padding: .75rem .9rem;
  font-size: max(1rem, 16px);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
  /* Supprime le fond jaune autocomplete sur Chrome/Android */
  -webkit-autofill-style: none;
}

.field-input::placeholder { color: var(--text-dim); }

/* Supprime le fond jaune autocomplete (Chrome, Android) */
.field-input:-webkit-autofill,
.field-input:-webkit-autofill:hover,
.field-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  -webkit-text-fill-color: var(--text);
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,138,30,.18);
  background: #fff;
}

.field-input--large {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.input-row {
  display: flex;
  gap: .5rem;
}

.input-row .field-input { flex: 1; }

.input-euro {
  position: relative;
}

.input-euro .field-input {
  padding-right: 2.5rem;
}

.euro-sign {
  position: absolute;
  right: .875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 700;
  pointer-events: none;
}

/* ─── Carte œuvre ──────────────────────────────────────────────────────────── */
.artwork-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.artwork-img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--surface2);
  display: block;
}

.artwork-meta {
  padding: 1rem;
}

.artwork-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .2rem;
  font-style: italic;
}

.artwork-author {
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .25rem;
}

.artwork-tech {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ─── Grille de prix ───────────────────────────────────────────────────────── */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

.price-cell--user {
  grid-column: 1 / -1;
}

.price-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .625rem .75rem;
}

.price-label {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .2rem;
  font-weight: 600;
}

.price-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.price-value--win {
  color: var(--green);
}

.price-sub {
  display: block;
  font-size: .75rem;
  color: var(--text-dim);
  margin-top: .15rem;
}

.price-badge {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--green);
  margin-top: .35rem;
}

/* ─── Formulaire mise ──────────────────────────────────────────────────────── */
.bid-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .875rem;
  box-shadow: var(--shadow);
}

.form-row {
  display: flex;
  flex-direction: column;
}

/* ─── Feedback ─────────────────────────────────────────────────────────────── */
.feedback {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.4;
}

.feedback-success {
  background: #DCFCE7;
  border: 1.5px solid #86EFAC;
  color: #166534;
}

.feedback-error {
  background: #FEE2E2;
  border: 1.5px solid #FCA5A5;
  color: #991B1B;
}

/* ─── Boutons ──────────────────────────────────────────────────────────────── */
.form-actions {
  display: flex;
  gap: .625rem;
}

.btn {
  padding: .8rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* Cibles tactiles iOS/Android : 48px min recommandé */
  min-height: 48px;
  user-select: none;
  -webkit-user-select: none;
}

.btn:active { transform: scale(.97); opacity: .85; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  flex: 1;
  background: var(--accent);
  color: #1a1205;
  font-size: 1rem;
  letter-spacing: .02em;
  box-shadow: 0 2px 10px rgba(255,138,30,.30);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  box-shadow: 0 4px 14px rgba(255,138,30,.40);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: .7rem 1rem;
}

.btn-secondary:hover { background: var(--border); }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  min-width: 72px;
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--night);
  border-top: 1px solid rgba(255,255,255,.10);
  text-align: center;
  padding: .5rem;
  font-size: .7rem;
  color: var(--night-muted);
  box-shadow: 0 -2px 10px rgba(0,0,0,.15);
}

/* ─── Petits écrans (< 375px, iPhone SE, etc.) ─────────────────────────────── */
@media (max-width: 374px) {
  .app-main      { padding: .75rem; }
  .brand-title   { font-size: .9rem; }
  .timer-value   { font-size: 1.25rem; }
  .price-grid    { grid-template-columns: 1fr 1fr; }
  .form-actions  { flex-direction: column; }
  .btn-primary   { width: 100%; }
}

/* ─── Tablette et plus ─────────────────────────────────────────────────────── */
@media (min-width: 540px) {
  .app-main { padding: 1.5rem; }
  .timer-value { font-size: 1.75rem; }
  .artwork-img { max-height: 340px; }
}

/* ─── Safe area iOS (iPhone X et +, notch/Dynamic Island) ──────────────────── */
@supports (padding: max(0px)) {
  .app-header {
    padding-left:  max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .app-footer {
    padding-bottom: max(.5rem, env(safe-area-inset-bottom));
  }
  .app-main {
    padding-left:  max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}
