
/* ==========================================================================
   VARIABLES GLOBALES - NOUVELLE IDENTITÉ VISUELLE
   ========================================================================== */

:root {
  --color-primary: #3282b3;
  --color-secondary: #171717;
  --color-white: #ffffff;
  --color-black: #000000;

  /* Couleurs principales */
  --color-navy: #3282b3;
  --color-blue: #3282b3;
  --color-blue-rgb: 50, 130, 179;
  --color-blue-hover: #276a94;

  /* Couleur rose : pertes et éléments danger */
  --color-grenat: #ff007b;
  --color-grenat-rgb: 255, 0, 123;
  --color-grenat-hover: #d90068;

  /* Bleu clair : capital */
  --color-gold: #8fc9f5;
  --color-gold-rgb: 143, 201, 245;
}

/* ==========================================================================
   UTILITAIRES BOOTSTRAP
   ========================================================================== */

.text-success {
  color: var(--color-blue) !important;
}

.bg-success {
  background-color: var(--color-blue) !important;
}

.border-success {
  border-color: var(--color-blue) !important;
}

.text-danger {
  color: var(--color-grenat) !important;
}

.bg-danger {
  background-color: var(--color-grenat) !important;
}

.border-danger {
  border-color: var(--color-grenat) !important;
}

/* Boutons succès */
.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--color-blue);
  --bs-btn-border-color: var(--color-blue);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--color-blue-hover);
  --bs-btn-hover-border-color: var(--color-blue-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--color-blue-hover);
  --bs-btn-active-border-color: var(--color-blue-hover);
  --bs-btn-focus-shadow-rgb: var(--color-blue-rgb);
  --bs-btn-disabled-bg: var(--color-blue);
  --bs-btn-disabled-border-color: var(--color-blue);
}

/* Boutons danger */
.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--color-grenat);
  --bs-btn-border-color: var(--color-grenat);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--color-grenat-hover);
  --bs-btn-hover-border-color: var(--color-grenat-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--color-grenat-hover);
  --bs-btn-active-border-color: var(--color-grenat-hover);
  --bs-btn-focus-shadow-rgb: var(--color-grenat-rgb);
  --bs-btn-disabled-bg: var(--color-grenat);
  --bs-btn-disabled-border-color: var(--color-grenat);
}

/* Alertes */
.alert-success {
  --bs-alert-color: #174b6b;
  --bs-alert-bg: rgba(var(--color-blue-rgb), 0.12);
  --bs-alert-border-color: rgba(var(--color-blue-rgb), 0.35);
}

.alert-danger {
  --bs-alert-color: #8a0042;
  --bs-alert-bg: rgba(var(--color-grenat-rgb), 0.12);
  --bs-alert-border-color: rgba(var(--color-grenat-rgb), 0.35);
}

html.theme-dark .alert-success {
  --bs-alert-color: #8fc9f5;
}

html.theme-dark .alert-danger {
  --bs-alert-color: #ff80b9;
}

.light {
  color: var(--color-secondary);
}

.dark {
  color: var(--color-primary);
}

/* ==========================================================================
   FORMULAIRES
   ========================================================================== */

.form-card-body {
  width: 50%;
}

@media (max-width: 992px) {
  .form-card-body {
    width: 80%;
  }
}

@media (max-width: 768px) {
  .form-card-body {
    width: 100%;
  }
}

.logocontainer {
  width: 100%;
  height: 30%;
}

.logo {
  width: 100%;
}

.hidden {
  width: 49%;
  overflow: hidden;
}

/* ==========================================================================
   BADGES DE TYPE DE COMPTE
   Classique = Bronze / Turbo = Argent / Premium = Or
   ========================================================================== */

.class-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 13px;
}

/* Classique - Bronze */
.class-simple {
  background: linear-gradient(
    135deg,
    #8c5a2b 0%,
    #eab676 30%,
    #cd8a52 50%,
    #a5672f 70%,
    #6e4423 100%
  );
  color: #2a1505;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 6px rgba(140, 90, 43, 0.45);
}

/* Turbo - Argent */
.class-gold {
  background: linear-gradient(
    135deg,
    #c0c0c0 0%,
    #f5f5f5 45%,
    #a8a8a8 55%,
    #eeeeee 75%,
    #8e8e8e 100%
  );
  color: #2a2a2a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 6px rgba(120, 120, 120, 0.4);
}

/* Premium - Or */
.class-plus {
  background: linear-gradient(
    135deg,
    #bf953f 0%,
    #fcf6ba 45%,
    #b38728 55%,
    #fbf5b7 75%,
    #aa771c 100%
  );
  color: #3a2a0a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(179, 135, 40, 0.4);
}

/* ==========================================================================
   CONTRÔLES DES GRAPHIQUES
   ========================================================================== */

.chart-controls {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.period-buttons {
  display: inline-flex;
  gap: 4px;
}

.btn-period {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #888888;
  cursor: pointer;
}

/* Période active - mode clair */
.btn-period.active {
  background: linear-gradient(90deg, #3282b3, #8fc9f5, #ff007b);
  color: #ffffff;
  font-weight: bolder;
  border-radius: 6px;
}

/* Mode sombre */
html.theme-dark .btn-period {
  color: #9a9a9a;
}

html.theme-dark .btn-period.active {
  background: linear-gradient(90deg, #3282b3, #8fc9f5, #ff007b);
  color: #ffffff;
  font-weight: bolder;
  border-radius: 6px;
}

/* ==========================================================================
   BOUTONS PRIMAIRES
   ========================================================================== */

.btn-primary {
  background: linear-gradient(90deg, #3282b3, #8fc9f5, #ff007b);
  border: none;
  color: #ffffff;
}

.btn-primary:hover {
  background: linear-gradient(90deg, #276a94, #70b3e8, #d90068);
  color: #ffffff;
}

.link-teal {
  color: #3282b3;
}

/* Boutons Annuler / Retour */
.btn-cancel {
  border: none;
  color: #ff007b;
}

.btn-cancel:hover {
  background: #d90068;
  color: #ffffff;
  font-weight: bolder;
}

/* ==========================================================================
   SÉPARATEURS DES TABLEAUX
   ========================================================================== */

.table > :not(caption) > * > * {
  border-bottom: 1px solid #e2e2e2;
}

html.theme-dark .table > :not(caption) > * > * {
  border-bottom: 1px solid #3a3a3a;
}

/* Séparateur des jours */
.table-day-separator td {
  padding: 10px 12px !important;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888888;
  background: #f4f4f4;
  border-top: 2px solid #d8d8d8 !important;
  border-bottom: 2px solid #d8d8d8 !important;
}

html.theme-dark .table-day-separator td {
  color: #aaaaaa;
  background: #262626;
  border-top: 2px solid #3a3a3a !important;
  border-bottom: 2px solid #3a3a3a !important;
}

/* ==========================================================================
   MODE SOMBRE
   ========================================================================== */

html.theme-dark,
html.theme-dark body {
  background: #1e1e1e;
  color: #e0e0e0;
}

/* Cartes et navbar */
html.theme-dark .card,
html.theme-dark .dashboard-card,
html.theme-dark .navbar {
  background: #2a2a2a !important;
  color: #e0e0e0;
}

html.theme-dark .card-header {
  background: #2a2a2a !important;
  border-color: #3a3a3a;
  color: #e0e0e0;
}

/* Titres et textes */
html.theme-dark h1,
html.theme-dark h2,
html.theme-dark h3,
html.theme-dark h4,
html.theme-dark h5,
html.theme-dark h6,
html.theme-dark .page-header h2,
html.theme-dark label,
html.theme-dark dt,
html.theme-dark dd {
  color: #e0e0e0 !important;
}

html.theme-dark .text-muted {
  color: #9a9a9a !important;
}

/* Tableaux */
html.theme-dark .table {
  color: #e0e0e0;
  --bs-table-color: #e0e0e0;
  --bs-table-bg: transparent;
}

html.theme-dark .table thead th {
  background: #2a2a2a;
  color: #e0e0e0;
  border-color: #3a3a3a;
}

html.theme-dark .table td,
html.theme-dark .table th {
  border-color: #3a3a3a;
}

html.theme-dark .table-hover > tbody > tr:hover > * {
  background: #333333;
  color: #e0e0e0;
}

html.theme-dark .table-striped > tbody > tr:nth-of-type(odd) > * {
  background: #262626;
  color: #e0e0e0;
}

/* Formulaires */
html.theme-dark .form-control,
html.theme-dark .form-select {
  background: #2a2a2a;
  color: #e0e0e0;
  border-color: #3a3a3a;
}

html.theme-dark .form-control:focus,
html.theme-dark .form-select:focus {
  background: #2a2a2a;
  color: #e0e0e0;
  border-color: #3282b3;
}

html.theme-dark .form-control::placeholder {
  color: #888888;
}

/* Modals */
html.theme-dark .modal-content {
  background: #2a2a2a;
  color: #e0e0e0;
}

html.theme-dark .modal-header,
html.theme-dark .modal-footer {
  border-color: #3a3a3a;
}

/* ==========================================================================
   CONTENEURS DES GRAPHIQUES - CHART.JS
   ========================================================================== */

.chart-canvas-wrapper {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-canvas-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-dashboard-body {
  display: flex;
  gap: 20px;
  align-items: stretch;
  flex-wrap: wrap;
}

.chart-main-panel {
  flex: 2;
  width: 100%;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-sub-block {
  width: 100%;
}

.chart-canvas-wrapper-sm {
  height: 220px;
}

.chart-main-panel .chart-canvas-wrapper {
  height: 280px;
}

.chart-side-panel {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Graphique en ligne */
.chart-line-row {
  width: 100%;
  margin-top: 20px;
}

.chart-canvas-wrapper-line {
  height: 320px;
}

@media (max-width: 576px) {
  .chart-canvas-wrapper-line {
    height: 260px;
  }
}

/* Graphique Doughnut */
.container_doughnut {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 250px;
  height: 250px;
}

.chart-doughnut-wrap {
  display: flex;
  align-items: center;
  position: relative;
  width: 180px;
  height: 180px;
}

.chart-doughnut-wrap canvas {
  cursor: pointer;
}

.chart-doughnut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: var(--color-secondary);
}

/* Légende des graphiques */
.chart-mini-legend {
  list-style: none;
  padding: 0;
  margin-top: 16px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
}

.chart-mini-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  color: #555555;
  white-space: nowrap;
}

.chart-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Couleurs des graphiques */
.chart-dot-gain {
  background: #3282b3;
}

.chart-dot-perte {
  background: #ff007b;
}

.chart-dot-capital {
  background: #8fc9f5;
}

/* Mode sombre des graphiques */
html.theme-dark .chart-doughnut-center {
  color: #e0e0e0;
}

html.theme-dark .chart-mini-legend li {
  color: #cccccc;
}

/* ==========================================================================
   ICÔNES D'ACTION DES TABLEAUX
   ========================================================================== */

.table-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.table-action-icon i {
  font-size: 1rem;
  line-height: 1;
}

/* ==========================================================================
   DASHBOARD UTILISATEUR
   ========================================================================== */

.dashboard-top-row {
  display: flex;
  gap: 20px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.dashboard-cards-col {
  flex: 4;
  min-width: 280px;
}

.dashboard-class-col {
  flex: 1;
  min-width: 160px;
}

@media (max-width: 768px) {
  .dashboard-cards-col,
  .dashboard-class-col {
    flex: 1 1 100%;
  }
}

/* Badge dans le dashboard */
.dashboard-class-col .class-badge {
  padding: 20px;
  border-radius: 14px;
  font-size: 16px;
  gap: 10px;
}

.dashboard-class-col .card-icon {
  font-size: 22px;
}

.dashboard-class-col .card-content p {
  font-size: 18px;
  font-weight: bold;
}

/* ==========================================================================
   ANIMATION DE BRILLANCE DES BADGES
   ========================================================================== */

.class-badge {
  position: relative;
  overflow: hidden;
}

.class-badge::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.75) 50%,
    transparent 100%
  );
  animation: badge-shine 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes badge-shine {
  0% {
    left: -150%;
  }

  55% {
    left: 150%;
  }

  100% {
    left: 150%;
  }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 576px) {
  .chart-canvas-wrapper {
    height: 260px;
  }
}

@media (max-width: 768px) {
  .chart-dashboard-body {
    flex-direction: column;
  }

  .chart-main-panel,
  .chart-side-panel {
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
  }

  .chart-side-panel {
    margin-top: 0;
  }

  .chart-doughnut-wrap {
    margin: 0 auto;
  }
}
