/* style.css */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --premium: #7c4dff;
  --premium-dark: #5e35b1;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #f5a623;
  --info: #17a2b8;
  --bg: #f0f4f8;
  --card-bg: #fff;
  --text: #202124;
  --text-muted: #5f6368;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: calc(88px + var(--safe-bottom)); }
.hidden { display: none !important; }

/* ─── Header ─── */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(26,115,232,0.25);
}
.header-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }

#user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.18);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  backdrop-filter: blur(4px);
}

/* ─── Main ─── */
main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Card ─── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 14px; }

/* ─── Météo Grid ─── */
.meteo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.meteo-item {
  background: #e8f2fd;
  border-radius: 12px;
  padding: 14px 6px;
  text-align: center;
}
.meteo-icon { font-size: 1.5rem; display: block; margin-bottom: 4px; }
.meteo-val { font-size: 1.1rem; font-weight: 700; display: block; color: var(--text); }
.meteo-label { font-size: 0.7rem; color: var(--text-muted); display: block; margin-top: 2px; }

/* ─── Buttons ─── */
.btn-secondary {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-secondary:active { background: #e8f0fe; transform: scale(0.98); }

/* ─── Recommandation ─── */
#reco-result { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.reco-message { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.tenue-box {
  background: linear-gradient(135deg, #e8f0fe, #d2e3fc);
  border-radius: 12px;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 12px;
  border-left: 4px solid var(--primary);
}
.alertes { margin-bottom: 12px; }
.alertes p { padding: 4px 0; font-size: 0.9rem; color: var(--text-muted); }
.score-badge { display: inline-block; padding: 6px 18px; border-radius: 20px; font-weight: 700; font-size: 0.9rem; }
.score--1 { background: #d1ecf1; color: #0c5460; }
.score-0  { background: #d4edda; color: #155724; }
.score-1  { background: #f8d7da; color: #721c24; }

/* ─── Loader ─── */
.loader {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.loader::after {
  content: '';
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid #e0e0e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Premium CTA ─── */
.premium-cta { background: linear-gradient(135deg, #f3e8ff, #ede7f6); border: 2px solid #b388ff; }
.premium-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.premium-text h2 { margin-bottom: 4px; }
.premium-text p { font-size: 0.88rem; color: var(--text-muted); }
.btn-premium {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--premium), var(--premium-dark));
  color: white;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(124,77,255,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn-premium:active { transform: scale(0.95); box-shadow: 0 2px 8px rgba(124,77,255,0.25); }

/* ─── PWA Install Card ─── */
.install-card {
  background: linear-gradient(135deg, #e3f2fd, #f3e8ff);
  border: 2px solid #90caf9;
  animation: slideUp 0.4s ease;
}
.install-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.install-icon { font-size: 2.2rem; flex-shrink: 0; }
.install-text { flex: 1; min-width: 160px; }
.install-text h2 { font-size: 1rem; margin-bottom: 4px; }
.install-text p { font-size: 0.82rem; color: var(--text-muted); }
.btn-install-main {
  flex-shrink: 0;
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26,115,232,0.35);
  white-space: nowrap;
  transition: transform 0.15s, opacity 0.15s;
}
.btn-install-main:active { transform: scale(0.95); }
.btn-install-main:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Feedback flottant ─── */
.btn-feedback {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 1.3rem;
  box-shadow: 0 4px 20px rgba(26,115,232,0.45);
  cursor: pointer;
  z-index: 200;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-feedback:active { transform: scale(0.9); }
.btn-feedback:hover { box-shadow: 0 6px 24px rgba(26,115,232,0.55); }

/* ─── Modal Feedback ─── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  animation: fadeIn 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-content {
  background: white;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  position: relative;
  text-align: center;
  animation: slideUp 0.35s ease;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
#modal-title { margin-bottom: 8px; }
.modal-weather { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.feedback-buttons { display: flex; gap: 10px; justify-content: center; }
.feedback-btn {
  flex: 1;
  max-width: 110px;
  padding: 16px 8px;
  border: none;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  line-height: 1.4;
}
.feedback-btn:active { transform: scale(0.94); }
.froid  { background: #d1ecf1; color: #0c5460; }
.parfait { background: #d4edda; color: #155724; }
.chaud   { background: #f8d7da; color: #721c24; }
.feedback-confirm { margin-top: 16px; }
.feedback-ok { font-size: 1.1rem; }

/* ─── PWA Banner (fixed bottom) ─── */
.pwa-banner {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  max-width: 600px;
  margin: 0 auto;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  z-index: 300;
  border: 1px solid #e8eaed;
}
.pwa-inner { display: flex; align-items: center; gap: 12px; }
.pwa-icon { font-size: 2rem; flex-shrink: 0; }
.pwa-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pwa-text strong { font-size: 0.95rem; }
.pwa-text span { font-size: 0.8rem; color: var(--text-muted); }
.pwa-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-pwa-install {
  background: var(--primary); color: white;
  border: none; border-radius: 50px; padding: 8px 16px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.btn-pwa-dismiss {
  background: none; border: none; font-size: 1.2rem;
  color: var(--text-muted); cursor: pointer; padding: 4px;
}

/* ─── Responsive — Tablette ─── */
@media (max-width: 768px) {
  .meteo-grid { grid-template-columns: repeat(2, 1fr); }
  .premium-inner { flex-direction: column; align-items: flex-start; }
  .btn-premium { width: 100%; justify-content: center; }
  .install-inner { flex-direction: column; text-align: center; }
  .install-text { min-width: unset; }
  .btn-install-main { width: 100%; justify-content: center; }
}

/* ─── Responsive — Mobile ─── */
@media (max-width: 480px) {
  .meteo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .meteo-item { padding: 12px 4px; }
  .meteo-val { font-size: 1rem; }
  .meteo-icon { font-size: 1.3rem; }

  .premium-inner { flex-direction: column; align-items: flex-start; }
  .btn-premium { width: 100%; justify-content: center; }

  .install-inner { flex-direction: column; text-align: center; }
  .install-text { min-width: unset; }
  .btn-install-main { width: 100%; justify-content: center; }

  .feedback-buttons { flex-wrap: wrap; }
  .feedback-btn { min-width: 90px; }

  .pwa-banner { bottom: calc(88px + var(--safe-bottom)); left: 8px; right: 8px; }
  .pwa-inner { gap: 8px; }
}

/* ─── Responsive — Petit mobile ─── */
@media (max-width: 360px) {
  .card { padding: 14px; }
  header h1 { font-size: 1.1rem; }
  .meteo-grid { gap: 6px; }
  .btn-install-main, .btn-premium { font-size: 0.85rem; padding: 10px 16px; }
}

/* ─── Dark mode ─── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --card-bg: #1e1e1e;
    --text: #e8eaed;
    --text-muted: #9aa0a6;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  }
  .meteo-item { background: #1e2a3a; }
  .tenue-box { background: linear-gradient(135deg, #1a2f4a, #1e3a5f); color: #8ab4f8; border-color: #8ab4f8; }
  .premium-cta { background: linear-gradient(135deg, #2d2045, #1e1435); border-color: #5e35b1; }
  .btn-premium { box-shadow: 0 4px 16px rgba(124,77,255,0.45); }
  .install-card { background: linear-gradient(135deg, #1a2f4a, #2d2045); border-color: #5e35b1; }
  .pwa-banner { background: #1e1e1e; border-color: #333; }
  .pwa-text strong { color: #e8eaed; }
}

/* ─── Landscape phone ─── */
@media (max-height: 500px) and (orientation: landscape) {
  .pwa-banner { bottom: 70px; }
  .btn-feedback { bottom: 16px; right: 16px; width: 48px; height: 48px; font-size: 1.1rem; }
}

/* ─── Account + Memory ─── */
.auth-form { display:flex; flex-direction:column; gap:10px; }
.auth-form input {
  width:100%; padding:12px 14px; border-radius:12px; border:1px solid #d6dbe3;
  font:inherit; background:#fff; color:#202124;
}
.auth-actions { display:flex; gap:10px; flex-wrap:wrap; }
.btn-auth {
  flex:1; min-width:130px; border:none; border-radius:50px; padding:11px 16px;
  background:var(--primary); color:#fff; font-weight:700; cursor:pointer;
}
.btn-auth.secondary { background:#eef4ff; color:var(--primary-dark); border:1px solid #cfe0ff; }
.auth-message { min-height:1.2em; color:var(--text-muted); font-size:.85rem; }
#auth-logged { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
#auth-user-label { font-weight:700; color:var(--primary-dark); }
.memory-item {
  display:grid; grid-template-columns:64px 1fr; gap:12px; align-items:center;
  padding:10px 0; border-top:1px solid #eef0f3;
}
.memory-item:first-child { border-top:none; }
.memory-item img { width:64px; height:64px; object-fit:cover; border-radius:12px; background:#e8eaed; }
.memory-item strong { display:block; margin-bottom:2px; }
.memory-item small { color:var(--text-muted); }

@media (max-width:480px) {
  .auth-actions { flex-direction:column; }
  .btn-auth { width:100%; }
  .memory-item { grid-template-columns:54px 1fr; }
  .memory-item img { width:54px; height:54px; }
}

/* ─── Modern discreet account UI ─── */
.account-pill {
  display:flex; align-items:center; gap:7px;
  background:rgba(255,255,255,.18); color:#fff;
  border:1px solid rgba(255,255,255,.28);
  border-radius:999px; padding:7px 10px;
  font:inherit; font-size:.82rem; font-weight:700; cursor:pointer;
  backdrop-filter: blur(8px);
}
.account-pill:active { transform:scale(.97); }
.score-mini {
  background:rgba(255,255,255,.18); border-radius:999px;
  padding:2px 6px; font-size:.72rem;
}
.auth-modal-content { max-width:420px; border-radius:24px 24px 0 0; }
.auth-hero { text-align:left; margin-bottom:18px; }
.auth-hero-icon {
  width:46px; height:46px; border-radius:16px;
  display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#e8f0fe,#f3e8ff); font-size:1.5rem;
  margin-bottom:10px;
}
.auth-hero h2 { margin:0 0 4px; font-size:1.35rem; }
.auth-hero p { margin:0; color:var(--text-muted); font-size:.9rem; }
.auth-form-modern { display:flex; flex-direction:column; gap:10px; }
.auth-form-modern input {
  width:100%; border:1px solid #d9dee8; border-radius:16px;
  padding:13px 14px; font:inherit; background:#fff; color:#202124;
}
.btn-auth-primary {
  border:none; border-radius:999px; padding:13px 16px;
  background:linear-gradient(135deg,var(--primary),var(--primary-dark));
  color:#fff; font-weight:800; cursor:pointer; box-shadow:0 8px 20px rgba(26,115,232,.22);
}
.btn-auth-link {
  border:none; background:transparent; color:var(--primary-dark);
  font-weight:800; padding:8px; cursor:pointer;
}
.auth-logged-modern {
  text-align:left; padding:14px; background:#f4f7fb; border-radius:18px;
}
.auth-message { color:var(--text-muted); font-size:.85rem; min-height:1.2em; text-align:center; }

/* Hide old auth-card if a cached version ever appears */
#auth-card { display:none !important; }

@media (max-width:480px) {
  .account-pill { padding:7px 9px; gap:5px; }
  #account-label { max-width:72px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .score-mini { display:none; }
}

.install-actions { display:flex; flex-direction:column; gap:8px; align-items:stretch; }
.btn-open-chrome {
  display:inline-flex; align-items:center; justify-content:center;
  text-decoration:none; border-radius:999px; padding:10px 18px;
  background:#fff; color:var(--primary-dark); border:1px solid #cfe0ff;
  font-size:.88rem; font-weight:800;
}
@media (max-width:768px) { .install-actions { width:100%; } }

/* ─── Market-standard app polish ─── */
.section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.eyebrow { display:block; color:var(--primary); font-size:.72rem; text-transform:uppercase; letter-spacing:.08em; font-weight:900; margin-bottom:3px; }
.muted { color:var(--text-muted); font-size:.9rem; line-height:1.45; margin-bottom:14px; }
.chip-button { border:none; background:#eef4ff; color:var(--primary-dark); font-weight:900; border-radius:999px; padding:9px 14px; cursor:pointer; }
.outfit-card { overflow:hidden; }
.outfit-carousels { display:flex; flex-direction:column; gap:16px; }
.outfit-row-title { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.clothes-carousel { display:flex; gap:12px; overflow-x:auto; padding:2px 2px 10px; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch; }
.clothes-carousel::-webkit-scrollbar { height:4px; }
.clothes-carousel::-webkit-scrollbar-thumb { background:#d7deea; border-radius:99px; }
.cloth-card { min-width:118px; max-width:118px; scroll-snap-align:start; border:2px solid transparent; background:#fff; border-radius:18px; padding:8px; box-shadow:0 8px 22px rgba(0,0,0,.07); cursor:pointer; text-align:left; }
.cloth-card.selected { border-color:var(--primary); box-shadow:0 10px 26px rgba(26,115,232,.18); }
.cloth-card img { width:100%; aspect-ratio:4/5; object-fit:cover; border-radius:14px; background:#f4f6fa; display:block; margin-bottom:8px; }
.cloth-card span { display:block; font-weight:900; font-size:.86rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cloth-card small { color:var(--text-muted); font-size:.72rem; }
.outfit-verdict { margin-top:14px; border-radius:18px; padding:14px; background:#f5f7fb; border:1px solid #e8edf6; }
.outfit-verdict strong { display:block; margin-bottom:4px; }
.outfit-verdict p { margin:0; color:var(--text-muted); font-size:.88rem; line-height:1.4; }
.outfit-verdict.good { background:#ecfdf3; border-color:#b7ebc9; }
.outfit-verdict.cold { background:#eef9ff; border-color:#bce7fb; }
.outfit-verdict.hot { background:#fff1f1; border-color:#ffd0d0; }
.coach-list { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.coach-item { display:flex; gap:10px; padding:12px; border-radius:16px; background:#f7f9fc; border:1px solid #edf1f7; }
.coach-item > span { font-size:1.4rem; }
.coach-item strong { display:block; margin-bottom:3px; }
.coach-item p { margin:0; color:var(--text-muted); font-size:.82rem; line-height:1.35; }

@media (max-width:480px) {
  .coach-list { grid-template-columns:1fr; }
  .cloth-card { min-width:108px; max-width:108px; }
  .section-head h2 { font-size:1.05rem; }
}

/* ─── Premium image carousel ─── */
.look-carousel-card { overflow:hidden; }
.premium-look-carousel {
  display:flex; gap:14px; overflow-x:auto; padding:4px 2px 12px;
  scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;
}
.premium-look-carousel::-webkit-scrollbar { height:4px; }
.premium-look-carousel::-webkit-scrollbar-thumb { background:#d7deea; border-radius:99px; }
.look-card {
  min-width:154px; max-width:154px; scroll-snap-align:start;
  border:2px solid transparent; border-radius:22px; padding:10px;
  background:#fff; box-shadow:0 10px 26px rgba(32,33,36,.08);
  text-align:left; cursor:pointer;
}
.look-card.selected { border-color:#6d5dfc; box-shadow:0 14px 34px rgba(109,93,252,.2); }
.look-card img { width:100%; aspect-ratio:4/5; object-fit:cover; border-radius:18px; background:#f5f6fb; display:block; margin-bottom:10px; }
.look-card strong { display:block; font-size:.92rem; }
.look-card small { display:block; color:#667085; font-size:.76rem; line-height:1.25; margin-top:3px; }
@media (max-width:480px) { .look-card { min-width:132px; max-width:132px; } }
