/* ============================================
   LifeExpensive BTP System - Custom Theme
   Orange / Construction
   ============================================ */

/* --- Sidebar Enhancement --- */
.duik-sidebar {
  background: linear-gradient(180deg, #1a0e00 0%, #2d1a00 100%) !important;
  border-right: 1px solid rgba(255, 136, 0, 0.15);
  min-height: 100vh;
}

.duik-sidebar__heading {
  color: #ffb84d !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: #d4a574 !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(255, 136, 0, 0.15);
}

.duik-sidebar__link.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #FF8800, #cc6d00) !important;
  box-shadow: 0 2px 8px rgba(255, 136, 0, 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(255, 136, 0, 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: #FF8800;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.duik-header .navbar-brand {
  background: rgba(255, 136, 0, 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(255, 136, 0, 0.5));
}

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

.duik-header .form-control:focus {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: #FF8800 !important;
  box-shadow: 0 0 0 0.15rem rgba(255, 136, 0, 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 #FF8800 !important;
  border-radius: 12px;
  padding: 0.5rem;
}

.stat-card.stat-primary { border-left-color: #FF8800 !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: #ffc107 !important; }
.stat-card.stat-info { border-left-color: #17a2b8 !important; }

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6c757d;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-icon {
  width: 45px;
  height: 45px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.bg-primary-soft { background: rgba(255, 136, 0, 0.1); color: #FF8800; }
.bg-success-soft { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.bg-danger-soft { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.bg-warning-soft { background: rgba(255, 193, 7, 0.1); color: #ffc107; }
.bg-info-soft { background: rgba(23, 162, 184, 0.1); color: #17a2b8; }

/* --- BTP Status Badges --- */
.badge-btp-available {
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
}

.badge-btp-sold {
  background: rgba(255, 136, 0, 0.15);
  color: #FF8800;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
}

.badge-btp-construction {
  background: rgba(23, 162, 184, 0.15);
  color: #17a2b8;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
}

.badge-btp-completed {
  background: rgba(108, 117, 125, 0.15);
  color: #6c757d;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
}

.badge-btp-integrated {
  background: rgba(111, 66, 193, 0.15);
  color: #6f42c1;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
}

/* Contract status */
.badge-status-pending {
  background: rgba(255, 193, 7, 0.15);
  color: #d4a106;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-signed {
  background: rgba(0, 188, 212, 0.15);
  color: #00BCD4;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-permit_requested {
  background: rgba(63, 114, 175, 0.15);
  color: #3f72af;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-permit_granted {
  background: rgba(23, 162, 184, 0.15);
  color: #17a2b8;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-in_progress {
  background: rgba(23, 162, 184, 0.15);
  color: #17a2b8;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-validated {
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-cancelled {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-refused {
  background: rgba(255, 152, 0, 0.15);
  color: #e68a00;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-permit_refused {
  background: rgba(255, 152, 0, 0.15);
  color: #e68a00;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-completed {
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-integrated {
  background: rgba(108, 117, 125, 0.15);
  color: #6c757d;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-status-permit_revoked {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

/* --- Progress Bar BTP --- */
.progress-btp {
  height: 20px;
  border-radius: 10px;
  background: rgba(0,0,0,0.05);
}

.progress-btp .progress-bar {
  background: linear-gradient(90deg, #FF8800, #ffaa44);
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* --- Form Styling --- */
.form-control {
  border-radius: 8px;
  border: 1px solid #dee2e6;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: #FF8800;
  box-shadow: 0 0 0 0.15rem rgba(255, 136, 0, 0.25);
}

.custom-control-input:checked ~ .custom-control-label::before {
  background-color: #FF8800;
  border-color: #FF8800;
}

/* --- DataTables Dark Theme Overrides --- */
.dataTables_wrapper .dataTables_filter input {
  border-radius: 8px;
  border: 1px solid #dee2e6;
  padding: 4px 12px;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: #FF8800;
  box-shadow: 0 0 0 0.15rem rgba(255, 136, 0, 0.25);
  outline: none;
}

.dataTables_wrapper .dataTables_length select {
  border-radius: 6px;
  padding: 2px 8px;
}

table.dataTable thead th {
  background: linear-gradient(135deg, #1a0e00 0%, #2d1a00 100%) !important;
  color: #ffffff !important;
  border-bottom: 2px solid #FF8800 !important;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table.dataTable tbody tr:hover {
  background-color: rgba(255, 136, 0, 0.04) !important;
}

table.dataTable tbody td {
  vertical-align: middle;
  font-size: 0.85rem;
}

.page-item.active .page-link {
  background-color: #FF8800;
  border-color: #FF8800;
}

.page-link {
  color: #FF8800;
}

.page-link:hover {
  color: #cc6d00;
}

/* --- Modal --- */
.modal-header {
  border-bottom: 2px solid #FF8800;
}

.modal-content {
  border-radius: 12px;
  overflow: hidden;
}

/* --- Buttons BTP --- */
.btn-btp {
  background: linear-gradient(135deg, #FF8800 0%, #cc6d00 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.btn-btp:hover {
  background: linear-gradient(135deg, #ffaa44 0%, #FF8800 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 136, 0, 0.4);
}

.btn-outline-btp {
  color: #FF8800;
  border: 1px solid #FF8800;
  background: transparent;
  border-radius: 8px;
}

.btn-outline-btp:hover {
  color: #fff;
  background: #FF8800;
}

/* --- 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: 767px) {
  .stat-value {
    font-size: 1.2rem;
  }

  .stat-icon {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }

  .duik-sidebar {
    position: fixed;
    z-index: 1030;
    top: 56px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }

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

/* --- Callout (messages) --- */
.duik-callout {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-left: 4px solid #6c757d;
  display: flex;
  align-items: center;
}

.duik-callout-success { border-left-color: #28a745; background: rgba(40,167,69,0.05); }
.duik-callout-danger { border-left-color: #dc3545; background: rgba(220,53,69,0.05); }
.duik-callout-warning { border-left-color: #ffc107; background: rgba(255,193,7,0.05); }
.duik-callout-info { border-left-color: #17a2b8; background: rgba(23,162,184,0.05); }

/* --- Main Content padding (clear fixed navbar) --- */
main.duik-content {
  padding-top: 5rem !important;
}

/* --- Page Title --- */
.page-title-bar {
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(255, 136, 0, 0.15);
}