/* =============================================
   English School CRM — style.css
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700&family=Raleway:wght@600;700;800&display=swap');

/* ── Variables (Light Mode) ── */
:root {
  --green-50:   #f0faf4;
  --green-100:  #d6f2e0;
  --green-200:  #a8e0bc;
  --green-400:  #4caf79;
  --green-500:  #2e9e60;
  --green-600:  #1f7a47;
  --green-700:  #155c34;
  --navy-900:   #0b1a2e;
  --navy-800:   #112540;
  --gray-50:    #f8f9fa;
  --gray-100:   #f1f3f5;
  --gray-200:   #e9ecef;
  --gray-300:   #dee2e6;
  --gray-400:   #adb5bd;
  --gray-500:   #6c757d;
  --gray-700:   #343a40;
  --gray-900:   #212529;
  --red-500:    #e53e3e;
  --red-100:    #fff5f5;
  --yellow-500: #d69e2e;
  --yellow-100: #fffff0;

  --bg-primary:     #ffffff;
  --bg-secondary:   #f8fdf9;
  --bg-tertiary:    #f0faf4;
  --bg-sidebar:     #0f2137;

  --text-primary:   #1a2e1f;
  --text-secondary: #4a6552;
  --text-muted:     #7a9585;

  --accent:         #2e9e60;
  --accent-hover:   #1f7a47;
  --accent-light:   #d6f2e0;

  --border:         #d6e8dc;
  --border-strong:  #a8d4b4;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.10);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --sidebar-w:  240px;
  --topbar-h:   60px;

  --font-body:    'Nunito', sans-serif;
  --font-heading: 'Raleway', sans-serif;
  --transition: 0.2s ease;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --bg-primary:     #0f1e30;
  --bg-secondary:   #112540;
  --bg-tertiary:    #163052;
  --bg-sidebar:     #091422;
  --text-primary:   #e2f0e8;
  --text-secondary: #8fbfa0;
  --text-muted:     #567a66;
  --accent:         #3dba74;
  --accent-hover:   #4fd688;
  --accent-light:   #1a3d28;
  --border:         #1e4370;
  --border-strong:  #2a5a4a;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.5);
  --gray-50:    #112540;
  --gray-100:   #163052;
  --gray-200:   #1e4370;
  --gray-300:   #2a5a8a;
  --gray-500:   #5a8aaa;
  --gray-700:   #a0c4d8;
  --gray-900:   #e2f0f8;
  --red-100:    #2d1515;
  --yellow-100: #2d2510;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg-secondary); color: var(--text-primary); line-height: 1.6; min-height: 100vh; transition: background var(--transition), color var(--transition); }

/* ── Typography ── */
h1,h2,h3,h4,h5 { font-family: var(--font-heading); font-weight: 700; color: var(--text-primary); line-height: 1.3; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; } h4 { font-size: 1rem; }
p { color: var(--text-secondary); }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Layout ── */
.app-wrapper { display: flex; min-height: 100vh; }
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--transition); }
.page-body { padding: 28px 32px; flex: 1; }

/* ── Topbar ── */
.topbar { height: var(--topbar-h); background: var(--bg-primary); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.topbar-title { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ── Cards ── */
.card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }

/* ── Stat Cards ── */
.stat-card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), transform var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); background: var(--accent-light); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-info .stat-value { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-info .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius-md); font-family: var(--font-body); font-size: 0.875rem; font-weight: 600; border: none; cursor: pointer; transition: all var(--transition); white-space: nowrap; text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.badge-success { background: var(--green-100); color: var(--green-700); }
.badge-warning { background: var(--yellow-100); color: var(--yellow-500); }
.badge-danger  { background: var(--red-100);    color: var(--red-500); }
.badge-info    { background: #ebf8ff;            color: #2b6cb0; }
.badge-muted   { background: var(--gray-100);   color: var(--gray-500); }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-body); font-size: 0.9rem; transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,158,96,0.15); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-primary); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead tr { background: var(--bg-tertiary); border-bottom: 2px solid var(--border); }
thead th { padding: 13px 16px; text-align: left; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-tertiary); }
tbody td { padding: 13px 16px; color: var(--text-primary); vertical-align: middle; }

/* ── Search bar ── */
.search-bar { position: relative; display: inline-flex; align-items: center; width: 100%; }
.search-bar input { padding-left: 36px; }
.search-bar .search-icon { position: absolute; left: 11px; color: var(--text-muted); font-size: 15px; pointer-events: none; }

/* ── Page header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 1.6rem; }
.page-header p  { font-size: 0.875rem; color: var(--text-muted); margin-top: 2px; }

/* ── Grids ── */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
@media(max-width:1100px){ .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media(max-width:768px)  { .grid-4,.grid-3,.grid-2 { grid-template-columns: 1fr; } .main-content { margin-left: 0; } .page-body { padding: 16px; } }

/* ── Modal ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-primary); border-radius: var(--radius-xl); padding: 32px; width: 90%; max-width: 480px; box-shadow: var(--shadow-lg); animation: slideUp 0.22s ease; max-height: 90vh; overflow-y: auto; }
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); transition: color var(--transition); }
.modal-close:hover { color: var(--text-primary); }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-200); }
.alert-danger  { background: var(--red-100);  color: var(--red-500);   border: 1px solid #fed7d7; }

/* ── Lang / Theme ── */
.lang-switcher { display: flex; gap: 4px; background: var(--bg-tertiary); border-radius: var(--radius-md); padding: 4px; border: 1px solid var(--border); }
.lang-btn { padding: 4px 10px; border-radius: 6px; font-size: 0.78rem; font-weight: 700; cursor: pointer; border: none; background: transparent; color: var(--text-muted); transition: all var(--transition); letter-spacing: 0.03em; }
.lang-btn.active { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.theme-toggle { width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 17px; transition: all var(--transition); }
.theme-toggle:hover { background: var(--accent-light); border-color: var(--accent); }

/* ── Avatar ── */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; flex-shrink: 0; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ── Page loader ── */
#pageLoader { position: fixed; inset: 0; background: var(--bg-primary); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.loader-spinner { width: 40px; height: 40px; border: 3px solid var(--accent-light); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Utilities ── */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.flex{display:flex}.flex-center{display:flex;align-items:center;justify-content:center}
.gap-1{gap:8px}.gap-2{gap:16px}
.text-muted{color:var(--text-muted)}.text-success{color:var(--green-600)}.text-danger{color:var(--red-500)}
.text-center{text-align:center}.fw-bold{font-weight:700}.w-100{width:100%}.d-none{display:none}

/* ── Responsive ── */
@media(max-width:768px) {
  .page-body { padding: 16px; }
  .grid-4,.grid-3 { grid-template-columns: 1fr 1fr; }
}
@media(max-width:480px) {
  .grid-4,.grid-3,.grid-2 { grid-template-columns: 1fr; }
}
