/* public/css/pages.css */

/**
 * KB Medizin Technik - Pages
 * Theme: Medical Clean
 * Refonte: Login épuré, Dashboard harmonisé, Fiches techniques précises
 */

/* ==========================================================================
   1. LOGIN PAGE (Nouvelle version "Clinique")
   ========================================================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  /* Fond doux et lumineux au lieu du bleu sombre */
  background: linear-gradient(135deg, var(--neutral-50) 0%, var(--color-primary-light) 100%);
  position: relative;
  overflow: hidden;
}

/* Forme décorative d'arrière-plan (optionnel, pour la texture) */
.login-container::before {
  content: '';
  position: absolute;
  top: -10%; right: -10%;
  width: 50vw; height: 50vw;
  background: radial-gradient(circle, rgba(2, 119, 189, 0.05) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-box {
  background: var(--neutral-white);
  padding: 3rem; /* Espace interne généreux */
  border-radius: var(--radius-xl);
  /* Ombre douce et profonde */
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 10;
  border: 1px solid var(--border-color-light);
}

.login-logo {
  width: 80px;
  height: 80px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 24px; /* Forme "Squircle" moderne */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 2rem auto;
  box-shadow: 0 4px 6px -1px rgba(2, 119, 189, 0.2);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary); /* Bleu médical */
  letter-spacing: -0.02em;
}

.login-subtitle {
  text-align: center;
  color: var(--neutral-500);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
}

.login-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color-light);
  color: var(--neutral-400);
}

.login-footer a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}
.login-footer a:hover { text-decoration: underline; }

/* ==========================================================================
   2. TABLE CONTROLS (Filtres, Recherche)
   ========================================================================== */
.table-controls { margin: 2rem 0; }

.table-controls-row {
  background: var(--neutral-white);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.search-box {
  flex: 1 1 250px;
  position: relative;
  min-width: 200px;
}

.search-box input {
  width: 100%;
  padding-left: 2.5rem !important; /* Place pour l'icône */
  border-radius: var(--radius-md);
}

.search-box::before {
  content: '\f002'; /* FontAwesome Search */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--neutral-400);
  pointer-events: none;
}

.table-controls-row select,
.table-controls-row input:not(#global-search) {
  flex: 0 1 auto;
  min-width: 140px;
  max-width: 220px;
}

#limit-select { width: auto; min-width: 90px; }

.table-controls-row.advanced-filters {
  margin-top: 1rem;
  background: var(--neutral-50);
  border: 1px dashed var(--border-color);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.table-controls-row.advanced-filters.hidden { display: none; }

/* ==========================================================================
   3. DASHBOARD (Stats & Widgets)
   ========================================================================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }

.stat-card {
  background: white; padding: 1.5rem; border-radius: var(--radius-lg);
  border: 1px solid var(--border-color); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.stat-card-header h3 { font-size: 0.8rem; color: var(--neutral-500); margin: 0; text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; }

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

/* Couleurs des stats harmonisées */
.stat-card.danger .stat-card-icon { background: var(--status-expire-bg); color: var(--color-danger); }
.stat-card.warning .stat-card-icon { background: var(--status-soon-bg); color: var(--color-warning); }
.stat-card.success .stat-card-icon { background: var(--status-jour-bg); color: var(--color-success); }
.stat-card.info .stat-card-icon { background: var(--color-primary-light); color: var(--color-primary); }

.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--neutral-900); letter-spacing: -0.02em; }

/* --- WIDGETS --- */
.widgets-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); 
  gap: 1.5rem; 
  align-items: start;
}

.widget { 
  background: white; 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-sm); 
  overflow: hidden;
  display: flex; flex-direction: column;
}

.widget-header { 
  padding: 1.25rem 1.5rem; 
  border-bottom: 1px solid var(--border-color); 
  background: var(--neutral-50); 
  display: flex; justify-content: space-between; align-items: center; 
}
.widget-header h2 { font-size: 0.95rem; font-weight: 700; margin: 0; color: var(--neutral-800); display: flex; align-items: center; gap: 0.5rem; }

.widget-content { flex: 1; display: flex; flex-direction: column; min-height: 100px; }

.widget-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2rem; color: var(--neutral-500); font-style: italic; background: var(--neutral-50);
}

.widget-item { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color-light); transition: background 0.2s; }
.widget-item:hover { background: var(--neutral-50); }
.widget-item strong { display: block; font-size: 0.9rem; color: var(--neutral-900); margin-bottom: 0.2rem; }
.widget-item small { color: var(--neutral-500); font-size: 0.8rem; display: flex; align-items: center; gap: 0.4rem; }

/* --- MAP --- */
#map { height: 600px !important; width: 100%; border-radius: 0 0 var(--radius-lg) var(--radius-lg); z-index: 1; }
.map-filters { padding: 1rem; background: white; border-bottom: 1px solid var(--border-color); display: flex; gap: 0.5rem; flex-wrap: wrap; }

.map-filter-btn { 
  padding: 0.5rem 1rem; border: 1px solid var(--border-color); background: white; 
  border-radius: var(--radius-md); font-size: 0.85rem; cursor: pointer; 
  display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s; 
}
.map-filter-btn:hover { background: var(--neutral-50); border-color: var(--neutral-400); }
.map-filter-btn.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* Popup Map Style */
.leaflet-popup-content-wrapper { border-radius: var(--radius-lg) !important; padding: 0 !important; overflow: hidden; }
.leaflet-popup-content { margin: 0 !important; width: 300px !important; }

.map-popup-header {
  background: var(--gradient-primary);
  color: white; padding: 1rem;
}
.map-popup-header h3 { color: white !important; margin: 0; font-size: 1rem; font-weight: 600; }

.map-popup-body { padding: 1rem; }
.map-info-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--neutral-700); }
.map-info-row i { color: var(--color-primary); width: 20px; text-align: center; }

/* ==========================================================================
   4. CHECKLISTS (Cards & Views)
   ========================================================================== */
.checklists-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem;
}

.checklist-card {
  background: white; border-radius: var(--radius-lg); border: 1px solid var(--border-color);
  padding: 1.5rem; display: flex; flex-direction: column;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--shadow-sm);
  cursor: pointer; position: relative; overflow: hidden;
}

.checklist-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--color-primary-light); }
.checklist-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--gradient-primary); opacity: 0; transition: opacity 0.2s;
}
.checklist-card:hover::before { opacity: 1; }

.checklist-card-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--neutral-900); margin-bottom: 0.5rem; }
.checklist-card-description { font-size: 0.9rem; color: var(--neutral-500); margin-bottom: 1.5rem; flex: 1; }

.checklist-card-stats {
  display: flex; gap: 1rem; margin-bottom: 1.5rem; padding: 0.75rem;
  background: var(--neutral-50); border-radius: var(--radius-md);
}
.checklist-stat { font-size: 0.8rem; font-weight: 600; color: var(--neutral-600); display: flex; align-items: center; gap: 0.5rem; }
.checklist-stat i { color: var(--color-secondary); /* Vert Sarcelle */ }

/* Checklist Detail View */
.checklist-header-card {
  background: white; border-radius: var(--radius-xl); padding: 2.5rem; margin-bottom: 2rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); position: relative; overflow: hidden;
}
.checklist-header-card::after {
  content: ''; position: absolute; top: -50%; right: -10%; width: 300px; height: 300px;
  background: radial-gradient(circle, var(--color-primary-light) 0%, transparent 70%); opacity: 0.4; pointer-events: none;
}

.checklist-title { font-size: 2rem; font-weight: 800; color: var(--neutral-900); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 1rem; }
.checklist-icon-box {
  width: 56px; height: 56px; background: var(--gradient-primary); color: white;
  border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.75rem;
}

.checklist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 1024px) { .checklist-grid { grid-template-columns: 1fr; } }

.checklist-box { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border-color); overflow: hidden; height: 100%; }
.checklist-box-header { padding: 1.25rem 1.5rem; background: var(--neutral-50); border-bottom: 1px solid var(--border-color); }
.checklist-box-title { font-size: 1.1rem; font-weight: 700; color: var(--neutral-800); }

.check-item {
  display: flex; align-items: flex-start; padding: 1rem; background: white;
  border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-bottom: 0.75rem;
  cursor: pointer; transition: all 0.2s;
}
.check-item:hover { border-color: var(--color-secondary); box-shadow: var(--shadow-sm); }

.check-item.is-checked { background: var(--status-jour-bg); border-color: var(--status-jour-border); }
.check-item.is-checked .check-text { color: var(--status-jour-text); text-decoration: line-through; opacity: 0.8; }

.check-circle {
  width: 24px; height: 24px; border: 2px solid var(--neutral-300); border-radius: 6px;
  margin-right: 1rem; display: flex; align-items: center; justify-content: center; background: white;
}
.check-item.is-checked .check-circle { background: var(--color-success); border-color: var(--color-success); color: white; }

/* ==========================================================================
   5. EQUIPMENTS BADGES & CLIENT DETAILS (Annuaire)
   ========================================================================== */
.equipment-badges { display: flex; flex-direction: column; gap: 0.5rem; }

.equipment-badge-item {
  display: grid; grid-template-columns: 1fr 90px 100px;
  align-items: center; gap: 0.75rem; padding: 0.4rem 0.75rem;
  background: white; border: 1px solid var(--border-color-light); border-radius: var(--radius-sm);
}
.equipment-badge-item:hover { background: var(--neutral-50); border-color: var(--color-primary-light); }

.equipment-badge-name { font-weight: 600; color: var(--neutral-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.equipment-badge-days {
  font-size: 0.7rem; color: var(--neutral-600); background: var(--neutral-100);
  padding: 2px 6px; border-radius: 4px; text-align: center; justify-self: end;
}

/* Modales Client Details */
.client-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }

.detail-block {
  background: var(--neutral-50); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 1.5rem; transition: all 0.2s;
}
.detail-block:hover { background: white; box-shadow: var(--shadow-sm); border-color: var(--color-primary-light); }

.detail-block-title {
  display: flex; align-items: center; gap: 0.75rem; color: var(--neutral-900); margin-bottom: 1.25rem; font-size: 1rem; font-weight: 600;
  border-bottom: 2px solid var(--color-primary-light); padding-bottom: 0.75rem;
}
.detail-block-title i { color: var(--color-primary); background: white; padding: 8px; border-radius: 50%; box-shadow: var(--shadow-sm); }

.detail-row { display: flex; justify-content: space-between; margin-bottom: 0.75rem; font-size: 0.9rem; border-bottom: 1px dashed var(--neutral-200); padding-bottom: 0.5rem; }
.detail-row:last-child { border: none; }
.detail-label { color: var(--neutral-500); }
.detail-value { color: var(--neutral-900); font-weight: 600; }