/* ============================================
   LifeExpensive Auto-Ecole - Custom Theme
   Indigo/Bleu pour Auto-Ecole
   ============================================ */

/* --- Sidebar --- */
.duik-sidebar {
  background: linear-gradient(180deg, #1a237e 0%, #283593 100%) !important;
  border-right: 1px solid rgba(92, 107, 192, 0.15);
  min-height: 100vh;
}

.duik-sidebar__heading {
  color: #9fa8da !important;
  font-size: 0.7rem !important;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 0.8rem 1rem 0.3rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.duik-sidebar__heading:first-child {
  border-top: none;
  margin-top: 0;
}

.duik-sidebar__link {
  color: #b0bec5 !important;
  padding: 0.45rem 1rem !important;
  font-size: 0.85rem;
  border-radius: 6px;
  margin: 1px 0.5rem;
  transition: all 0.2s ease;
}

.duik-sidebar__link:hover {
  color: #ffffff !important;
  background: rgba(92, 107, 192, 0.15);
}

.duik-sidebar__link.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #3f51b5, #303f9f) !important;
  box-shadow: 0 2px 8px rgba(63, 81, 181, 0.3);
  font-weight: 500;
}

.duik-sidebar__item {
  list-style: none;
}

/* Sidebar Logo */
.sidebar-logo {
  text-align: center;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.sidebar-logo img {
  max-width: 48px;
  height: auto;
  filter: drop-shadow(0 1px 4px rgba(63, 81, 181, 0.4));
  border-radius: 8px;
}

.sidebar-logo .server-name {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.sidebar-logo .server-subtitle {
  color: #5c6bc0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- Header --- */
.duik-header .navbar {
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%) !important;
  border-bottom: 2px solid #5c6bc0;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

.duik-header .navbar-brand {
  background: rgba(92, 107, 192, 0.12) !important;
  font-weight: 600;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
}

.duik-header .form-control {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
  border: 1px solid rgba(92, 107, 192, 0.2) !important;
  border-radius: 8px;
}

.duik-header .form-control:focus {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: #5c6bc0 !important;
  box-shadow: 0 0 0 0.15rem rgba(92, 107, 192, 0.25);
}

.duik-header .form-control::placeholder {
  color: rgba(255, 255, 255, 0.4) !important;
}

/* --- Cards --- */
.card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Stat Cards */
.stat-card {
  position: relative;
  overflow: hidden;
  border-left: 4px solid #3f51b5 !important;
  border-radius: 12px;
  padding: 0.5rem;
}

.stat-card.stat-primary { border-left-color: #3f51b5 !important; }
.stat-card.stat-success { border-left-color: #4caf50 !important; }
.stat-card.stat-danger { border-left-color: #dc3545 !important; }
.stat-card.stat-warning { border-left-color: #fd7e14 !important; }
.stat-card.stat-info { border-left-color: #17a2b8 !important; }

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-card .stat-icon.bg-primary-soft { background: rgba(63, 81, 181, 0.12); color: #3f51b5; }
.stat-card .stat-icon.bg-success-soft { background: rgba(76, 175, 80, 0.12); color: #4caf50; }
.stat-card .stat-icon.bg-danger-soft { background: rgba(220, 53, 69, 0.12); color: #dc3545; }
.stat-card .stat-icon.bg-warning-soft { background: rgba(253, 126, 20, 0.12); color: #fd7e14; }
.stat-card .stat-icon.bg-info-soft { background: rgba(23, 162, 184, 0.12); color: #17a2b8; }

.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #8a94a6; font-weight: 500; }

/* --- Badges --- */
.badge-reussi { background: #d4edda; color: #155724; }
.badge-echoue { background: #f8d7da; color: #721c24; }
.badge-en_cours { background: #cce5ff; color: #004085; }
.badge-termine { background: #d4edda; color: #155724; }
.badge-annule { background: #e2e3e5; color: #6c757d; }
.badge-paye { background: #d4edda; color: #155724; }
.badge-impaye { background: #f8d7da; color: #721c24; }
.badge-code-ok { background: #d4edda; color: #155724; font-size: 0.8rem; }
.badge-code-ko { background: #f8d7da; color: #721c24; font-size: 0.8rem; }
.badge-code-expire { background: #fff3cd; color: #856404; font-size: 0.8rem; }
.badge-interdit { background: #343a40; color: #fff; font-size: 0.8rem; }
.badge-vm-ok { background: #d4edda; color: #155724; font-size: 0.8rem; }
.badge-vm-expire { background: #fff3cd; color: #856404; font-size: 0.8rem; }
.badge-vm-manquante { background: #f8d7da; color: #721c24; font-size: 0.8rem; }

/* --- Tables --- */
.table thead th {
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%) !important;
  border: none !important;
  border-bottom: 2px solid #5c6bc0 !important;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffffff !important;
  font-weight: 600;
  padding: 0.8rem 1rem;
}

.table tbody tr:hover { background-color: rgba(63, 81, 181, 0.04); }
.table tbody td { vertical-align: middle; padding: 0.7rem 0.8rem; }

/* --- Page Title --- */
.page-title-bar {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid #3f51b5;
}
.page-title-bar h1 { margin-bottom: 0; font-size: 1.4rem; }
.page-title-bar .lead { margin-bottom: 0; font-size: 0.9rem; }

/* --- Quick Actions --- */
.quick-action-btn {
  border-radius: 10px; padding: 1rem; text-align: center;
  transition: all 0.2s ease; border: 1px solid #e9ecef;
  background: #ffffff; color: #4a5568; display: block; text-decoration: none;
}
.quick-action-btn:hover { transform: translateY(-3px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); border-color: #3f51b5; color: #3f51b5; text-decoration: none; }
.quick-action-btn i { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }

/* --- Buttons --- */
.btn-primary { background: linear-gradient(135deg, #3f51b5, #303f9f); border: none; border-radius: 8px; padding: 0.5rem 1.2rem; font-weight: 500; box-shadow: 0 2px 8px rgba(63, 81, 181, 0.3); }
.btn-primary:hover { background: linear-gradient(135deg, #3949ab, #283593); box-shadow: 0 4px 12px rgba(63, 81, 181, 0.4); transform: translateY(-1px); }
.btn-outline-primary { border-radius: 8px; border-width: 2px; font-weight: 500; color: #3f51b5; border-color: #3f51b5; }
.btn-outline-primary:hover { background: #3f51b5; border-color: #3f51b5; }

/* --- Forms --- */
.form-control { border-radius: 8px; border: 1px solid #dee2e6; padding: 0.5rem 1rem; }
.form-control:focus { border-color: #3f51b5; box-shadow: 0 0 0 0.15rem rgba(63, 81, 181, 0.15); }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 3rem 1rem; color: #8a94a6; }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* --- Activity Feed --- */
.activity-item { padding: 0.8rem 0; border-bottom: 1px solid #f1f3f5; display: flex; align-items: flex-start; }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; margin-right: 0.8rem; }
.activity-content { flex: 1; }
.activity-content .activity-text { font-size: 0.9rem; margin-bottom: 0.1rem; }
.activity-content .activity-time { font-size: 0.75rem; color: #8a94a6; }

/* --- Links --- */
a.link { color: #3f51b5; font-weight: 500; }
a.link:hover { color: #283593; text-decoration: none; }

/* --- Main --- */
main.ml-md-auto { background: #f8f9fb; min-height: 100vh; }

/* --- Code Status Cards --- */
.code-status-card {
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  border: 1px solid #e9ecef;
}
.code-status-card.code-ok { border-color: #28a745; background: rgba(40, 167, 69, 0.05); }
.code-status-card.code-ko { border-color: #dc3545; background: rgba(220, 53, 69, 0.05); }
.code-status-card.code-expire { border-color: #ffc107; background: rgba(255, 193, 7, 0.05); }
.code-status-card i { font-size: 2rem; margin-bottom: 0.5rem; }

/* --- Sidebar Mobile Backdrop --- */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1025;
  display: none;
}
.sidebar-backdrop.show {
  display: block;
}

/* --- Responsive --- */
@media (max-width: 767.98px) {
  .duik-sidebar {
    background: #1a237e !important;
    position: fixed;
    z-index: 1030;
    top: 56px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .stat-value { font-size: 1.4rem; }
  .sidebar-logo { padding: 0.4rem 0.6rem; }
  .sidebar-logo img { max-width: 28px; }

  /* Padding-top pour compenser la navbar fixe */
  main.ml-md-auto { padding-top: 4rem; }

  /* Quick actions : 2 colonnes au lieu de 3 */
  .quick-action-btn { padding: 0.7rem 0.5rem; font-size: 0.8rem; }
  .quick-action-btn i { font-size: 1.2rem; }

  /* Tables DataTables scroll horizontal */
  .dataTables_wrapper { overflow-x: auto; }
  .dataTables_wrapper table { min-width: 600px; }

  /* Formulaires pleine largeur */
  .form-control, .custom-select { font-size: 16px; }

  /* Forms inline -> vertical sur mobile */
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .form-control,
  .form-inline .custom-select,
  .form-inline .btn { width: 100%; margin-bottom: 0.5rem; }

  /* Override inline min-width */
  input[style*="min-width"] { min-width: 100% !important; }
}

/* --- Print --- */
@media print {
  .duik-sidebar, .duik-header, .duik-go-to, footer { display: none !important; }
  main.ml-md-auto { margin-left: 0 !important; padding-top: 0 !important; }
}
