/* Importation des polices Google Fonts (Sans-Serif) */
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* ====== RESET GLOBAL ====== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ====== Variables globales ====== */
:root {
  --color-primary: #4b3cc4;
  --color-secondary: #f4f2ff;
  --color-accent: #d2b4ff;
  --color-success: #28c76f;
  --color-danger: #ea5455;
  --sidebar-bg: linear-gradient(135deg, #1f1c2c, #4b3cc4);
  --sidebar-width: 250px;
}

/* ====== Styles admin-panel ====== */
body.admin-panel {
  font-family: 'Inter', sans-serif;
  background: #f9fafc;
  display: flex;
  min-height: 100vh;
}

/* ==================== Sidebar ==================== */
body.admin-panel .sidebar {
  background: var(--sidebar-bg);
  height: 100vh;
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  box-shadow: 3px 0 15px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: left 0.3s ease;
}

body.admin-panel .sidebar .text-center h4 {
  font-weight: bold;
  color: #fff;
}

body.admin-panel .sidebar a {
  color: rgba(255, 255, 255, 0.9);
  padding: 12px 20px;
  display: block;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s;
}

body.admin-panel .sidebar a:hover,
body.admin-panel .sidebar a.active {
  background-color: rgba(255,255,255,0.15);
  color: #fff;
  transform: translateX(3px);
}

/* ==================== Main content ==================== */
body.admin-panel .main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
  transition: margin-left 0.3s;
}

/* Neutraliser padding Bootstrap container-fluid sur main-content */
.container-fluid {
  max-width: 1400px; /* ou une autre valeur */
  margin-left: auto;
  margin-right: auto;
}

body.admin-panel .main-content.container-fluid {
  padding-left: 0 !important;
  padding-right: 0 !important;
  max-width: 100% !important;
}

/* Responsive sidebar & main content */
@media (max-width: 767.98px) {
  body.admin-panel .sidebar {
    left: -100%;
  }

  body.admin-panel .sidebar.show {
    left: 0;
  }

  body.admin-panel .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* ==================== Header ==================== */
body.admin-panel header {
  background: white;
  border-bottom: 1px solid #e5e5e5;
  padding: 15px 20px;
}

body.admin-panel header h1 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-primary);
}

/* ==================== Boutons ==================== */
body.admin-panel .btn {
  border-radius: 30px;
  transition: all 0.3s ease;
}

body.admin-panel .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

body.admin-panel .btn-primary {
  background: var(--color-primary);
  border: none;
}

body.admin-panel .btn-primary:hover {
  background: #3a2fa0;
}

body.admin-panel .btn-outline-primary {
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
}

body.admin-panel .btn-outline-primary:hover {
  background: var(--color-primary);
  color: white;
}

body.admin-panel .btn-outline-danger {
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

body.admin-panel .btn-outline-danger:hover {
  background: var(--color-danger);
  color: white;
}

/* ==================== Cartes (ajusté pour brands) ==================== */
body.admin-panel .card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  overflow: hidden;
  transition: all 0.3s ease;
  height: auto;
  min-height: 300px;
  max-height: 400px;
}

body.admin-panel .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

body.admin-panel .card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #444;
}

/* Ajustement spécifique pour les cartes des brands avec flexbox */
body.admin-panel .brand-list-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 1.5rem;
}

body.admin-panel .brand-list-container .card {
  flex: 0 0 80% !important;
  max-width: 80% !important;
}

/* Ajustement du corps de la carte pour un padding fixe */
body.admin-panel .card-body {
  padding: 1.25rem !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

/* ==================== Cartes des parfums ==================== */
body.admin-panel .parfums-grid-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 1.5rem;
  padding: 0 15px;
}

body.admin-panel .parfums-grid-container .parfum-card {
  flex: 0 0 80% !important; /* Même principe que brands, 80% pour une largeur fixe */
  max-width: 80% !important;
  aspect-ratio: 1 / 1; /* Cartes carrées */
  min-height: 300px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

body.admin-panel .parfum-card-image {
  height: 60%;
  overflow: hidden;
  width: 100%;
  flex-shrink: 0;
}

body.admin-panel .parfum-card-image img {
  width: 50%;
  height: 50%;
  object-fit: cover;
  max-height: 125px;
}

body.admin-panel .parfum-card-image.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  height: 100%;
  color: #6c757d;
}

body.admin-panel .parfum-card-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

body.admin-panel .parfum-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.5rem;
}

body.admin-panel .parfum-card-availability {
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

body.admin-panel .parfum-card-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

body.admin-panel .action-button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 20px;
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

body.admin-panel .action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==================== Responsive Images (ajusté pour brands et parfums) ==================== */
body.admin-panel img {
  max-width: 100%;
  height: auto;
}

/* Ajustement spécifique pour les images dans les cartes des brands */
body.admin-panel #brands_container img {
  max-height: 200px;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==================== Sidebar Responsive - Important pour la fermeture sur mobile ==================== */
@media (max-width: 767.98px) {
  body.admin-panel .sidebar {
    left: -100%;
  }

  body.admin-panel .sidebar.show {
    left: 0;
  }

  /* Ajustement responsive pour les cartes des parfums */
  body.admin-panel .parfums-grid-container .parfum-card {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    aspect-ratio: auto;
  }

  /* Ajustement responsive pour les cartes des brands */
  body.admin-panel .brand-list-container .card {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* Sidebar close button (mobile) */
.sidebar .btn-close {
  filter: invert(1);
}

/* Empêche débordement vertical du contenu */
body.admin-panel main {
  overflow-y: auto;
}

/* ==================== Cartes des parfums (show) ==================== */
body.admin-panel .card {
  overflow: visible;
}

body.admin-panel .card .row {
  align-items: flex-start;
}

body.admin-panel .card .d-flex {
  flex-wrap: nowrap;
  width: 100%;
}

body.admin-panel .card .me-2 {
  flex-shrink: 0;
  max-width: 300px;
  margin-right: 0.5rem !important;
}

body.admin-panel .card .ps-2 {
  padding-left: 0.5rem !important;
  flex-grow: 1;
}

body.admin-panel .card .card-body {
  padding: 2rem;
}


/* Surcharge des styles SweetAlert2 pour enlever le backdrop et garder le carreau blanc */
body.admin-panel .swal2-container {
  --swal2-backdrop: transparent !important; /* Supprime le fond sombre */
  background: none !important; /* Assure qu'aucun fond n'est appliqué */
  max-width: 90vw !important; /* Garde la largeur limitée */
  margin: 0 auto;
}

body.admin-panel .swal2-popup {
  width: var(--swal2-width) !important;
  padding: 1em !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white !important; /* Assure que le carreau reste blanc */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important; /* Optionnel : ajoute une ombre légère pour le détacher */
}

body.admin-panel .swal2-icon {
  width: 3em !important;
  height: 3em !important;
  margin: 1em auto 0.5em !important;
  font-size: 2em !important;
}

body.admin-panel .swal2-warning {
  border-color: #f8bb86 !important;
  background-color: #f8bb86 !important;
}

body.admin-panel .swal2-icon-show {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Styles pour l'image du logo de la marque dans brands/show */
body.admin-panel .card-img-top.brand-logo-img {
  max-width: 250px !important; /* Limite la largeur maximale */
  max-height: 150px !important; /* Limite la hauteur maximale */
  width: auto !important; /* Permet une mise à l'échelle proportionnelle */
  height: auto !important;
  margin: 0 auto; /* Centre l'image horizontalement */
  object-fit: contain !important; /* Privilégie le maintien des proportions */
}

/* Applique la classe spécifique à l'image dans brands/show */
body.admin-panel #brand-show .card .card-img-top {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

/* Styles pour les images des parfums dans brands/show */
body.admin-panel #brand-show .card .parfum-image {
  max-width: 200px !important; /* Limite la largeur maximale */
  max-height: 150px !important; /* Ajuste la hauteur maximale */
  width: auto !important; /* Permet une mise à l'échelle proportionnelle */
  height: auto !important; /* Maintient les proportions */
  object-fit: contain !important; /* Affiche l'image entière */
  object-position: center !important; /* Centre l'image */
  margin: 0 auto !important; /* Centre horizontalement */
  display: block !important; /* Assure un comportement standard */
}

/* Supprime les styles conflictuels précédents */
body.admin-panel #brand-show .card .parfum-image {
  display: flex !important; /* Supprime cette règle erronée */
  flex-direction: column !important; /* Supprime cette règle erronée */
  width: 100% !important; /* Supprime cette règle pour éviter l'étirement */
  flex-shrink: 0 !important; /* Supprime cette règle */
}

/* Style spécifique pour le logo du brand dans brands/show */
.brand-logo {
  max-width: 250px !important;
  max-height: 150px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
  margin: 0 auto !important; /* Centre l'image */
}

/* Annule les styles Bootstrap pour cette image */
.brand-logo.card-img-top {
  width: auto !important;
}