/* OTOP Sites — styles de la plateforme (complète Tailwind). */

/* Coque d'application mobile (espace client et admin) */
html.app-shell { height: 100%; overflow: hidden; }
html.app-shell body { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
body {
  font-family: 'Instrument Sans', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  background: #F7F8F4;
  color: #0E2A22;
  -webkit-font-smoothing: antialiased;
}
#app { width: 100%; height: 100%; display: flex; overflow: hidden; }
.scroll-area { overflow-y: scroll; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior-y: none; }
input, select, textarea { font-size: 16px !important; }
.tap { transition: transform .15s cubic-bezier(.32, .72, 0, 1), opacity .15s; }
.tap:active { transform: scale(.95); opacity: .85; }
.font-display { letter-spacing: -.025em; }
[x-cloak], .hidden-js { display: none !important; }

/* Champs */
.input {
  width: 100%; padding: .78rem 1rem; background: #fff; color: #0E2A22;
  border: 1.5px solid #DDE3DA; border-radius: 14px; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: #0F7A5A; box-shadow: 0 0 0 4px rgba(15, 122, 90, .14); }
.input::placeholder { color: #9AAAA2; }
textarea.input { resize: vertical; min-height: 5rem; line-height: 1.5; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%234A6359' stroke-width='1.8'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }
.label { display: block; margin-bottom: .4rem; font-size: .82rem; font-weight: 600; color: #3D574D; }
.help { margin-top: .35rem; font-size: .78rem; color: #6B8077; }
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #CFD8D2; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: #0F7A5A; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid rgba(15, 122, 90, .35); outline-offset: 2px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .78rem 1.2rem; border-radius: 14px; border: 1.5px solid transparent;
  font-weight: 700; font-size: .94rem; line-height: 1.1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #0F7A5A; color: #fff; }
.btn-primary:hover { background: #0C6249; }
.btn-dark { background: #0E2A22; color: #fff; }
.btn-dark:hover { background: #1E3D33; }
.btn-sun { background: #F5B700; color: #0E2A22; }
.btn-sun:hover { background: #FBC42A; }
.btn-light { background: #fff; color: #0E2A22; border-color: #DDE3DA; }
.btn-light:hover { border-color: #A9B8B0; }
.btn-ghost { background: transparent; color: #0E2A22; }
.btn-ghost:hover { background: #EEF3EF; }
.btn-danger { background: #FDECEC; color: #A12727; }
.btn-danger:hover { background: #FAD9D9; }
.btn-sm { padding: .55rem .85rem; font-size: .84rem; border-radius: 11px; }
.btn-lg { padding: 1rem 1.5rem; font-size: 1rem; border-radius: 16px; }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cartes et étiquettes */
.card { background: #fff; border: 1px solid #E4EAE3; border-radius: 20px; }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .62rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; opacity: .75; }
.tone-green { background: #E3F5EC; color: #0B6B47; }
.tone-amber { background: #FFF2D2; color: #855600; }
.tone-red { background: #FDE7E7; color: #A12727; }
.tone-gray { background: #EEF1EE; color: #55675F; }
.tone-blue { background: #E5EEFC; color: #1F4E9E; }

/* Navigation */
.side-link { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border-radius: 12px; font-weight: 600; color: #4A6359; }
.side-link:hover { background: #EEF3EF; color: #0E2A22; }
.side-link.is-active { background: #E2F1E9; color: #0B5C44; }
.side-link .count { margin-left: auto; min-width: 1.35rem; padding: 0 .4rem; border-radius: 999px; background: #F5B700; color: #0E2A22; font-size: .72rem; font-weight: 800; text-align: center; line-height: 1.35rem; }
.admin-side .side-link { color: #A8BDB3; }
.admin-side .side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-side .side-link.is-active { background: rgba(245, 183, 0, .14); color: #FFD75A; }
.bottom-link { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: .45rem 0; font-size: .68rem; font-weight: 600; color: #6B8077; }
.bottom-link.is-active { color: #0F7A5A; }

/* Fenêtre modale centrée */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(14, 42, 34, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.modal {
  display: flex; flex-direction: column; width: 100%; max-width: 520px;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  background: #fff; border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(14, 42, 34, .5);
  transform: translateY(14px) scale(.98); transition: transform .22s cubic-bezier(.32, .72, 0, 1);
}
.modal.modal-lg { max-width: 720px; }
.modal-overlay.is-open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #EEF1EE; }
.modal-body { padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }

/* Notification flottante */
#toast { position: fixed; left: 50%; bottom: calc(6rem + env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%); transition: transform .25s, opacity .25s; pointer-events: none; }
@media (min-width: 1024px) { #toast { bottom: 1.5rem; } }
#toast.hide { transform: translate(-50%, 110px); opacity: 0; }
#toast .toast-inner { max-width: 88vw; padding: .72rem 1.1rem; border-radius: 16px; background: #0E2A22; color: #fff; font-size: .9rem; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
#toast.is-error .toast-inner { background: #A12727; }

/* Aperçus des modèles (iframe réduite) */
.frame-box { position: relative; overflow: hidden; background: #fff; }
.frame-box iframe { position: absolute; top: 0; left: 0; border: 0; pointer-events: none; transform-origin: 0 0; }
.frame-box.is-live iframe { pointer-events: auto; }
.phone { position: relative; width: 300px; height: 620px; padding: 12px; border-radius: 46px; background: #0E2A22; box-shadow: 0 40px 80px -30px rgba(14, 42, 34, .55), inset 0 0 0 2px #24463B; }
.phone .frame-box { width: 276px; height: 596px; border-radius: 35px; }
.phone::before { content: ""; position: absolute; top: 3px; left: 50%; z-index: 2; width: 56px; height: 5px; transform: translateX(-50%); border-radius: 999px; background: #2C5245; }

/* Éditeur */
.editor-section[open] > summary .chev { transform: rotate(180deg); }
.editor-section > summary { list-style: none; }
.editor-section > summary::-webkit-details-marker { display: none; }
.chev { transition: transform .2s; }
.repeater-item { border: 1px solid #E3E9E2; border-radius: 16px; background: #FBFCFA; }
.img-field { display: flex; align-items: center; gap: 12px; }
.img-thumb { position: relative; flex: none; width: 76px; height: 76px; overflow: hidden; border-radius: 14px; border: 1.5px dashed #C9D4CD; background: #F2F5F1 center/cover no-repeat; }
.img-thumb.has-image { border-style: solid; border-color: #DDE3DA; }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: #F5B700; }

/* Divers */
.prose-legal h2 { margin: 2rem 0 .6rem; font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.prose-legal p, .prose-legal li { margin: .55rem 0; color: #33493F; line-height: 1.7; }
.prose-legal ul { padding-left: 1.2rem; list-style: disc; }
.otp-input { letter-spacing: .5em; text-align: center; font-weight: 700; font-size: 1.6rem !important; }
.bar { display: flex; align-items: flex-end; gap: 4px; height: 72px; }
.bar span { flex: 1; min-height: 3px; border-radius: 4px 4px 2px 2px; background: #A8DCC6; }
.bar span.is-today { background: #0F7A5A; }
@media print { .no-print { display: none !important; } html.app-shell, html.app-shell body { position: static; overflow: visible; height: auto; } #app { display: block; height: auto; } .scroll-area { overflow: visible; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
