/* ============ Login Screen ============ */
.login-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg, #5d1e2d 0%, #3d1320 40%, #2a0d16 100%);
  padding:24px;
}
.login-container{
  width:100%;
  max-width:380px;
  animation:loginFadeIn 0.6s ease;
}
@keyframes loginFadeIn{
  from{opacity:0;transform:translateY(20px)}
  to{opacity:1;transform:translateY(0)}
}
.login-logo{
  text-align:center;
  margin-bottom:36px;
}
.login-logo-icon{
  font-size:56px;
  margin-bottom:8px;
  filter:drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}
.login-brand{
  font-size:36px;
  font-weight:800;
  color:#fff;
  letter-spacing:4px;
  margin:0;
  text-shadow:0 2px 8px rgba(0,0,0,0.3);
}
.login-tagline{
  font-size:14px;
  color:rgba(255,255,255,0.6);
  margin-top:4px;
  letter-spacing:1px;
}
.login-form{
  background:rgba(255,255,255,0.08);
  backdrop-filter:blur(12px);
  border-radius:20px;
  padding:32px 24px;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow:0 12px 40px rgba(0,0,0,0.25);
}
.login-field{
  margin-bottom:20px;
}
.login-field label{
  display:block;
  font-size:13px;
  font-weight:600;
  color:rgba(255,255,255,0.7);
  margin-bottom:6px;
  letter-spacing:0.5px;
}
.login-field input{
  width:100%;
  padding:14px 16px;
  border:1px solid rgba(255,255,255,0.15);
  border-radius:12px;
  background:rgba(255,255,255,0.06);
  color:#fff;
  font-size:15px;
  font-family:inherit;
  outline:none;
  transition:border-color 0.2s, box-shadow 0.2s;
}
.login-field input::placeholder{
  color:rgba(255,255,255,0.3);
}
.login-field input:focus{
  border-color:rgba(255,255,255,0.35);
  box-shadow:0 0 0 3px rgba(255,255,255,0.08);
}
.login-password-wrap{
  position:relative;
}
.login-password-wrap input{
  padding-right:48px;
}
.login-eye{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  background:none;
  border:none;
  font-size:18px;
  cursor:pointer;
  opacity:0.5;
  padding:4px;
}
.login-error{
  background:rgba(239,68,68,0.15);
  border:1px solid rgba(239,68,68,0.3);
  color:#fca5a5;
  padding:10px 14px;
  border-radius:10px;
  font-size:13px;
  margin-bottom:16px;
  text-align:center;
}
.login-btn{
  width:100%;
  padding:15px;
  background:linear-gradient(135deg, #e8553e 0%, #c0392b 100%);
  color:#fff;
  border:none;
  border-radius:12px;
  font-size:16px;
  font-weight:700;
  cursor:pointer;
  letter-spacing:0.5px;
  transition:transform 0.15s, box-shadow 0.2s;
  box-shadow:0 4px 16px rgba(192,57,43,0.35);
}
.login-btn:hover{
  transform:translateY(-1px);
  box-shadow:0 6px 20px rgba(192,57,43,0.45);
}
.login-btn:active{
  transform:translateY(0);
}
.login-btn:disabled{
  opacity:0.6;
  cursor:not-allowed;
  transform:none;
}

/* ============ Interface (light pages, dark home) ============ */
:root{
  --bg:#f0f2f7;
  --card:#ffffff;
  --card2:#f4f5fa;
  --text:#111827;
  --text-muted:#6b7280;
  --border:#e5e7eb;
  --green:#10b981;
  --blue:#6366f1;
  --blue-active:#818cf8;
  --accent:#5d1e2d;
  --warn:#f59e0b;
  --shadow:0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:0 8px 30px rgba(0,0,0,.12);
  --shadow-soft:0 2px 8px rgba(0,0,0,.06);
  --muted:#6b7280;
  /* Dark home screen variables */
  --home-bg:#0e0e1c;
  --home-card:#1e1e35;
  --home-card2:#252540;
  --home-text:#f0f0ff;
  --home-text-muted:#9090b8;
  --home-border:#2a2a4a;
}

*{box-sizing:border-box; margin:0; padding:0}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

.app{min-height:100dvh; padding-bottom:80px; background:var(--bg)}

/* ============ Home section — dark background ============ */
#homeSection{
  background:var(--home-bg);
  min-height:calc(100dvh - 70px);
}

/* ============ En-tête moderne ============ */
.modern-header{
  padding:16px 16px 12px;
  max-width:760px;
  margin:0 auto;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--home-bg);
}
.user-avatar-small{
  position:absolute;
  top:16px;
  left:16px;
  width:38px;
  height:38px;
  border-radius:50%;
  background:var(--home-card2);
  color:var(--home-text-muted);
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--home-border);
  cursor:pointer;
}
.brand-title{
  font-size:26px;
  font-weight:900;
  color:#fff;
  text-align:center;
  margin:0;
  letter-spacing:2px;
}
.brand-title span{
  color:var(--blue-active);
}
.brand-subtitle{
  display:none;
}

/* ============ Cartes d'actions (iOS app icons style) ============ */
.action-cards-section{
  padding:8px 16px 0;
  max-width:760px;
  margin:0 auto;
  background:var(--home-bg);
}
.action-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:14px;
}
.action-card{
  background:var(--home-card);
  border:none;
  border-radius:22px;
  padding:20px 8px 14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  cursor:pointer;
  transition:transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow:0 4px 16px rgba(0,0,0,0.35);
  position:relative;
  overflow:hidden;
}
.action-card::before{
  content:'';
  position:absolute;
  inset:0;
  background:linear-gradient(135deg,rgba(255,255,255,0.06) 0%,transparent 60%);
  border-radius:22px;
  pointer-events:none;
}
.action-card:active{
  transform:scale(0.93);
  box-shadow:0 2px 8px rgba(0,0,0,0.4);
}
.action-icon{
  width:56px;
  height:56px;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
  box-shadow:0 3px 10px rgba(0,0,0,0.3);
}
.action-label{
  font-size:12px;
  font-weight:600;
  color:var(--home-text);
  text-align:center;
  line-height:1.3;
}

/* ============ KPIs bordeaux ============ */
.kpi-cards-section{
  padding:0 16px 16px;
  max-width:760px;
  margin:0 auto;
}
.kpi-cards-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:12px;
}
.kpi-card{
  background:#5d1e2d;
  border-radius:16px;
  padding:16px 12px;
  color:#fff;
  box-shadow:var(--shadow);
}
.kpi-card-value{
  font-size:28px;
  font-weight:800;
  margin-bottom:4px;
}
.kpi-card-label{
  font-size:12px;
  opacity:0.9;
}

/* ============ Prochaine réservation ============ */
.next-event-section{
  padding:0 16px 16px;
  max-width:760px;
  margin:0 auto;
}
.next-event-card{
  background:var(--home-card);
  border:1px solid var(--home-border);
  border-radius:20px;
  padding:20px;
  text-align:center;
  box-shadow:0 4px 20px rgba(0,0,0,.3);
  position:relative;
  color:var(--home-text);
}
.next-event-title{
  font-size:14px;
  font-weight:800;
  letter-spacing:0.5px;
  margin-bottom:12px;
  color:var(--home-text);
}
.next-event-date{
  font-size:14px;
  color:var(--home-text-muted);
  margin-bottom:8px;
}
.next-event-name{
  font-size:20px;
  font-weight:700;
  color:var(--green);
  margin-bottom:8px;
}
.next-event-time{
  font-size:16px;
  font-weight:600;
  color:var(--home-text);
  margin-bottom:4px;
}
.next-event-guests{
  font-size:14px;
  color:var(--home-text-muted);
  margin-bottom:12px;
}
.next-event-badge{
  display:inline-block;
  background:#ef4444;
  color:#fff;
  font-size:12px;
  font-weight:700;
  padding:6px 16px;
  border-radius:20px;
  text-transform:uppercase;
}

/* ============ Dernières activités ============ */
.recent-section{
  padding:0 16px 16px;
  max-width:760px;
  margin:0 auto;
}
.recent-title{
  font-size:18px;
  font-weight:800;
  color:var(--home-text);
  margin-bottom:12px;
}
.activity-item{
  background:var(--home-card);
  border:1px solid var(--home-border);
  border-radius:12px;
  padding:14px;
  margin-bottom:8px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  box-shadow:0 2px 8px rgba(0,0,0,.25);
}
.activity-info{
  flex:1;
}
.activity-title{
  font-weight:600;
  margin-bottom:4px;
  font-size:14px;
  color:var(--home-text);
}
.activity-meta{
  font-size:12px;
  color:var(--home-text-muted);
}
.activity-badge{
  background:#1f2937;
  color:#fff;
  font-size:11px;
  font-weight:700;
  padding:6px 12px;
  border-radius:4px;
  text-transform:uppercase;
}

/* ============ Navigation du bas ============ */
.tabs{
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  z-index:50;
  background:#161628;
  border-top:1px solid #2a2a44;
  box-shadow:0 -4px 24px rgba(0,0,0,.5);
  display:flex;
  padding-bottom:env(safe-area-inset-bottom, 0);
}
.tab{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:10px 4px 8px;
  gap:4px;
  color:#6666aa;
  background:transparent;
  border:0;
  cursor:pointer;
  font-size:22px;
  transition:all 0.2s ease;
}
.tab span{
  font-size:10px;
  font-weight:600;
  letter-spacing:0.2px;
  color:#6666aa;
}
.tab.active{
  color:var(--blue-active);
}
.tab.active span{
  color:var(--blue-active);
}
.tab-center-btn{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:6px 4px 8px;
  gap:4px;
  cursor:pointer;
  background:transparent;
  border:0;
}
.tab-center-btn .tab-plus{
  width:44px;
  height:44px;
  border-radius:50%;
  background:linear-gradient(135deg,var(--blue) 0%,#a855f7 100%);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  color:#fff;
  box-shadow:0 4px 16px rgba(99,102,241,0.5);
  transition:transform 0.15s ease;
}
.tab-center-btn:active .tab-plus{
  transform:scale(0.9);
}
.tab-center-btn span{
  font-size:10px;
  font-weight:600;
  color:var(--text-muted);
}

/* ============ Pages internes ============ */
.container{max-width:760px; margin:0 auto; padding:16px}
.space{margin-top:8px}
.page-title{
  color:var(--text);
  font-size:20px;
  font-weight:800;
  margin:8px 0
}
.section-title{
  color:var(--text-muted);
  font-size:16px;
  margin:8px 0
}
.hidden{display:none}

.row{display:flex; flex-direction:column; gap:10px}
.item{
  background:var(--card); border:1px solid var(--border); border-radius:14px;
  box-shadow:var(--shadow); padding:12px; display:flex; align-items:center; justify-content:space-between;
}
.item .meta{font-size:12px; color:var(--text-muted)}
.btn{
  border:1px solid var(--border); background:var(--card2); color:var(--text);
  border-radius:10px; padding:6px 10px; cursor:pointer;
}
.btn.primary{background:var(--accent); border-color:var(--accent); color:#fff}
.btn.warn{background:var(--warn); border-color:var(--warn); color:#111}
.btn.slim{padding:4px 8px}
.btn-add{background:#10b981; border-color:#10b981; color:#fff; font-weight:600; box-shadow:0 2px 8px rgba(16,185,129,0.3)}
.btn-add:active{background:#059669}

.qty{width:42px; text-align:center; font-weight:700}

.skeleton{
  height:72px; border-radius:14px; background:linear-gradient(90deg,var(--card),var(--card2),var(--card));
  background-size:200% 100%; animation:shine 1.2s linear infinite;
  border:1px solid var(--border);
}
@keyframes shine{from{background-position:200% 0} to{background-position:-200% 0}}

.toasts{
  position:fixed; left:50%; bottom:90px; transform:translateX(-50%);
  display:flex; flex-direction:column; gap:8px; z-index:60;
}
.toast{background:rgba(0,0,0,.85); color:#fff; padding:8px 12px; border-radius:10px; box-shadow:var(--shadow); font-size:14px}

/* badges de statut */
.dot{display:inline-block; width:8px; height:8px; border-radius:999px; background:var(--ok); margin-right:6px}
.dot.busy{background:var(--warn)}
.low{outline:2px solid var(--warn); outline-offset:-2px}

/* Styles pour les nouvelles fonctionnalités Recettes/Menus */
.screen.hidden { display: none; }
.screen-header { display:flex; justify-content:space-between; align-items:center; gap:.75rem; margin-bottom:1rem; }
.actions .btn { margin-left:.5rem; }
.collapsible.collapsed { display:none; }
.with-mic { position:relative; }
.with-mic .mic { position:absolute; right:.5rem; bottom:.5rem; border:none; background:transparent; font-size:1.25rem; cursor:pointer; }
.photo-zone { display:flex; align-items:flex-start; gap:1rem; margin:.5rem 0 1rem; }
.photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(84px,1fr)); gap:.5rem; width:100%; }
.photo-grid img { width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:8px; }
.list .item { display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.75rem 1rem; border-radius:12px; background:var(--card); border:1px solid var(--border); margin-bottom:.5rem; }
.chips { display:flex; flex-wrap:wrap; gap:.35rem; }
.chip { padding:.25rem .5rem; border-radius:999px; background:#eef; font-size:.8rem; }
.menu-dishes .dish { border:1px dashed #cfd6ff; border-radius:10px; padding:.75rem; margin:.5rem 0; }
.allergens { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:.25rem .75rem; margin-top:.5rem; }
.allergens label { display:flex; align-items:center; gap:.5rem; }
.btn.ghost { background:transparent; }
.form-actions { display:flex; gap:.5rem; justify-content:flex-end; margin-top:.75rem; }

/* ============ Inputs globaux ============ */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
select, textarea {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-active);
  box-shadow: 0 0 0 2px rgba(129,140,248,0.2);
}
select option {
  background: var(--card);
  color: var(--text);
}

/* ============ Mode sombre complet (optionnel toggle) ============ */
body.dark-mode {
  --bg: #0e0e1c;
  --card: #1e1e35;
  --card2: #252540;
  --text: #f0f0ff;
  --text-muted: #8888aa;
  --border: #2a2a4a;
  --home-bg: #080812;
  --home-card: #16162e;
}

/* ============ Backbar IA Post Builder ============ */
.bb-grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 900px){
  .bb-grid2{ grid-template-columns: 1fr; }
}

.bb-card{
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.bb-subcard{
  border:1px solid var(--border);
  background: var(--card2);
  border-radius: 12px;
  padding: 14px;
}

.bb-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin:10px 0;
}

.bb-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background: var(--card);
  cursor:pointer;
  user-select:none;
  font-size: 13px;
  color: var(--text);
  transition: all 0.15s;
}
.bb-btn:hover{ opacity: 0.85; }
.bb-btn-primary{ background: #5d1e2d; color: #fff; border-color: #5d1e2d; }
.bb-btn-ghost{ background: transparent; }
.bb-btn-danger{ background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
body.dark-mode .bb-btn{ 
  background: rgba(255,255,255,0.06); 
  border-color: rgba(255,255,255,0.12);
}
body.dark-mode .bb-btn-primary{ background: rgba(255,255,255,0.14); }
body.dark-mode .bb-btn-danger{ background: rgba(255,0,0,0.14); border-color: rgba(255,0,0,0.25); }

.bb-label{
  display:block;
  margin:10px 0 6px;
  font-size:0.85rem;
  color: var(--text-muted);
}

.bb-input{
  width:100%;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  outline:none;
  font-size: 13px;
}

.bb-row{ display:flex; gap:10px; }
.bb-col{ flex:1; min-width:140px; }

.bb-preview-wrap{
  margin-top:10px;
}
.bb-preview-img{
  width:100%;
  max-height:280px;
  object-fit:cover;
  border-radius:12px;
  border:1px solid var(--border);
}
.bb-muted{ opacity:0.7; font-size:0.85rem; margin-top:6px; color: var(--text-muted); }

.bb-post-preview{
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  background: #f9fafb;
  min-height: 100px;
}
body.dark-mode .bb-post-preview{
  background: rgba(0,0,0,0.18);
  border-color: rgba(255,255,255,0.10);
}
.bb-post-preview.bb-empty{
  padding:14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
}
.bb-post-preview img{
  width:100%;
  display:block;
  max-height:300px;
  object-fit:cover;
}
.bb-post-caption{
  padding:12px 14px;
  white-space:pre-wrap;
  line-height:1.4;
  font-size: 14px;
}

/* ============ Wheel Animation - Style Skrewball ============ */
.wheel-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.88);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
  animation:fadeIn 0.3s ease;
}
@keyframes fadeIn{
  from{opacity:0}
  to{opacity:1}
}
.wheel-container{
  background:linear-gradient(135deg, #2a1a0e 0%, #3d2415 50%, #2a1a0e 100%);
  border-radius:28px;
  padding:28px 24px;
  text-align:center;
  max-width:380px;
  width:94%;
  box-shadow:0 20px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
  border:3px solid #c8943e;
}
.wheel-title{
  font-size:20px;
  font-weight:800;
  color:#f0d68a;
  margin-bottom:20px;
  text-transform:uppercase;
  letter-spacing:3px;
  text-shadow:0 2px 6px rgba(0,0,0,0.6);
  background:linear-gradient(180deg, #f5e6b8 0%, #c8943e 100%);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.wheel-wrapper{
  position:relative;
  width:300px;
  height:300px;
  margin:0 auto 20px;
}
.wheel-canvas-wrap{
  width:100%;
  height:100%;
  position:relative;
}
.wheel-canvas-wrap canvas{
  width:100%;
  height:100%;
  border-radius:50%;
  transition:transform 5s cubic-bezier(0.15, 0.60, 0.07, 1.00);
}
.wheel-canvas-wrap canvas.spinning{
  transform:rotate(var(--spin-deg, 2160deg));
}
.wheel-outer-ring{
  position:absolute;
  inset:-8px;
  border-radius:50%;
  border:8px solid #c8943e;
  box-shadow:0 0 0 3px #8b6420, 0 0 20px rgba(200,148,62,0.35), inset 0 0 10px rgba(200,148,62,0.2);
  pointer-events:none;
}
.wheel-dots{
  position:absolute;
  inset:-12px;
  border-radius:50%;
  pointer-events:none;
}
.wheel-dot{
  position:absolute;
  width:8px;
  height:8px;
  background:radial-gradient(circle, #ffe88a 30%, #c8943e 100%);
  border-radius:50%;
  box-shadow:0 0 6px rgba(255,232,138,0.6);
}
.wheel-pointer{
  position:absolute;
  top:-14px;
  left:50%;
  transform:translateX(-50%);
  z-index:10;
  filter:drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
.wheel-pointer svg{
  width:36px;
  height:42px;
}
.wheel-center-btn{
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  width:72px;
  height:72px;
  border-radius:50%;
  background:linear-gradient(180deg, #e8553e 0%, #c0392b 60%, #962d22 100%);
  border:4px solid #f5c87a;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:5;
  box-shadow:0 4px 16px rgba(0,0,0,0.45), inset 0 2px 0 rgba(255,255,255,0.3), 0 0 0 3px #8b6420;
  cursor:pointer;
  transition:transform 0.15s;
}
.wheel-center-btn:active{
  transform:translate(-50%,-50%) scale(0.94);
}
.wheel-center-btn span{
  font-size:14px;
  font-weight:900;
  color:#fff;
  text-transform:uppercase;
  letter-spacing:1px;
  text-shadow:0 2px 4px rgba(0,0,0,0.4);
}
.wheel-result{
  font-size:20px;
  font-weight:700;
  color:#f0d68a;
  min-height:32px;
  text-shadow:0 2px 4px rgba(0,0,0,0.4);
  margin-top:4px;
}
.wheel-result.lose{
  color:#999;
}
.wheel-close{
  margin-top:16px;
  padding:14px 40px;
  background:linear-gradient(180deg, #c8943e 0%, #a07630 100%);
  color:#fff;
  border:none;
  border-radius:12px;
  font-size:15px;
  font-weight:800;
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:1px;
  box-shadow:0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  transition:transform 0.2s;
}
.wheel-close:active{
  transform:scale(0.97);
}

/* AI Chat typing animation */
.ai-typing{
  display:inline-block;
  font-size:18px;
  letter-spacing:3px;
  animation:aiPulse 1.2s infinite;
  color:#6366f1;
}
@keyframes aiPulse{
  0%,100%{opacity:.3}
  50%{opacity:1}
}
#aiChatInput:focus{
  border-color:#6366f1 !important;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
