/* style.css - Design moderne, responsive et accessible pour le portail parents Élimu */

:root {
  /* Couleurs de base - Thème Sombre (Défaut) */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #21262d;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --border: #30363d;
  --radius-lg: 12px;
  --radius-md: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #afb8c1;
  --border: #d0d7de;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, .brand-font { font-family: 'Rajdhani', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* Accessibilité tactile */
button, input, select { min-height: 44px; min-width: 44px; font-family: inherit; }

/* Animations */
.animate-in { animation: fadeInUp 0.5s ease-out forwards; opacity: 0; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Layout */
.dashboard-container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Navbar */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: var(--shadow);
}

.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; }
.nav-actions { display: flex; align-items: center; gap: 12px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; font-weight: 600; transition: var(--transition);
  font-size: 0.9rem; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-primary); border-color: var(--text-secondary); }
.btn-icon { padding: 8px; border-radius: 50%; }

/* Login Page */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: radial-gradient(circle at top right, var(--accent-glow), transparent);
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 40px 30px; border-radius: var(--radius-lg); width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 30px; color: var(--accent); }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header p { color: var(--text-secondary); margin-top: 8px; }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: var(--text-secondary); }
.input-group input {
  width: 100%; padding: 12px 16px; background: var(--bg-primary);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 1rem; transition: var(--transition);
}
.input-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.tel-input-container { 
  display: flex; 
  background: var(--bg-primary);
  border: 1px solid var(--border); 
  border-radius: var(--radius-md);
  transition: var(--transition);
  overflow: hidden;
}
.tel-input-container:focus-within { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 3px var(--accent-glow); 
}

.country-select {
  flex: 0 0 100px; 
  padding: 0 5px 0 10px;
  background: transparent;
  border: none;
  color: var(--text-primary); 
  font-size: 0.9rem; 
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.country-select:focus { outline: none; }

.tel-input-container input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 12px 12px !important;
}

.password-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-container input {
  width: 100%;
  padding-right: 45px !important; /* Espace pour l'icône */
}

.password-toggle-btn {
  position: absolute;
  right: 5px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  min-width: auto;
  min-height: auto;
  transition: var(--transition);
}

.password-toggle-btn:hover {
  color: var(--accent);
}

/* Login Options & Checkbox */
.login-options {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 30px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--accent);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--accent);
  border-color: var(--accent);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Dashboard UI */
.child-selector-wrapper { margin-bottom: 30px; }

/* Mobile Select */
.mobile-select {
  width: 100%; padding: 12px 16px; background: var(--bg-card);
  border: 2px solid var(--accent); border-radius: var(--radius-md);
  color: var(--text-primary); font-weight: 700; font-size: 1.1rem;
  display: none; cursor: pointer;
}

/* Desktop Tabs */
.desktop-tabs { display: flex; gap: 12px; border-bottom: 1px solid var(--border); overflow-x: auto; padding-bottom: 2px; }
.tab-btn {
  padding: 12px 20px; background: none; border: none; color: var(--text-secondary);
  cursor: pointer; border-bottom: 3px solid transparent; transition: var(--transition);
  font-weight: 600; white-space: nowrap; font-size: 0.95rem;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Summary Grid */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
.summary-card {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 24px; border-radius: var(--radius-lg); display: flex; align-items: center; gap: 20px;
  box-shadow: var(--shadow); transition: var(--transition);
}
.summary-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.summary-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.summary-icon.blue { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.summary-icon.orange { background: rgba(210, 153, 34, 0.15); color: var(--warning); }
.summary-icon.green { background: rgba(63, 185, 80, 0.15); color: var(--success); }

.summary-info h4 { font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 4px; }
.summary-info .value { font-size: 1.5rem; font-weight: 800; }

/* Sections */
.section-header { display: flex; align-items: center; gap: 12px; margin: 40px 0 20px; }
.section-header h2 { font-size: 1.4rem; color: var(--text-primary); }
.section-header svg { color: var(--accent); }

/* Notes Grid */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.note-card {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 20px; border-radius: var(--radius-lg); position: relative;
  transition: var(--transition);
}
.note-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.note-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; }
.note-card-header h3 { font-size: 1.1rem; text-transform: none; font-family: inherit; }
/* Badges de notes renforcés */
.note-badge {
  padding: 6px 12px; border-radius: 20px; font-weight: 800; font-size: 1rem;
  border: 1px solid transparent;
}
.note-excellent { background: rgba(63, 185, 80, 0.15); color: var(--success); border-color: rgba(63, 185, 80, 0.3); }
.note-average { background: rgba(210, 153, 34, 0.15); color: var(--warning); border-color: rgba(210, 153, 34, 0.3); }
.note-low { background: rgba(248, 81, 73, 0.15); color: var(--danger); border-color: rgba(248, 81, 73, 0.3); }

[data-theme="light"] .note-excellent { background: #dafbe1; border-color: #4ac26b; }
[data-theme="light"] .note-average { background: #fff5b8; border-color: #d29922; }
[data-theme="light"] .note-low { background: #ffebe9; border-color: #ff8182; }

.note-meta { font-size: 0.85rem; color: var(--text-secondary); display: flex; gap: 12px; margin-bottom: 15px; }
.note-progress-bg { height: 10px; background: var(--bg-primary); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.note-progress-fill { height: 100%; border-radius: 5px; transition: width 1s ease-out; opacity: 0.9; }

/* Barres de progression opaques pour plus de punch */
.note-progress-fill.note-excellent { background-color: var(--success); box-shadow: 0 0 10px rgba(63, 185, 80, 0.3); }
.note-progress-fill.note-average { background-color: var(--warning); box-shadow: 0 0 10px rgba(210, 153, 34, 0.3); }
.note-progress-fill.note-low { background-color: var(--danger); box-shadow: 0 0 10px rgba(248, 81, 73, 0.3); }

/* Absences Section */
.absences-list { display: grid; gap: 15px; }
.absence-item {
  background: var(--bg-card); border: 1px solid var(--border); padding: 16px 20px;
  border-radius: var(--radius-md); display: flex; justify-content: space-between; align-items: center;
}
.absence-info b { font-size: 1.1rem; }

/* Payments Table Card */
.payment-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
}
.payment-table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { text-align: left; padding: 16px; background: var(--bg-secondary); color: var(--text-secondary); font-size: 0.85rem; }
td { padding: 16px; border-top: 1px solid var(--border); }
.status-pill { padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.status-paid { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.status-pending { background: rgba(248, 81, 73, 0.15); color: var(--danger); }

/* Chart Section */
.chart-card {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 24px; border-radius: var(--radius-lg); margin-bottom: 30px;
}
.chart-container { position: relative; height: 300px; width: 100%; }

/* Responsive */
@media (max-width: 768px) {
  .dashboard-container { padding: 15px; }
  .navbar { padding: 0 15px; }
  .nav-brand span { display: none; }
  
  .desktop-tabs { display: none; }
  .mobile-select { display: block; }
  
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { padding: 16px; }
  
  .notes-grid { grid-template-columns: 1fr; }
  
  .chart-container { height: 250px; }
  
  .section-header h2 { font-size: 1.2rem; }
}

/* Icons */
.svg-icon { width: 20px; height: 20px; fill: currentColor; display: inline-block; vertical-align: middle; }
.svg-icon-lg { width: 32px; height: 32px; }

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 15px;
}

/* Print Styles */
@media print {
  .navbar, .filters, .btn-icon, #lang-toggle, .password-toggle-btn, .chart-card {
    display: none !important;
  }
  body { background: white; color: black; }
  .dashboard-container { padding: 0; width: 100%; max-width: none; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
  .summary-card { border: 1px solid #ddd; box-shadow: none; color: black; }
  .note-card { border: 1px solid #ddd; break-inside: avoid; }
  .section-header h2 { color: black; }
  .note-progress-bg { border: 1px solid #ddd; }
  .payment-card { border: 1px solid #ddd; }
  th { background: #f0f0f0; color: black; }
}
