/* =========================
   BASE
========================= */
body {
  background: #f8f8f8;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  margin: 0;
}

/* =========================
   CONTAINER
========================= */
.login-container {
  display: flex;
  min-height: 100vh;
}

/* =========================
   COLONNES
========================= */
.login-left,
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* =========================
   GAUCHE (DARK PREMIUM)
========================= */
.login-left {
  background: linear-gradient(135deg,#1e293b,#0f172a);
  color: white;
  position: relative;
  overflow: hidden;
}

/* glow subtil */
.login-left::before {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(59,130,246,0.12);
  filter: blur(140px);
  top: 10%;
  left: 5%;
}

/* STRUCTURE */
.login-left-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
  max-width: 900px;
  width: 100%;
}

.login-container {
  display: flex;
  flex-direction: row; 
}

/* DASHBOARD À GAUCHE */
.login-left {
  order: 1;
}

/* LOGIN À DROITE */
.login-right {
  order: 2;
}

/* =========================
   GRAPHS (TOP)
========================= */
.charts {
  display: flex;
  gap: 20px;
}

.chart-box {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 18px;
  backdrop-filter: blur(10px);
  transition: all .2s ease;
}

.chart-box:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-3px);
}

.chart-box canvas {
  max-height: 160px;
}

.chart-label {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

/* =========================
   LÉGENDE GRAPHS (🔥 AJOUT)
========================= */
.chart-legend {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 12px;
}

.legend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(255,255,255,0.7);
}

.legend-item strong {
  color: white;
  font-size: 13px;
}

/* DOTS */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.dot.blue { background:#38bdf8; }
.dot.green { background:#4ade80; }
.dot.orange { background:#f59e0b; }
.dot.purple { background:#a78bfa; }

/* =========================
   KPI (BOTTOM)
========================= */
.kpi {
  display: flex;
  gap: 12px;
}

.kpi-box {
  flex: 1;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  text-align: center;
  transition: 0.2s;
}

.kpi-box:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
}

.kpi-box span {
  display: block;
  font-size: 16px;
  color: white;
}

.kpi-box strong {
  font-size: 24px;
  color: white;
}

/* couleurs KPI */
.kpi-blue strong { color: #38bdf8; }
.kpi-green strong { color: #4ade80; }
.kpi-purple strong { color: #a78bfa; }
.kpi-orange strong { color: #f59e0b; }

/* =========================
   LOGIN CARD
========================= */
.login-card {
  background: white;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 380px;
  animation: fadeIn .6s ease;
}

/* =========================
   INPUT
========================= */
.form-control {
  border-radius: 10px;
  padding: 12px;
  border: 1px solid #e5e7eb;
}

.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* =========================
   BUTTON
========================= */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-weight: 600;
  transition: 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37,99,235,.2);
}

/* =========================
   ANIMATION
========================= */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   TABLETTE
========================= */
@media (max-width: 991px) {

  .login-container {
    flex-direction: column;
    min-height: auto;
  }

  .login-left,
  .login-right {
    width: 100%;
    padding: 25px;
  }

  .login-left {
    min-height: auto;
  }

  .login-left-content {
    gap: 20px;
    max-width: 100%;
  }

  /* charts */
  .charts {
    flex-direction: column;
    gap: 15px;
  }

  .chart-box canvas {
    max-height: 180px;
  }

  /* KPI */
  .kpi {
    flex-wrap: wrap;
    gap: 15px;
  }

  .kpi-box {
    min-width: calc(50% - 8px);
  }

  /* login */
  .login-card {
    max-width: 500px;
  }

}

/* =========================
   MOBILE
========================= */
@media (max-width: 576px) {

  .login-left,
  .login-right {
    padding: 15px;
  }

  .login-left-content {
    gap: 15px;
  }

  .login-card {
    max-width: 100%;
    padding: 20px;
    border-radius: 14px;
  }

  /* =========================
     LOGO
  ========================= */
  .login-card img {
    width: 70% !important;
    max-height: 55px !important;
  }

  /* =========================
     CHARTS
  ========================= */
  .charts {
    flex-direction: column;
    gap: 12px;
  }

  .chart-box {
    height: 170px;
  }

  /* 📊 Flux stock plus compact */
  #chartFluxStock {
    height: 110px !important;
  }

  /* 💰 Doughnut légèrement plus grand */
  #chartValorisation {
    height: 120px !important;
  }

  /* =========================
     KPI
  ========================= */
  .kpi {
    flex-wrap: wrap;
    gap: 10px;
  }

  .kpi-box {
    min-width: calc(50% - 5px);
    padding: 10px;
  }

  .kpi-box span {
    font-size: 13px;
  }

  .kpi-box strong {
    font-size: 20px;
  }

  /* =========================
     OPTIONS
  ========================= */
  .d-flex.justify-content-between.mt-2.mb-3 {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start !important;
  }

  /* =========================
     FOOTER
  ========================= */
  footer {
    font-size: 11px;
  }

}

/* =========================
   📱 PORTRAIT = MOBILE/TABLETTE
========================= */
@media screen and (orientation: portrait) {

  .login-container {
    flex-direction: column !important;
    min-height: auto;
  }

  .login-left,
  .login-right {
    width: 100%;
    flex: none;
    padding: 20px;
  }

  .login-left {
    min-height: auto;
  }

  .login-left-content {
    max-width: 100%;
    gap: 20px;
  }

  /* ===== CHARTS ===== */
  .charts {
    display: flex;
    flex-direction: row;
    gap: 15px;
  }

  .chart-box {
    flex: 1;
    min-width: 0;
  }

  .chart-box canvas {
    max-height: 180px;
  }

  /* ===== KPI ===== */
  .kpi {
    flex-wrap: wrap;
    gap: 12px;
  }

  .kpi-box {
    min-width: calc(50% - 6px);
  }

  /* ===== LOGIN ===== */
  .login-card {
    max-width: 500px;
    margin: auto;
  }

}