/* =========================================================
   OIMS — pages applicatives (auth, compte, admin)
   s'appuie sur les variables de style.css
   ========================================================= */
.app-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.app-header { border-bottom: 1px solid var(--border); background: rgba(7,10,20,.85); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50; padding: 10px 0; }
.app-header-inner { display: flex; align-items: center; justify-content: flex-start; gap: 16px; flex-wrap: wrap; }
.app-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.app-nav a { color: var(--muted); font-weight: 500; font-size: .92rem; }
.app-nav a:hover { color: var(--text); }
.app-nav a.btn { color: inherit; }
.app-id { color: var(--muted); font-size: .82rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav-site { color: var(--c-cyan) !important; }

/* Onglets de sections de l'espace pro (visibles en permanence) */
.app-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.app-tab { color: var(--muted); font-weight: 500; font-size: .9rem; padding: 6px 11px; border-radius: 8px; white-space: nowrap; }
.app-tab:hover { color: var(--text); background: rgba(255,255,255,.05); }
.app-tab.active { color: var(--text); background: rgba(255,255,255,.09); }

/* Groupe d'actions à droite de l'en-tête (créer, crédits, menu compte / admin / connexion) */
.app-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-left: auto; }
.app-actions > a { color: var(--muted); font-weight: 500; font-size: .92rem; }
.app-actions > a:hover { color: var(--text); }
.app-actions > a.btn { color: inherit; }

/* Menu « hamburger » mobile (CSS pur : la case à cocher pilote l'affichage, cf. media query) */
.nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.nav-burger { display: none; }

/* Menu déroulant « espace pro » (Compte pro · produits · devis · marques · étiquettes) */
.nav-menu { position: relative; }
.nav-menu > summary { list-style: none; cursor: pointer; color: var(--muted); font-weight: 500; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; user-select: none; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary::after { content: '▾'; font-size: .8em; opacity: .8; }
.nav-menu[open] > summary, .nav-menu > summary:hover { color: var(--text); }
.nav-dropdown { position: absolute; right: 0; top: calc(100% + 12px); min-width: 210px; z-index: 60; background: rgba(12,16,28,.98); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 16px 44px rgba(0,0,0,.55); display: flex; flex-direction: column; }
.nav-dropdown a { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.nav-dropdown a:hover { background: rgba(255,255,255,.06); color: var(--text); }
.nav-dropdown .sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* Les ancres de section ne passent pas sous le header collant */
.app-main [id] { scroll-margin-top: 90px; }

.app-main { flex: 1; padding: 48px 0 80px; }
.app-main-narrow .container { max-width: 460px; }
.app-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 20px 0; text-align: center; color: var(--faint); font-size: .82rem; }

/* Cartes & titres */
.app-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.app-h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 8px; }
.app-sub { color: var(--muted); margin-bottom: 24px; }

/* Formulaires */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-field label { font-size: .85rem; color: var(--muted); font-weight: 500; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(0,0,0,.25); border: 1.5px solid var(--border-2); color: var(--text);
  font-family: inherit; font-size: .95rem;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--c-cyan); box-shadow: 0 0 0 3px rgba(37,224,214,.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-check { display: flex; align-items: center; gap: 9px; margin: 4px 0 18px; font-size: .9rem; color: var(--muted); cursor: pointer; }
.form-check input { width: 16px; height: 16px; accent-color: var(--c-cyan); flex: none; }

/* Alertes */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 18px; border: 1px solid; }
.alert-error { background: rgba(240,57,139,.1); border-color: rgba(240,57,139,.4); color: #ffb3d1; }
.alert-ok    { background: rgba(37,224,214,.1); border-color: rgba(37,224,214,.35); color: #a9f3ec; }
.alert-warn  { background: rgba(255,138,61,.1); border-color: rgba(255,138,61,.4); color: #ffd0ab; }

/* Pills / badges de statut */
.pill { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: .74rem; font-weight: 700; }
.pill-ok   { background: rgba(37,224,214,.15); color: var(--c-cyan); }
.pill-warn { background: rgba(255,138,61,.15); color: var(--c-orange); }
.pill-ban  { background: rgba(240,57,139,.15); color: #f0398b; }
.pill-admin{ background: rgba(139,92,246,.18); color: #c4b5fd; }

/* Tables admin */
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; font-size: .9rem; border-top: 1px solid var(--border); }
.tbl thead th { background: var(--bg-3); font-family: 'Sora'; font-weight: 700; border-top: none; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.btn-sm { --pad-y: 7px; --pad-x: 13px; font-size: .82rem; }
.btn-danger { background: rgba(240,57,139,.15); color: #ff9ecb; border: 1px solid rgba(240,57,139,.4); }
.btn-danger:hover { background: rgba(240,57,139,.25); }
.btn-ok { background: rgba(37,224,214,.15); color: var(--c-cyan); border: 1px solid rgba(37,224,214,.4); }
.btn-ok:hover { background: rgba(37,224,214,.25); }

/* Stat cards (admin) */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .v { font-family: 'Sora'; font-size: 1.9rem; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-card .k { color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* Marques & galerie (compte) */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 16px; }
.brand-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.brand-logo {
  height: 90px; display: grid; place-items: center; border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; padding: 6px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d6d6db 25%, transparent 25%),
    linear-gradient(-45deg, #d6d6db 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d6d6db 75%),
    linear-gradient(-45deg, transparent 75%, #d6d6db 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-name { font-family: 'Sora'; font-weight: 700; margin-bottom: 8px; }

.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 16px; }
.gen-card { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gen-card img { width: 100%; aspect-ratio: 1024/1536; object-fit: cover; display: block; background: var(--bg-3); }
.gen-card figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: .82rem; }
.gen-card figcaption .muted { font-size: .76rem; }
.gen-card form { margin-top: 4px; }

/* Sous-nav admin */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.admin-nav a { padding: 8px 14px; border-radius: 100px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.admin-nav a:hover { color: var(--text); background: var(--surface); }
.admin-nav a.active { color: #05080f; background: var(--grad-primary); }

.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 8px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 28px; }
.chart-box h3 { font-size: .95rem; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
@media (max-width: 760px) { .chart-grid { grid-template-columns: 1fr; } }

.app-link { color: var(--c-cyan); font-weight: 600; }
.muted { color: var(--muted); }
.mt { margin-top: 20px; }

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .app-nav { gap: 10px; }
  /* En-tête pro : onglets + actions repliés derrière le bouton « ☰ Menu » */
  .app-header-pro .nav-burger { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; cursor: pointer; color: var(--text); font-weight: 600; font-size: .9rem; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; }
  .app-header-pro .app-tabs, .app-header-pro .app-actions { display: none; width: 100%; }
  .app-header-pro .nav-toggle:checked ~ .app-tabs,
  .app-header-pro .nav-toggle:checked ~ .app-actions { display: flex; }
  .app-header-pro .app-tabs { flex-direction: column; align-items: stretch; gap: 2px; margin-top: 10px; }
  .app-header-pro .app-tab { padding: 10px 12px; font-size: .95rem; }
  .app-header-pro .app-actions { flex-direction: column; align-items: stretch; gap: 10px; margin-left: 0; margin-top: 4px; }
  .app-header-pro .nav-menu { width: 100%; }
  .app-header-pro .nav-dropdown { position: static; box-shadow: none; margin-top: 6px; }
  .tbl { display: block; overflow-x: auto; }
}
