/* ===== e-DAMO Admin CSS ===== */
:root {
  --primary: #0d47a1;
  --primary-light: #1565c0;
  --secondary: #546e7a;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #f57f17;
  --info: #01579b;
  --sidebar-width: 260px;
  --sidebar-bg: #0d1b2a;
  --sidebar-text: #cfd8dc;
  --header-h: 60px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f0f2f5; color: #212529; margin: 0; }

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: var(--sidebar-width); background: var(--sidebar-bg);
  display: flex; flex-direction: column; z-index: 1000;
  transition: transform .3s ease;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: var(--header-h);
}
.sidebar-logo { width: 36px; height: 36px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.2rem; color: #fff; display: block; }
.brand-sub { font-size: .7rem; color: var(--sidebar-text); }
.sidebar-toggle-btn { background: none; border: none; color: #fff; cursor: pointer; margin-left: auto; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.user-name { font-size: .82rem; font-weight: 600; color: #fff; display: block; }
.user-email { font-size: .72rem; color: var(--sidebar-text); }
.badge-role-super_admin { background: #ef9a9a; color: #b71c1c; }
.badge-role-admin { background: #90caf9; color: #0d47a1; }
.badge-role-agent { background: #a5d6a7; color: #1b5e20; }
[class^="badge-role-"] {
  font-size: .65rem; padding: 2px 6px; border-radius: 10px;
  font-weight: 600; display: inline-block; margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 10px 0; }
.sidebar-section-title {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(255,255,255,.35);
  padding: 14px 20px 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: var(--sidebar-text);
  text-decoration: none; font-size: .84rem;
  transition: all .2s; position: relative;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,.08); color: #fff;
}
.sidebar-link.active::before {
  content: ''; position: absolute; left: 0; top: 0;
  bottom: 0; width: 3px; background: #64b5f6;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 1rem; }
.sidebar-badge {
  margin-left: auto; background: #ef5350;
  color: #fff; font-size: .65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
}

/* ---- MAIN LAYOUT ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh; display: flex; flex-direction: column;
}
.topbar {
  position: sticky; top: 0; z-index: 900;
  background: #fff; height: var(--header-h);
  display: flex; align-items: center; padding: 0 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1); gap: 12px;
}
.topbar-toggle { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: #546e7a; }
.topbar-search {
  flex: 1; max-width: 360px;
  position: relative; margin: 0 16px;
}
.topbar-search input {
  width: 100%; border: 1px solid #dde2e9;
  border-radius: 20px; padding: 6px 14px 6px 36px;
  font-size: .84rem; background: #f5f7fa; outline: none;
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; }
.topbar-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #90a4ae; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-btn {
  background: none; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #546e7a; transition: background .2s; position: relative;
}
.topbar-btn:hover { background: #f0f2f5; }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; background: #ef5350;
  border-radius: 50%; border: 2px solid #fff;
}
.topbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.topbar-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem;
}

/* ---- PAGE CONTENT ---- */
.page-content { padding: 24px; flex: 1; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.page-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; color: #1a237e; }
.page-header p { font-size: .84rem; color: #607d8b; margin: 2px 0 0; }
.page-header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- CARDS ---- */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: none;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #f0f2f5;
  background: #fff; border-radius: var(--radius) var(--radius) 0 0;
}
.card-header h5 { margin: 0; font-size: .95rem; font-weight: 600; color: #263238; }
.card-body { padding: 18px; }

/* ---- STAT CARDS ---- */
.stat-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
  position: relative; overflow: hidden;
}
.stat-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 12px;
}
.stat-card-value { font-size: 1.8rem; font-weight: 700; color: #212529; line-height: 1; }
.stat-card-label { font-size: .8rem; color: #607d8b; margin-top: 4px; font-weight: 500; }
.stat-card-change { font-size: .75rem; margin-top: 8px; }

/* ---- TABLES ---- */
.table th { font-size: .78rem; font-weight: 600; color: #607d8b; text-transform: uppercase; letter-spacing: .05em; background: #f8fafc; border-bottom: 2px solid #e8ecf0; }
.table td { font-size: .84rem; vertical-align: middle; border-color: #f0f2f5; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ---- BADGES STATUT ---- */
.badge-statut {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.badge-brouillon { background: #fff8e1; color: #f57f17; }
.badge-soumise { background: #e3f2fd; color: #0277bd; }
.badge-validee { background: #e8f5e9; color: #2e7d32; }
.badge-rejetee { background: #ffebee; color: #c62828; }
.badge-corrigee { background: #f3e5f5; color: #6a1b9a; }

/* ---- FORMS ---- */
.form-label { font-weight: 600; font-size: .84rem; color: #455a64; }
.form-control, .form-select {
  border: 1px solid #dde2e9; border-radius: 6px;
  font-size: .875rem; padding: 8px 12px;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,71,161,.12);
}
.form-text { font-size: .75rem; }

/* ---- BUTTONS ---- */
.btn { border-radius: 6px; font-weight: 500; font-size: .85rem; transition: all .2s; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ---- ALERTS ---- */
.alert { border-radius: var(--radius); border: none; font-size: .875rem; }
.alert-success { background: #e8f5e9; color: #1b5e20; }
.alert-danger { background: #ffebee; color: #b71c1c; }
.alert-warning { background: #fffde7; color: #f57f17; }
.alert-info { background: #e3f2fd; color: #01579b; }

/* ---- BREADCRUMB ---- */
.breadcrumb { font-size: .8rem; background: none; padding: 0; margin-bottom: 16px; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: #90a4ae; }

/* ---- PAGINATION ---- */
.pagination { font-size: .85rem; }
.page-link { color: var(--primary); border-color: #dde2e9; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ---- FILTERS BAR ---- */
.filters-bar {
  background: #fff; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.filters-bar form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

/* ---- RESPONSIVE ---- */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 999; }
  .overlay.show { display: block; }
}

/* ---- MISC ---- */
.text-truncate-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
hr { border-color: #f0f2f5; }
