/* ═══════════════════════════════════════════════════════════════
   LOVECHAT ADMIN — CSS REFACTORISE
   Structure : Variables > Base > Layout > Components > Pages > Responsive
   ═══════════════════════════════════════════════════════════════ */

/* ─── 1. VARIABLES & RESET ───────────────────────────────────── */
:root {
  --bg-body: #0f172a;
  --bg-surface: #141420;
  --bg-card: #1e1e2e;
  --bg-hover: rgba(99, 102, 241, 0.08);
  
  --text-main: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  
  --border-color: rgba(255, 255, 255, 0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-secondary);
  margin: 0;
  overflow-x: hidden;
}

/* ─── 2. TYPOGRAPHY ──────────────────────────────────────────── */
h1, h2, h3, h4,
.font-bold, .text-2xl, .text-3xl {
  color: var(--text-main) !important;
}

.text-gray-600, .text-gray-500 {
  color: var(--text-secondary) !important;
}

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

/* ─── 3. LAYOUT PRINCIPAL ────────────────────────────────────── */
main {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  background-color: var(--bg-body);
  overflow-y: auto;
  overflow-x: hidden;
}

/* ─── 4. COMPOSANTS GLOBAUX ──────────────────────────────────── */

/* Cartes & Containers */
.bg-white {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3) !important;
  border-radius: var(--radius) !important;
}

/* Forms */
select, input {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: 8px !important;
  padding: 0.6rem 1rem !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus, input:focus {
  border-color: var(--accent-primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Boutons */
button.bg-red-600 {
  background: linear-gradient(135deg, var(--accent-danger) 0%, #dc2626 100%) !important;
  border: none;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}
button.bg-red-600:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

button.bg-green-600 {
  background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%) !important;
  border: none;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}
button.bg-green-600:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Badges & Pills */
.bg-blue-600 {
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  font-weight: 700 !important;
}

.bg-blue-100 { background: rgba(99, 102, 241, 0.15) !important; color: #a5b4fc !important; border: 1px solid rgba(99, 102, 241, 0.3); }
.bg-green-100 { background: rgba(16, 185, 129, 0.15) !important; color: #6ee7b7 !important; border: 1px solid rgba(16, 185, 129, 0.3); }
.bg-red-100 { background: rgba(239, 68, 68, 0.15) !important; color: #fca5a5 !important; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Liens */
a.text-blue-600 {
  color: #818cf8 !important;
  font-weight: 600;
  transition: color 0.2s;
}
a.text-blue-600:hover {
  color: var(--text-main) !important;
}

/* Alertes */
.bg-green-50 { background: rgba(16, 185, 129, 0.1) !important; color: #6ee7b7 !important; border-left: 4px solid var(--accent-success); }
.bg-red-50 { background: rgba(239, 68, 68, 0.1) !important; color: #fca5a5 !important; border-left: 4px solid var(--accent-danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════════
   5. PAGE : LISTE CONVERSATIONS
   ═══════════════════════════════════════════════════════════════ */

/* Table Header */
.bg-gray-50 { background: rgba(0,0,0,0.2) !important; }
.divide-gray-200 > * { border-color: var(--border-color) !important; }

th {
  color: var(--text-secondary) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 1rem 1.5rem !important;
}

/* Table Body */
tbody tr {
  transition: background 0.15s ease !important;
  cursor: pointer;
}

tbody tr:hover {
  background: var(--bg-hover) !important;
}

td {
  color: #e2e8f0 !important;
  padding: 1rem 1.5rem !important;
  font-size: 0.9rem !important;
  border-bottom: 1px solid var(--border-color) !important;
}

/* ═══════════════════════════════════════════════════════════════
   6. PAGE : DETAIL CONVERSATION
   ═══════════════════════════════════════════════════════════════ */

/* Header Card */
.bg-white.rounded-lg.shadow.p-6.mb-6 {
  background: linear-gradient(180deg, rgba(30, 30, 50, 0.6) 0%, rgba(20, 20, 32, 0.8) 100%);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.grid.grid-cols-3.gap-4 {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem !important;
}

/* Chat Bubbles */
.flex.flex-col.items-end { align-items: flex-end; } /* User */
.flex.flex-col.items-start { align-items: flex-start; } /* Bot */

.bg-blue-50 {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
  color: #fff !important;
  border-radius: 16px 16px 4px 16px !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  padding: 1rem 1.25rem !important;
  max-width: 70%;
}

.bg-gray-50 {
  background: var(--bg-card) !important;
  color: #e2e8f0 !important;
  border: 1px solid var(--border-color);
  border-radius: 16px 16px 16px 4px !important;
  padding: 1rem 1.25rem !important;
  max-width: 70%;
}

/* Correction texte dans bulles */
.bg-gray-50 p, .bg-blue-50 p { color: inherit !important; }

/* ═══════════════════════════════════════════════════════════════
   7. RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  main { padding: 1.25rem !important; }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Mobile */
@media (max-width: 768px) {
  main { padding: 1rem !important; }

  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr !important; }

  .flex.justify-between.items-center,
  .flex.justify-between.items-start {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  form .flex.gap-3 { flex-direction: column !important; }
  form .flex.gap-3 > * { width: 100% !important; }

  th, td { padding: 0.75rem !important; font-size: 0.8rem !important; }
  
  .fixed.inset-0 > div {
    width: 100% !important; max-width: 100% !important; margin: 0 !important;
    border-radius: 0 !important; height: 100vh !important; max-height: 100vh !important;
  }
  
  .max-w-2xl { max-width: 100% !important; }
  .text-3xl { font-size: 1.5rem !important; }
}

/* Small Mobile */
@media (max-width: 480px) {
  main { padding: 0.75rem !important; }
  h1 { font-size: 1.2rem !important; }
  .text-3xl { font-size: 1.25rem !important; }
}