/* ============================================
   LifeExpensive Service Secours - Custom Theme
   Rouge / Orange pour Pompiers & SAMU
   ============================================ */

/* --- Sidebar Enhancement --- */
.duik-sidebar {
  background: linear-gradient(180deg, #3a0a0a 0%, #5a1515 100%) !important;
  border-right: 1px solid rgba(220, 53, 69, 0.15);
  min-height: 100vh;
}

.duik-sidebar__heading {
  color: #f08080 !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: #d4a0a0 !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(220, 53, 69, 0.15);
}

.duik-sidebar__link.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #DC3545, #a71d2a) !important;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
  font-weight: 500;
}

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

/* Sidebar Logo Section */
.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(220, 53, 69, 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: #DC3545;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- Header Enhancement --- */
.duik-header .navbar {
  background: linear-gradient(135deg, #3a0a0a 0%, #6b1a1a 100%) !important;
  border-bottom: 2px solid #DC3545;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

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

.duik-header .navbar-brand img {
  filter: drop-shadow(0 1px 3px rgba(220, 53, 69, 0.5));
}

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

.duik-header .form-control:focus {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: #DC3545 !important;
  box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.25);
}

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

/* --- Card Enhancements --- */
.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 #DC3545 !important;
  border-radius: 12px;
  padding: 0.5rem;
}

.stat-card.stat-primary { border-left-color: #DC3545 !important; }
.stat-card.stat-success { border-left-color: #28a745 !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(220, 53, 69, 0.12);
  color: #DC3545;
}

.stat-card .stat-icon.bg-success-soft {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
}

.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,
.stat-card-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label,
.stat-card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8a94a6;
  font-weight: 500;
}

/* --- Badge Styles --- */
.badge-status {
  padding: 0.35em 0.8em;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-en_attente { background: #fff3cd; color: #856404; }
.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; }

/* --- Tables Enhancement --- */
.table thead th,
table.dataTable thead th,
.dataTables_wrapper .table thead th {
  background: linear-gradient(135deg, #3a0a0a 0%, #5a1515 100%) !important;
  border: none !important;
  border-bottom: 2px solid #DC3545 !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(220, 53, 69, 0.04);
}

.table tbody td {
  vertical-align: middle;
  padding: 0.7rem 0.8rem;
}

/* --- Tabs Enhancement --- */
.nav-tabs {
  border-bottom: 2px solid #e9ecef;
}

.nav-tabs .nav-link {
  border: none;
  color: #6c757d;
  font-weight: 500;
  padding: 0.7rem 1.2rem;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
  color: #DC3545;
  background: rgba(220, 53, 69, 0.05);
}

.nav-tabs .nav-link.active {
  color: #DC3545;
  border-bottom: 3px solid #DC3545;
  background: transparent;
  font-weight: 600;
}

/* --- Page Title Bar --- */
.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 #DC3545;
}

.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: #DC3545;
  color: #DC3545;
  text-decoration: none;
}

.quick-action-btn i {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* --- Button Enhancement --- */
.btn-primary {
  background: linear-gradient(135deg, #DC3545, #a71d2a);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.2rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #c82333, #8b1722);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
  transform: translateY(-1px);
}

.btn-outline-primary {
  border-radius: 8px;
  border-width: 2px;
  font-weight: 500;
  color: #DC3545;
  border-color: #DC3545;
}

.btn-outline-primary:hover {
  background: #DC3545;
  border-color: #DC3545;
}

/* --- Form Enhancements --- */
.form-control {
  border-radius: 8px;
  border: 1px solid #dee2e6;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: #DC3545;
  box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.15);
}

/* Fix input-group : bouton colle a l'input */
.input-group .form-control {
  border-radius: 8px 0 0 8px;
}

.input-group .input-group-append .btn {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

/* --- 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;
}

/* --- Corps Badges (Pompier / SAMU) --- */
.badge-corps-pompier {
  background: #8B0000;
  color: #ffffff;
  padding: 0.3em 0.8em;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-corps-samu {
  background: #0056b3;
  color: #ffffff;
  padding: 0.3em 0.8em;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* --- SAMU Theme (via data-corps attribute on body) --- */
body[data-corps="samu"] .duik-sidebar {
  background: linear-gradient(180deg, #002244 0%, #003366 100%) !important;
}

body[data-corps="samu"] .duik-sidebar__heading {
  color: #5bb8f0 !important;
}

body[data-corps="samu"] .duik-sidebar__link {
  color: #8bb8d4 !important;
}

body[data-corps="samu"] .duik-sidebar__link:hover {
  background: rgba(23, 162, 184, 0.15);
  color: #ffffff !important;
}

body[data-corps="samu"] .duik-sidebar__link.active {
  background: linear-gradient(135deg, #17a2b8, #117a8b) !important;
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

body[data-corps="samu"] .sidebar-logo .server-subtitle {
  color: #17a2b8;
}

body[data-corps="samu"] .duik-header .navbar {
  background: linear-gradient(135deg, #002244 0%, #003d73 100%) !important;
  border-bottom-color: #17a2b8;
}

body[data-corps="samu"] .duik-header .navbar-brand {
  background: rgba(23, 162, 184, 0.12) !important;
}

body[data-corps="samu"] .page-title-bar {
  border-left-color: #17a2b8;
}

body[data-corps="samu"] .btn-primary {
  background: linear-gradient(135deg, #17a2b8, #117a8b);
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

body[data-corps="samu"] .btn-primary:hover {
  background: linear-gradient(135deg, #138496, #0d5d6b);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

body[data-corps="samu"] .table thead th,
body[data-corps="samu"] table.dataTable thead th {
  background: linear-gradient(135deg, #002244 0%, #003d73 100%) !important;
  border-bottom-color: #17a2b8 !important;
}

body[data-corps="samu"] .nav-tabs .nav-link.active {
  color: #17a2b8;
  border-bottom-color: #17a2b8;
}

body[data-corps="samu"] .stat-card.stat-primary {
  border-left-color: #17a2b8 !important;
}

body[data-corps="samu"] .quick-action-btn:hover {
  border-color: #17a2b8;
  color: #17a2b8;
}

body[data-corps="samu"] .btn-outline-primary {
  color: #17a2b8;
  border-color: #17a2b8;
}

body[data-corps="samu"] .btn-outline-primary:hover {
  background: #17a2b8;
  border-color: #17a2b8;
}

/* --- Dispatch Team Cards --- */
.team-card {
  border-top: 3px solid #6c757d;
  transition: all 0.2s ease;
}

.team-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.team-card .card-header {
  background: #ffffff;
  border-bottom: 1px solid #f1f3f5;
  padding: 0.7rem 1rem;
}

.team-card .team-freq {
  color: #6c757d;
  font-size: 0.75rem;
  font-weight: 500;
}

.team-card.team-pompier {
  border-top-color: #DC3545;
}

.team-card.team-pompier .card-header {
  background: linear-gradient(135deg, rgba(220,53,69,0.08), rgba(220,53,69,0.02));
}

.team-card.team-pompier .team-freq {
  color: #DC3545;
}

.team-card.team-samu {
  border-top-color: #17a2b8;
}

.team-card.team-samu .card-header {
  background: linear-gradient(135deg, rgba(23,162,184,0.08), rgba(23,162,184,0.02));
}

.team-card.team-samu .team-freq {
  color: #17a2b8;
}

.team-card.team-centrale {
  border-top-color: #d4a017;
}

.team-card.team-centrale .card-header {
  background: linear-gradient(135deg, rgba(212,160,23,0.1), rgba(212,160,23,0.02));
}

.badge-team-count {
  background: #f1f5f9;
  color: #4a5568;
  font-size: 0.8rem;
  padding: 0.3em 0.7em;
  border-radius: 12px;
  font-weight: 600;
}

.team-member-list {
  max-height: 200px;
  overflow-y: auto;
}

.team-member {
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  border-bottom: 1px solid #f8f9fa;
}

.team-member-chef {
  background: rgba(255, 193, 7, 0.08);
  font-weight: 500;
}

.team-fill-bar {
  height: 3px;
  background: linear-gradient(90deg, #DC3545, #fd7e14);
  border-radius: 0 0 12px 12px;
  transition: width 0.5s ease;
}

body[data-corps="samu"] .team-fill-bar {
  background: linear-gradient(90deg, #17a2b8, #20c997);
}

/* --- Alert Enhancement --- */
.alert {
  border-radius: 10px;
  border: none;
}

.alert-danger {
  background: linear-gradient(135deg, rgba(220,53,69,0.1), rgba(220,53,69,0.05));
  border-left: 4px solid #dc3545;
}

.alert-success {
  background: linear-gradient(135deg, rgba(40,167,69,0.1), rgba(40,167,69,0.05));
  border-left: 4px solid #28a745;
}

/* --- Link styles --- */
a.link {
  color: #DC3545;
  font-weight: 500;
  transition: color 0.2s ease;
}

a.link:hover {
  color: #a71d2a;
  text-decoration: none;
}

body[data-corps="samu"] a.link {
  color: #17a2b8;
}

body[data-corps="samu"] a.link:hover {
  color: #117a8b;
}

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

/* --- Rapport status cards --- */
.rapport-card {
  border-top: 3px solid transparent;
}

.rapport-card.rapport-en_cours { border-top-color: #fd7e14; }
.rapport-card.rapport-termine { border-top-color: #28a745; }
.rapport-card.rapport-annule { border-top-color: #6c757d; }
.rapport-card.rapport-archive { border-top-color: #6c757d; }

/* --- 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: #3a0a0a !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;
  }
}
