/* ===== STYLE.CSS — Pythadri PWA ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #FF5E00;
  --orange-light: #FFF0E6;
  --orange-dark: #CC4A00;
  --teal: #3DB8D5;
  --teal-light: #E3F6FB;
  --teal-dark: #0A7A9E;
  --purple-light: #F0EEFF;
  --purple-dark: #5B3DB8;
  --green: #0F6E56;
  --green-light: #E1F5EE;
  --red: #993C1D;
  --red-light: #FAECE7;
  --amber-light: #FAEEDA;
  --amber-dark: #854F0B;
  --gray: #5F5E5A;
  --gray-light: #F1EFE8;

  --bg: #ffffff;
  --bg2: #f5f4f0;
  --bg3: #efefed;
  --text: #1a1a1a;
  --text2: #666560;
  --text3: #999894;
  --border: rgba(0,0,0,0.12);
  --border2: rgba(0,0,0,0.22);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --bg2: #2c2c2e;
    --bg3: #3a3a3c;
    --text: #f2f2f7;
    --text2: #aeaeb2;
    --text3: #636366;
    --border: rgba(255,255,255,0.12);
    --border2: rgba(255,255,255,0.22);
    --orange-light: #3d1a00;
    --teal-light: #002f38;
    --purple-light: #1a0f35;
    --green-light: #0a2018;
    --red-light: #2a0f08;
    --amber-light: #2a1800;
    --gray-light: #2c2c2a;
  }
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg2); color: var(--text); font-size: 16px; line-height: 1.5; }

/* ===== Layout ===== */
.app-shell { max-width: 480px; margin: 0 auto; background: var(--bg); min-height: 100dvh; display: flex; flex-direction: column; position: relative; }

.screen { display: none; flex-direction: column; min-height: 100dvh; }
.screen.active { display: flex; }

.screen-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom, 16px); }
.screen-content::-webkit-scrollbar { width: 0; }

/* ===== Status Bar ===== */
/* ===== Logo Bar ===== */
.logo-bar { background: var(--orange); padding: 8px 16px 12px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-bar img { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; }
.logo-bar .app-name { color: white; font-size: 18px; font-weight: 600; letter-spacing: 0.3px; }
.logo-bar .tagline { color: rgba(255,255,255,0.8); font-size: 11px; }
.logo-actions { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.logo-actions button { background: rgba(255,255,255,0.2); border: none; color: white; font-size: 17px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.logo-actions button:active { background: rgba(255,255,255,0.35); }

/* ===== Page Header (sub-screens) ===== */
.page-header { background: var(--orange); padding: 10px 16px 14px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.page-header .back-icon { background: rgba(255,255,255,0.2); border: none; color: white; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.page-header .page-title { color: white; font-size: 15px; font-weight: 600; }

.page-header-dark { background: #1a1a2e; }
.page-header-dark .subtitle { color: rgba(255,255,255,0.55); font-size: 11px; }
.page-header-dark .page-title { color: white; }

/* ===== Bottom Nav ===== */
.bottom-nav { background: var(--bg); border-top: 0.5px solid var(--border); display: flex; padding: 8px 0 calc(6px + env(safe-area-inset-bottom, 0px)); flex-shrink: 0; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; padding: 4px 0; border-radius: var(--r-sm); transition: opacity 0.15s; }
.nav-item:active { opacity: 0.7; }
.nav-item .nav-icon { font-size: 20px; }
.nav-item .nav-label { font-size: 10px; color: var(--text2); }
.nav-item.active .nav-label { color: var(--orange); font-weight: 500; }

/* ===== Buttons ===== */
.btn-orange { background: var(--orange); color: white; border: none; border-radius: var(--r-sm); padding: 12px 20px; font-size: 14px; font-weight: 600; cursor: pointer; width: 100%; transition: opacity 0.15s; }
.btn-orange:active { opacity: 0.85; }
.btn-outline { background: transparent; color: var(--orange); border: 1.5px solid var(--orange); border-radius: var(--r-sm); padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer; width: 100%; transition: background 0.15s; }
.btn-outline:active { background: var(--orange-light); }
.btn-whatsapp { background: #25D366; color: white; border: none; border-radius: var(--r-sm); padding: 12px 14px; font-size: 13px; font-weight: 600; cursor: pointer; flex: 1; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 4px; }
.btn-republish { background: var(--orange-light); color: var(--orange-dark); border: 1px solid var(--orange); border-radius: var(--r-sm); padding: 8px 14px; font-size: 12px; font-weight: 500; cursor: pointer; width: 100%; margin-top: 8px; }

/* ===== Forms ===== */
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 0.5px solid var(--border2);
  border-radius: var(--r-sm); font-size: 14px; background: var(--bg2);
  color: var(--text); margin-bottom: 10px; font-family: inherit;
  appearance: none; -webkit-appearance: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); }
textarea { resize: none; }
label.form-label { font-size: 12px; color: var(--text2); margin-bottom: 4px; display: block; }

/* ===== Filters ===== */
.filters-block { padding: 10px 12px 8px; background: var(--bg); border-bottom: 0.5px solid var(--border); flex-shrink: 0; }
.filters-row { display: flex; gap: 8px; margin-bottom: 8px; }
.filters-row:last-child { margin-bottom: 0; }
.filters-row select { margin: 0; flex: 1; font-size: 12px; padding: 8px 10px; }

.filter-chips { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; background: var(--bg); border-bottom: 0.5px solid var(--border); flex-shrink: 0; }
.filter-chips::-webkit-scrollbar { height: 0; }
.filter-chip { background: var(--bg2); border: 0.5px solid var(--border); border-radius: 20px; padding: 5px 13px; font-size: 12px; white-space: nowrap; cursor: pointer; color: var(--text2); transition: background 0.15s; flex-shrink: 0; }
.filter-chip.active { background: var(--orange); color: white; border-color: var(--orange); }

/* ===== Section Title ===== */
.section-title { font-size: 11px; font-weight: 600; color: var(--text2); padding: 12px 12px 4px; text-transform: uppercase; letter-spacing: 0.6px; }

/* ===== Book Card ===== */
.book-card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--r-md); margin: 8px 12px; overflow: hidden; cursor: pointer; transition: transform 0.12s; }
.book-card:active { transform: scale(0.98); }
.book-card-inner { display: flex; }
.book-thumb { width: 88px; min-height: 108px; background: var(--bg2); display: flex; align-items: center; justify-content: center; font-size: 34px; flex-shrink: 0; border-right: 0.5px solid var(--border); }
.book-info { padding: 10px; flex: 1; min-width: 0; }
.book-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-meta { font-size: 11px; color: var(--text2); margin-bottom: 4px; }
.book-price { font-size: 15px; font-weight: 700; color: var(--orange); margin-bottom: 5px; }
.book-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.book-footer { border-top: 0.5px solid var(--border); padding: 7px 10px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text2); }

.tag { font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 500; }
.tag-level { background: var(--orange-light); color: var(--orange-dark); }
.tag-cat   { background: var(--teal-light);   color: var(--teal-dark); }

.badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.badge-premium { background: var(--teal-light);   color: var(--teal-dark); }
.badge-pro     { background: var(--purple-light);  color: var(--purple-dark); }
.badge-basic   { background: var(--gray-light);    color: var(--gray); }

/* ===== Plan Card ===== */
.plan-card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--r-md); margin: 6px 12px; padding: 14px; }
.plan-card.featured { border: 2px solid var(--teal); }
.plan-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.plan-price { font-size: 22px; font-weight: 700; color: var(--orange); }
.plan-price span { font-size: 13px; font-weight: 400; color: var(--text2); }
.plan-features { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.plan-feat { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 7px; }
.plan-feat::before { content: "✓"; color: var(--teal); font-weight: 700; flex-shrink: 0; }

/* ===== Stat Card ===== */
.stat-row { display: flex; gap: 8px; padding: 10px 12px; }
.stat-card { background: var(--bg2); border-radius: var(--r-sm); padding: 12px; flex: 1; min-width: 0; }
.stat-card.grid2 { }
.stat-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; }
.stat-val { font-size: 20px; font-weight: 700; color: var(--text); }
.stat-val.sm { font-size: 14px; }

/* ===== Admin Row ===== */
.admin-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; border-bottom: 0.5px solid var(--border); }
.admin-label { font-size: 13px; color: var(--text); font-weight: 500; }
.admin-sub   { font-size: 11px; color: var(--text2); margin-top: 2px; }
.admin-val   { font-size: 13px; color: var(--text2); }

.status-active  { color: var(--green);    background: var(--green-light);  border-radius: 10px; padding: 2px 9px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.status-expired { color: var(--red);      background: var(--red-light);    border-radius: 10px; padding: 2px 9px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.status-pending { color: var(--amber-dark); background: var(--amber-light); border-radius: 10px; padding: 2px 9px; font-size: 11px; font-weight: 500; white-space: nowrap; }

/* ===== Dashboard expired card ===== */
.expired-card { background: var(--bg2); border-radius: var(--r-sm); margin: 6px 12px; padding: 10px 12px; }
.expired-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2px; }

/* ===== Tabs ===== */
.tab-bar { display: flex; border-bottom: 0.5px solid var(--border); background: var(--bg); flex-shrink: 0; }
.tab-item { flex: 1; padding: 11px 4px; text-align: center; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.15s; }
.tab-item.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ===== Detail ===== */
.annonce-detail-header { background: var(--orange); height: 180px; display: flex; align-items: center; justify-content: center; font-size: 52px; position: relative; flex-shrink: 0; }
.back-btn { position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,0.22); border: none; color: white; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.detail-body { padding: 14px 16px 24px; }
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 8px; }
.detail-title { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
.detail-price { font-size: 24px; font-weight: 800; color: var(--orange); margin-bottom: 10px; }
.detail-desc { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 14px; }
.info-box { background: var(--bg2); border-radius: var(--r-sm); padding: 10px 13px; margin-bottom: 16px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 12px; }
.info-row span { color: var(--text2); }
.info-row strong { color: var(--text); font-weight: 500; }
.detail-actions { display: flex; gap: 10px; }
.detail-actions .btn-orange { flex: 1; }

/* ===== Messages ===== */
.msg-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.msg-bubble-me   { background: var(--orange); color: white; border-radius: 16px 16px 4px 16px; padding: 9px 13px; font-size: 13px; max-width: 72%; align-self: flex-end; }
.msg-bubble-them { background: var(--bg2); color: var(--text); border-radius: 16px 16px 16px 4px; padding: 9px 13px; font-size: 13px; max-width: 72%; align-self: flex-start; }
.msg-time      { font-size: 10px; color: rgba(255,255,255,0.7); text-align: right; margin-top: 2px; }
.msg-time-them { font-size: 10px; color: var(--text2); margin-top: 2px; }
.msg-input-bar { padding: 10px 12px; border-top: 0.5px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }
.msg-input-bar input { margin: 0; flex: 1; }
.msg-send { background: var(--orange); border: none; color: white; border-radius: var(--r-sm); padding: 0 14px; font-size: 18px; cursor: pointer; flex-shrink: 0; }

/* ===== Login / Register ===== */
.auth-wrap { padding: 28px 24px 24px; flex: 1; overflow-y: auto; }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-logo img { width: 46px; height: 46px; border-radius: 10px; object-fit: contain; }
.auth-logo .brand { font-size: 22px; font-weight: 700; color: var(--text); }
.auth-logo .sub { font-size: 12px; color: var(--text2); }
.auth-link { font-size: 12px; color: var(--orange); cursor: pointer; }
.auth-separator { margin: 14px 0; text-align: center; font-size: 12px; color: var(--text2); }
.admin-note { margin-top: 20px; padding: 12px; background: var(--orange-light); border-radius: var(--r-sm); font-size: 12px; color: var(--orange-dark); }
.admin-note strong { font-weight: 600; display: block; margin-bottom: 3px; }

/* ===== Payment badges ===== */
.pay-row { display: flex; gap: 10px; margin-top: 10px; }
.pay-badge { flex: 1; background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--r-sm); padding: 8px; text-align: center; font-size: 12px; color: var(--text2); font-weight: 500; }

/* ===== Photo upload ===== */
.photo-slots { display: flex; gap: 8px; margin-bottom: 14px; }
.photo-slot { width: 82px; height: 82px; border: 1.5px dashed var(--border2); border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer; color: var(--text2); }

/* ===== Profile avatar ===== */
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--orange-light); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: var(--orange); flex-shrink: 0; }

/* ===== Publish banner ===== */
.pub-banner { background: var(--orange-light); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px; font-size: 12px; color: var(--orange-dark); line-height: 1.5; }
.pub-banner strong { font-weight: 600; }

/* ===== Toast ===== */
#toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1a1a1a; color: white; padding: 10px 20px; border-radius: 20px; font-size: 13px; font-weight: 500; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; z-index: 9999; white-space: nowrap; max-width: 90vw; text-overflow: ellipsis; overflow: hidden; }
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Divider ===== */
hr.divider { border: none; border-top: 0.5px solid var(--border); margin: 12px 0; }

/* ===== No result ===== */
.no-result { padding: 32px 16px; text-align: center; color: var(--text2); font-size: 13px; }

/* ===== Helpers ===== */
.p-12 { padding: 12px; }
.mt-8 { margin-top: 8px; }
.mb-0 { margin-bottom: 0 !important; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 10px 12px; }
.flex-gap { display: flex; gap: 8px; }

@media (min-width: 481px) {
  .app-shell { box-shadow: 0 0 40px rgba(0,0,0,0.12); border-radius: 24px; margin-top: 24px; min-height: calc(100dvh - 48px); }
  body { background: var(--bg3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* 4 onglets admin */
#screen-admin .tab-item { font-size: 11px; padding: 10px 6px; }

/* Filtres boutons style select */
.filter-btn-wrap { position: relative; display: inline-flex; }
.filter-btn-select {
  appearance: none; -webkit-appearance: none;
  background: var(--bg);
  border: 1.5px solid var(--border2);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin: 0;
  white-space: nowrap;
  background-image: none;
}
.filter-btn-select:focus { outline: none; border-color: var(--orange); }
.filter-btn-select.active { background-color: var(--orange); color: white; border-color: var(--orange);
}

/* Bottom nav fixe */
.bottom-nav { position: sticky; bottom: 0; left: 0; width: 100%; z-index: 400; }

/* Pagination */
.pag-btn {
  min-width: 34px; height: 34px; border-radius: 8px;
  border: 0.5px solid var(--border2);
  background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0 8px;
  transition: background .12s;
}
.pag-btn:active { opacity: .8; }
.pag-btn.active { background: var(--orange); color: white; border-color: var(--orange); }
.pag-btn:disabled { opacity: .35; cursor: default; }

/* Scroll top button */
#btn-scroll-top { display: none; }
#btn-scroll-top.visible { display: flex !important; }
