/* --------- RESET SIMPLE --------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #f4f6f9;
  color: #333;
}

/* ===== TOPBAR ===== */

.topbar {
    background: #1f2833;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.topbar-title {
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
}

/* NAVIGATION (liens du menu) */
.topbar-nav {
    display: flex;
    gap: 25px;
}

.topbar-nav .nav-link {
    color: #dfe6ee;
    text-decoration: none;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: 0.2s;
}

.topbar-nav .nav-link:hover {
    background: #3a4658;
    color: #ffffff;
}

/* Lien actif */
.topbar-nav .nav-link.active {
    background: #4da8da;
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 0 6px rgba(77,168,218,0.7);
}

/* Zone utilisateur */
.topbar-user {
    color: #f8f9fa;
    font-size: 14px;
}

.topbar-user a {
    color: #4da8da;
    margin-left: 10px;
    text-decoration: none;
}

.topbar-user a:hover {
    text-decoration: underline;
}

/* --------- LAYOUT DASHBOARD --------- */
.dashboard-container {
  max-width: 1200px;
  margin: 24px auto 40px;
  padding: 0 16px;
}

/* --------- ONGLET / TABS --------- */
.tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 20px;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  border: none;
  background: #e5e7eb;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 6px rgba(37,99,235,0.35);
}

.tab-btn:hover:not(.active) {
  background: #d1d5db;
}

/* --------- CARDS --------- */
.card-grid {
  display: grid;
  grid-template-columns: 2fr 1.4fr;
  gap: 20px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px 18px;
  box-shadow: 0 2px 6px rgba(15,23,42,0.12);
  margin-bottom: 20px;
}

.card h2,
.card h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

.card h3 {
  font-size: 16px;
  color: #4b5563;
}

/* --------- FORMULAIRES --------- */
form {
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

label {
  font-size: 13px;
  color: #4b5563;
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  min-width: 120px;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

button {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* --------- TABLEAUX --------- */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 14px;
}

th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: #f3f4f6;
  font-weight: 600;
  font-size: 13px;
  color: #4b5563;
}

tr:nth-child(even) td {
  background: #f9fafb;
}

/* Badges + statuts */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.badge-low {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-ok {
  background: #dcfce7;
  color: #166534;
}

.badge-status-attente {
  background: #fef3c7;
  color: #92400e;
}

.badge-status-payee {
  background: #dcfce7;
  color: #166534;
}

.badge-status-annulee {
  background: #fee2e2;
  color: #b91c1c;
}

/* Liens d'action */
.actions a {
  font-size: 12px;
  margin-right: 6px;
  text-decoration: none;
  color: #2563eb;
}

.actions a:hover {
  text-decoration: underline;
}

/* --------- CONTENU ONGLET --------- */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --------- LOGIN PAGE --------- */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1f2937 0, #020617 55%, #111827 100%);
}

.login-card {
  background: #111827;
  padding: 24px 26px 20px;
  border-radius: 14px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  color: #e5e7eb;
}

.login-card h1 {
  font-size: 20px;
  margin-bottom: 4px;
}

.login-card p {
  font-size: 13px;
  margin-bottom: 16px;
  color: #9ca3af;
}

.login-card label {
  color: #d1d5db;
}

.login-card input {
  width: 100%;
}

.login-card button {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 8px;
}

/* ===== FILTRES PARFUMS (Tous / Femmes / Hommes / Nouveaux / Désactivés) ===== */

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;        /* effet pill */
    border: 1px solid #4da8da;
    background: #ffffff;
    font-size: 14px;
    color: #1f2833;
    text-decoration: none;
    transition: 0.2s ease;
}

.filter-btn:hover {
    background: #e8f4fb;
    color: #0b3045;
}

.filter-btn.active {
    background: #4da8da;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 0 6px rgba(77,168,218,0.6);
    border-color: #4da8da;
}

/* ===== Actions tableau parfums ===== */

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-actions form {
    margin: 0;
}

/* Boutons réutilisables */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: 0.2s ease;
}

.btn-xs {
    padding: 3px 10px;
    font-size: 12px;
}

.btn-primary {
    background: #2f80ed;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1b62c5;
}

.btn-outline {
    background: #ffffff;
    border: 1px solid #2f80ed;
    color: #1f2833;
}

.btn-outline:hover {
    background: #e8f2ff;
}

/* Champ de stock compact */

.stock-input {
    width: 70px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #ccd3dd;
    font-size: 13px;
}

/* ---------- RESPONSIVE ---------- */

/* 1) Jusqu'à 900px : une seule colonne pour les cartes */
@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* 2) Jusqu'à 768px : topbar plus souple + marges réduites */
@media (max-width: 768px) {
  .dashboard-container {
    margin: 16px auto 28px;
    padding: 0 12px;
  }

  .topbar {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-title {
    font-size: 18px;
  }

  .topbar-nav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-nav .nav-link {
    font-size: 14px;
    padding: 6px 10px;
  }

  .topbar-user {
    font-size: 12px;
  }

  .card {
    padding: 14px 14px 16px;
  }
}

/* 3) Jusqu'à 640px : mobile (téléphone) */
@media (max-width: 640px) {
  /* Topbar en colonne */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .topbar-nav .nav-link {
    white-space: nowrap;
  }

  .topbar-user {
    align-self: stretch;
    text-align: left;
    margin-top: 4px;
  }

  /* Formulaires en colonne */
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row label {
    font-size: 12px;
  }

  .form-row input[type="text"],
  .form-row input[type="number"],
  .form-row input[type="password"],
  .form-row select {
    width: 100%;
    min-width: 0;
  }

  .form-row button {
    width: 100%;
  }

  /* Tableaux plus compacts */
  table {
    font-size: 12px;
  }

  th, td {
    padding: 6px 6px;
  }

  .badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .table-actions {
    flex-wrap: wrap;
  }

  .btn,
  .btn-xs {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Filtres parfums en colonne */
  .filter-buttons {
    flex-direction: column;
  }

  .filter-btn {
    width: 100%;
    text-align: center;
  }

  .login-card {
    margin: 0 12px;
  }
}

/* 4) Très petits écrans (≤ 480px) */
@media (max-width: 480px) {
  .tabs {
    gap: 6px;
  }

  .tab-btn {
    flex: 1 1 100%;
    text-align: center;
    font-size: 13px;
    padding: 8px 10px;
  }

  .topbar-title {
    font-size: 17px;
  }

  .dashboard-container {
    padding: 0 10px;
  }
}