/* ============================================================
   ELEGANCE360 — Luxury Fashion Management CSS
   Version 1.0.0
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --gold:        #D4AF37;
  --gold-dark:   #B8962A;
  --gold-light:  #F0D060;
  --gold-soft:   rgba(212,175,55,0.12);
  --black:       #111111;
  --black-soft:  #1A1A1A;
  --black-card:  #1E1E1E;
  --black-border:#2A2A2A;
  --white:       #FFFFFF;
  --gray-100:    #F5F5F5;
  --gray-200:    #E8E8E8;
  --gray-400:    #9A9A9A;
  --gray-600:    #666666;
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.3);
  --transition:  all 0.25s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  background: #0D0D0D;
  color: var(--white);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  color: var(--white);
}

.text-muted {
  color: var(--gray-400) !important;
}

.fw-600 { font-weight: 600; }
.text-gold { color: var(--gold) !important; }

/* ---------- Auth Page ---------- */
.auth-body {
  background: radial-gradient(ellipse at 30% 60%, #1a1204 0%, #0D0D0D 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
}

.auth-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(212,175,55,0.1);
  position: relative;
  z-index: 2;
}

.auth-brand { text-align: center; margin-bottom: 2.5rem; }

.auth-logo {
  font-size: 2.5rem;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 0.5rem;
  animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
  from { text-shadow: 0 0 10px rgba(212,175,55,0.3); }
  to   { text-shadow: 0 0 30px rgba(212,175,55,0.8), 0 0 60px rgba(212,175,55,0.3); }
}

.auth-title {
  font-size: 2rem;
  margin: 0;
  color: var(--white);
  letter-spacing: 2px;
}
.auth-title span { color: var(--gold); }
.auth-subtitle { color: var(--gray-400); font-size: 0.8rem; letter-spacing: 3px; text-transform: uppercase; margin-top: 0.3rem; }

.auth-form .form-label {
  color: var(--gray-400);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.auth-bg-pattern {
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at 80% 20%, rgba(212,175,55,0.05) 0%, transparent 50%),
                    radial-gradient(circle at 20% 80%, rgba(212,175,55,0.03) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.auth-demo { text-align: center; }
.auth-demo code { color: var(--gold); background: var(--gold-soft); padding: 2px 6px; border-radius: 4px; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--black-soft);
  border-right: 1px solid var(--black-border);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--black-border) transparent;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--black-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.brand-icon {
  font-size: 1.4rem;
  color: var(--gold);
  animation: glow 3s ease-in-out infinite alternate;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--white);
  letter-spacing: 1px;
}
.brand-name span { color: var(--gold); }

.sidebar-user {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--black-border);
  flex-shrink: 0;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--black);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; color: var(--white); }
.user-role { font-size: 0.7rem; color: var(--gray-400); text-transform: capitalize; }

.sidebar-nav {
  list-style: none;
  padding: 0.75rem 0;
  margin: 0;
  flex: 1;
}

.nav-section {
  font-size: 0.65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gray-600);
  padding: 1rem 1.25rem 0.4rem;
  font-weight: 600;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: var(--gray-400);
  font-size: 0.875rem;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}

.sidebar-nav .nav-link i {
  font-size: 1rem;
  width: 20px;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.04);
}

.sidebar-nav .nav-link.active {
  color: var(--gold);
  background: var(--gold-soft);
}

.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.badge-count {
  margin-left: auto;
  background: var(--gold);
  color: var(--black);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 1rem 0;
  border-top: 1px solid var(--black-border);
  flex-shrink: 0;
}

.logout-link { color: #EF4444 !important; }
.logout-link:hover { background: rgba(239,68,68,0.08) !important; }

/* ---------- MAIN WRAPPER ---------- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ---------- TOPBAR ---------- */
.topbar {
  height: var(--topbar-h);
  background: var(--black-soft);
  border-bottom: 1px solid var(--black-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--white);
}

.topbar-badge {
  position: relative;
  color: var(--gold);
  font-size: 1.2rem;
  padding: 0.25rem;
}

.badge-pulse {
  position: absolute;
  top: 0; right: 0;
  background: #EF4444;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 50%;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}

.topbar-date { color: var(--gray-400); font-size: 0.8rem; display: flex; align-items: center; gap: 0.4rem; }

/* ---------- PAGE CONTENT ---------- */
.page-content {
  flex: 1;
  padding: 1.75rem;
  max-width: 1600px;
  width: 100%;
}

.flash-container { padding: 1rem 1.75rem 0; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
  color: var(--white);
}

.breadcrumb { font-size: 0.8rem; }
.breadcrumb-item a { color: var(--gold); }
.breadcrumb-item.active { color: var(--gray-400); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--gray-600); }

/* ---------- GLASS CARDS ---------- */
.card-glass {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-glass-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--black-border);
  background: rgba(255,255,255,0.02);
}

.card-glass-body { padding: 1.25rem; }

.card-glass-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--black-border);
  background: rgba(255,255,255,0.01);
}

/* ---------- KPI CARDS ---------- */
.kpi-card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  border-color: rgba(212,175,55,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.kpi-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-gold   { background: var(--gold-soft); color: var(--gold); }
.kpi-blue   { background: rgba(59,130,246,0.12); color: #3B82F6; }
.kpi-green  { background: rgba(16,185,129,0.12); color: #10B981; }
.kpi-purple { background: rgba(139,92,246,0.12); color: #8B5CF6; }

.kpi-value  { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--white); }
.kpi-label  { font-size: 0.8rem; color: var(--gray-400); margin-top: 0.2rem; }
.kpi-sub    { font-size: 0.75rem; color: var(--gray-600); margin-top: 0.15rem; }

/* ---------- TABLES ---------- */
.table-elg { color: var(--white); margin: 0; }
.table-elg thead th {
  background: rgba(255,255,255,0.03);
  color: var(--gray-400);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  border-color: var(--black-border);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}
.table-elg tbody td {
  border-color: var(--black-border);
  padding: 0.85rem 1rem;
  vertical-align: middle;
  color: #1e1e1e;
}
.table-elg tbody tr:hover { background: rgba(255,255,255,0.02); }
.table-elg tbody tr:last-child td { border-bottom: none; }

/* ---------- FORM CONTROLS ---------- */
.form-control, .form-select {
  background: var(--black-soft);
  border: 1px solid var(--black-border);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  background: var(--black-soft);
  border-color: var(--gold);
  color: var(--white);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}
.form-control::placeholder { color: var(--gray-600); }
.form-label {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.form-label.required::after { content: ' *'; color: #EF4444; }
.form-select option { background: var(--black-card); color: var(--white); }

.input-icon { position: relative; }
.input-icon > i {
  position: absolute;
  left: 0.85rem;
  top: 50%; transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  z-index: 2;
}
.input-icon .form-control { padding-left: 2.4rem; }
.input-icon-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%; transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.25rem;
}
.input-icon-btn:hover { color: var(--gold); }

textarea.form-control { min-height: 80px; resize: vertical; }

/* ---------- BUTTONS ---------- */
.btn { border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500; transition: var(--transition); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--black);
  border: none;
  font-weight: 600;
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  color: var(--black);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212,175,55,0.3);
}

.btn-outline-gold {
  border: 1px solid var(--gold);
  color: var(--gold);
  background: transparent;
}
.btn-outline-gold:hover {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: var(--gold);
}

.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; border-radius: 4px; }
.btn-whatsapp { background: #25D366; color: white; border: none; }
.btn-whatsapp:hover { background: #128C7E; color: white; }

/* ---------- BADGES ---------- */
.badge-ref {
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 600;
  border: 1px solid rgba(212,175,55,0.2);
  white-space: nowrap;
}

.bg-gold-soft { background: var(--gold-soft); color: var(--gold); }
.bg-pink-soft { background: rgba(236,72,153,0.12); color: #EC4899; }
.bg-blue-soft { background: rgba(59,130,246,0.12); color: #3B82F6; }
.badge-bday   { background: rgba(245,158,11,0.15); color: #F59E0B; font-size: 0.7rem; padding: 2px 7px; border-radius: 20px; }

/* Badge Bootstrap overrides */
.badge.bg-primary   { background: #3B82F6 !important; }
.badge.bg-secondary { background: #6B7280 !important; }
.badge.bg-info      { background: #0EA5E9 !important; }
.badge.bg-warning   { background: #F59E0B !important; color: #111 !important; }
.badge.bg-success   { background: #10B981 !important; }
.badge.bg-danger    { background: #EF4444 !important; }
.badge.bg-dark      { background: #374151 !important; }

/* ---------- PAGINATION ---------- */
.pagination { gap: 3px; }
.page-link {
  background: var(--black-card);
  border-color: var(--black-border);
  color: var(--gray-400);
  border-radius: 6px !important;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}
.page-link:hover { background: var(--gold-soft); color: var(--gold); border-color: var(--gold); }
.page-item.active .page-link { background: var(--gold); border-color: var(--gold); color: var(--black); font-weight: 700; }

/* ---------- MODALS ---------- */
.modal-glass {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
}
.modal-glass .modal-header {
  border-color: var(--black-border);
  padding: 1.25rem 1.5rem;
}
.modal-glass .modal-footer { border-color: var(--black-border); }
.modal-glass .modal-title { font-family: 'Playfair Display', serif; }
.modal-glass .btn-close { filter: invert(1); }
.modal-backdrop { background-color: rgba(0,0,0,0.8); }

/* ---------- CLIENT AVATAR ---------- */
.client-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--black);
  font-weight: 700;
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.bday-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ---------- RANK BADGES ---------- */
.rank-badge {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg, #FFD700, #FFA500); color: #111; }
.rank-2 { background: linear-gradient(135deg, #C0C0C0, #A0A0A0); color: #111; }
.rank-3 { background: linear-gradient(135deg, #CD7F32, #A0522D); color: #fff; }
.rank-4, .rank-5 { background: var(--black-border); color: var(--gray-400); }

/* ---------- INFO LIST ---------- */
.info-list { margin: 0; }
.info-list dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-400);
  font-weight: 600;
  margin-top: 0.75rem;
}
.info-list dd { margin: 0.2rem 0 0; color: var(--white); }

/* ---------- FINANCE ROWS ---------- */
.finance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--black-border);
  font-size: 0.9rem;
}
.finance-row:last-child { border-bottom: none; }

/* ---------- TIMELINE ---------- */
.timeline { padding-left: 1.5rem; }
.timeline-item {
  position: relative;
  padding-left: 1.5rem;
  padding-bottom: 1.25rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 0;
  width: 2px;
  background: var(--black-border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute;
  left: -5px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--black-card);
}
.timeline-body {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}
.empty-state i { font-size: 2.5rem; color: var(--gray-600); }
.empty-state p { color: var(--gray-600); margin-top: 0.75rem; }

/* ---------- BIRTHDAY LIST ---------- */
.bday-list .list-group-item {
  background: transparent;
  border-color: var(--black-border);
  color: var(--white);
  padding: 0.85rem 1rem;
}
.bday-list .list-group-item:hover { background: rgba(255,255,255,0.02); }

/* ---------- ALERTS ---------- */
.alert-success { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: #10B981; }
.alert-danger  { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #EF4444; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #F59E0B; }
.alert .btn-close { filter: invert(1); }

/* ---------- DROPDOWN ---------- */
.dropdown-menu {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
}
.dropdown-item {
  color: var(--gray-400);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: var(--transition);
}
.dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--white); }

/* ---------- FORM ACTIONS ---------- */
.form-actions {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ---------- SIDEBAR OVERLAY (mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1040;
  backdrop-filter: blur(3px);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--black-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }

/* ---------- CHART CANVAS ---------- */
canvas { max-width: 100%; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1060;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 1rem; }
}

@media (max-width: 575.98px) {
  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { display: flex; gap: 0.5rem; }
  .kpi-value { font-size: 1.4rem; }
}

/* ---------- LIGHT THEME OVERRIDES ---------- */
html[data-theme="light"] {
  --black: #ffffff;
  --black-soft: #f4f5f7;
  --black-card: #ffffff;
  --black-border: #e5e7eb;
  --white: #111827;
  --gray-100: #1a1a1a;
  --gray-200: #2a2a2a;
  --gray-400: #6b7280;
  --gray-600: #9ca3af;
  background: #f4f5f7;
}

html[data-theme="light"] body {
  background: #f4f5f7;
  color: #111827;
}

html[data-theme="light"] .card-glass,
html[data-theme="light"] .modal-glass {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select {
  background: #f9fafb;
  color: #111827;
}

html[data-theme="light"] .form-control:focus, 
html[data-theme="light"] .form-select:focus {
  background: #ffffff;
}

html[data-theme="light"] .table-elg tbody td {
  color: #111827;
}

html[data-theme="light"] .theme-text,
html[data-theme="light"] .text-white {
  color: #111827 !important;
}

/* Ajustement des fonds transparents (qui étaient blancs) en noir transparent */
html[data-theme="light"] .table-elg tbody tr:hover,
html[data-theme="light"] .sidebar-nav .nav-link:hover,
html[data-theme="light"] .bday-list .list-group-item:hover {
  background: rgba(0,0,0,0.04);
}

html[data-theme="light"] .table-elg thead th,
html[data-theme="light"] .card-glass-header,
html[data-theme="light"] .timeline-body {
  background: rgba(0,0,0,0.02);
}

html[data-theme="light"] .card-glass-footer {
  background: rgba(0,0,0,0.01);
}

/* Rétablir les croix de fermeture en noir */
html[data-theme="light"] .alert .btn-close,
html[data-theme="light"] .modal-glass .btn-close {
  filter: none;
}