@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800&display=swap');

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

:root {
  --gold: #E8A020;
  --gold-dark: #C47A15;
  --gold-deep: #8B5E0A;
  --cream: #FFFBF0;
  --cream-dark: #FFF3D0;
  --border: #E8C060;
  --text: #3A2A00;
  --muted: #8B6A20;
  --green: #4A7C59;
  --red: #C84A20;
  --white: #ffffff;
}

body {
  background: var(--cream);
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  min-height: 100vh;
  padding-top: 120px;
  padding-bottom: 0;
}

/* ============================================
   HEADER + NAV UNIFIÉS
============================================ */
.ap-header-full {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--gold);
  box-shadow: 0 2px 12px rgba(184,120,0,0.2);
}

.ap-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 8px;
}

.ap-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-logo-icon { font-size: 24px; }

.ap-logo {
  font-size: 20px;
  font-weight: 800;
  color: white;
  line-height: 1.1;
}

.ap-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

.ap-logout {
  font-size: 12px;
  color: var(--gold-deep);
  text-decoration: none;
  background: rgba(255,255,255,0.5);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  transition: background 0.2s;
  white-space: nowrap;
}
.ap-logout:hover { background: rgba(255,255,255,0.8); }

.ap-nav {
  display: flex;
  justify-content: space-around;
  background: rgba(0,0,0,0.08);
  border-top: 1px solid rgba(255,255,255,0.2);
  padding: 4px 0;
}

.ap-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.ap-nav-item:hover { background: rgba(255,255,255,0.15); }
.ap-nav-item.active { background: rgba(255,255,255,0.25); }

.ap-nav-icon { font-size: 26px; line-height: 1; }

.ap-nav-label {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
}

.ap-nav-item.active .ap-nav-label { color: white; }
.ap-nav-item.active .ap-nav-icon  { transform: scale(1.1); }

/* ============================================
   CONTENU
============================================ */
.ap-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ============================================
   ALERTE STOCK FAIBLE
============================================ */
.ap-alert-banner {
  background: #FFF3E0;
  border: 2px solid var(--red);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 20px;
  text-align: center;
}

/* ============================================
   GRILLE MODULES
============================================ */
.ap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.ap-module-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 28px 16px;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: all 0.2s;
}

.ap-module-card:hover {
  border-color: var(--gold);
  background: var(--cream-dark);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(232,160,32,0.2);
}

.ap-module-icon { font-size: 40px; margin-bottom: 10px; }

.ap-module-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-deep);
  margin-bottom: 4px;
}

.ap-module-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================
   BOUTON ADMIN
============================================ */
.ap-admin-btn {
  display: block;
  text-align: center;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
}
.ap-admin-btn:hover { border-color: var(--gold); color: var(--gold-deep); }

/* ============================================
   BOUTONS GÉNÉRAUX
============================================ */
.btn-primary {
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  display: block;
  text-align: center;
  text-decoration: none;
}
.btn-primary:hover { background: var(--gold-dark); }

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 24px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 10px;
}
.btn-secondary:hover { border-color: var(--gold); color: var(--gold-deep); }

/* ============================================
   CARDS GÉNÉRALES
============================================ */
.ap-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.ap-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

/* ============================================
   PAGE TITLE
============================================ */
.ap-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.ap-back {
  font-size: 20px;
  text-decoration: none;
  color: var(--gold-dark);
}

.ap-page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold-deep);
}

/* ============================================
   FORMULAIRES
============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-deep);
}

input, select, textarea {
  background: var(--cream);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}

/* ============================================
   LISTES
============================================ */
.ap-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--cream-dark);
}

.ap-list-item:last-child { border-bottom: none; }

.ap-list-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.ap-list-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.ap-badge {
  background: var(--cream-dark);
  color: var(--gold-dark);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
}

.ap-badge-alert {
  background: #FFF3E0;
  color: var(--red);
  border-color: var(--red);
}

/* ============================================
   LIEN STOCK / BILAN
============================================ */
.stock-link {
  display: inline-block;
  margin-bottom: 20px;
  background: var(--cream-dark);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-deep);
  text-decoration: none;
  transition: all 0.2s;
}
.stock-link:hover { border-color: var(--gold); background: var(--cream); }

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 400px) {
  .ap-grid { grid-template-columns: 1fr; }
  .ap-module-card { padding: 20px; }
}

/* ============================================
   HOME — grille pleine page
============================================ */
.ap-wrap--home {
  max-width: 100%;
  margin: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.ap-wrap--home .ap-grid {
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.ap-wrap--home .ap-module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 150px;
}

.ap-wrap--home .ap-module-icon { font-size: 3rem; }
.ap-wrap--home .ap-module-title { font-size: 1.1rem; }

@media (max-width: 599px) {
  .ap-wrap--home {
    height: calc(100vh - 90px);
  }
  .ap-wrap--home .ap-grid { flex: 1; }
  .ap-wrap--home .ap-module-card { height: 100%; min-height: unset; }
}

/* ============================================
   PRINT
============================================ */
@media print {
  .no-print { display: none !important; }
  body { padding-top: 0; background: white; }
}

/* ============================================
   HEADER HELP
============================================ */
.ap-guide {
  font-size: 12px;
  color: white;
  text-decoration: none;
  background: rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  transition: background 0.2s;
  margin-right: 6px;
}
.ap-guide:hover { background: rgba(255,255,255,0.35); }