/* ============================================================
   SimplyCool ERP - Main Stylesheet
   Clean, professional, responsive UI
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #3b5bdb;
  --primary-dk: #2f4ac7;
  --success:    #2f9e44;
  --danger:     #c92a2a;
  --warning:    #e67700;
  --info:       #1971c2;
  --bg:         #f4f6fb;
  --card-bg:    #ffffff;
  --text:       #1a1a2e;
  --text-muted: #6c757d;
  --border:     #dee2f0;
  --nav-bg:     #1e2a5e;
  --nav-text:   #e8eaf6;
  --radius:     8px;
  --shadow:     0 2px 8px rgba(0,0,0,0.08);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ---- NAVBAR ---- */
.navbar {
  background: var(--nav-bg);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.brand-emoji  { font-size: 1.5rem; }
.brand-name   { font-size: 1.1rem; font-weight: 700; color: #e8f4fd; letter-spacing: 0.3px; }
.navbar-menu  { display: flex; list-style: none; gap: 4px; flex: 1; }
.navbar-menu a {
  color: var(--nav-text);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 13px;
  transition: background 0.15s;
}
.navbar-menu a:hover { background: rgba(255,255,255,0.15); }
.navbar-user  { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-name    { color: #ccd0e0; font-size: 13px; }
.user-role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.role-super_admin  { background: #e8d5ff; color: #6200ea; }
.role-school_admin { background: #d0efff; color: #005fa3; }
.role-accountant   { background: #d4f4dd; color: #1a7a33; }
.role-teacher      { background: #fff0cc; color: #8a5c00; }
.role-student      { background: #ffe0f0; color: #9a0059; }
.btn-logout {
  color: #ffcdd2; font-size: 12px; text-decoration: none; padding: 4px 10px;
  border: 1px solid rgba(255,100,100,0.4); border-radius: 4px;
  transition: all 0.15s;
}
.btn-logout:hover { background: rgba(255,100,100,0.2); color: #fff; }

/* ---- MAIN CONTAINER ---- */
.main-container { padding: 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: #1e2a5e; flex: 1; display: flex; align-items: center; gap: 8px; }
.page-header h1 i { font-size: 1.5rem; line-height: 1; }
.page-header p  { color: var(--text-muted); width: 100%; margin-top: -0.5rem; }

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #f8f9ff;
}
.card-header h3 { font-size: 1rem; font-weight: 600; color: #1e2a5e; display: flex; align-items: center; gap: 6px; }
.card-header h3 i { font-size: 1.05rem; line-height: 1; }
.card-body { padding: 1.25rem; }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
}
.stat-card.stat-green { border-top-color: var(--success); }
.stat-card.stat-red   { border-top-color: var(--danger);  }
.stat-card.stat-blue  { border-top-color: var(--info);    }
.stat-icon  { font-size: 2rem; margin-bottom: 0.5rem; line-height: 1; }
.stat-icon i { font-size: 2rem; color: var(--primary); }
.stat-green .stat-icon i { color: var(--success); }
.stat-red   .stat-icon i { color: var(--danger); }
.stat-blue  .stat-icon i { color: var(--info); }
.stat-value { font-size: 1.8rem; font-weight: 700; color: #1e2a5e; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ---- QUICK ACTIONS ---- */
.quick-actions { margin-bottom: 1.5rem; }
.quick-actions h3 { margin-bottom: 0.75rem; font-size: 1rem; color: var(--text-muted); }
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.action-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.action-card:hover { border-color: var(--primary); background: #f0f4ff; transform: translateY(-2px); }
.action-icon { font-size: 1.8rem; line-height: 1; }
i.action-icon { font-size: 1.8rem; color: var(--primary); line-height: 1; }
.action-card:hover i.action-icon { color: var(--primary-dk); }

/* ---- TABLES ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: #f0f4ff;
  color: #1e2a5e;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid #eef0f8; vertical-align: middle; }
.data-table tr:hover td { background: #f8f9ff; }
.data-table tfoot td, .data-table tfoot th {
  padding: 10px 12px;
  border-top: 2px solid var(--border);
  font-weight: 600;
}

.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th { width: 160px; padding: 8px 12px; text-align: left; color: var(--text-muted); vertical-align: top; }
.detail-table td { padding: 8px 12px; border-bottom: 1px solid #eef0f8; }

/* ---- FORMS ---- */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; flex: 1; }
.form-group label { font-weight: 600; font-size: 13px; color: #444; }
.form-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.form-row .form-group { min-width: 200px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,91,219,0.1);
}
.amount-input { text-align: right; max-width: 120px; }
small { color: var(--text-muted); font-size: 11px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dk); }
.btn-secondary { background: #eef0f8; color: #333; border: 1px solid var(--border); }
.btn-secondary:hover { background: #e0e4f0; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-sm        { padding: 4px 10px; font-size: 12px; }
.btn-block     { width: 100%; justify-content: center; padding: 10px; }

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #d3f9d8; color: #1a7a33; }
.badge-danger  { background: #ffe3e3; color: #c92a2a; }
.badge-warning { background: #fff3bf; color: #856404; }
.badge-info    { background: #d0ebff; color: #1971c2; }

/* ---- ALERTS ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 13px;
  border-left: 4px solid;
}
.alert-success { background: #d3f9d8; border-color: var(--success); color: #1a5929; }
.alert-error   { background: #ffe3e3; border-color: var(--danger);  color: #7a1a1a; }
.alert-warning { background: #fff3bf; border-color: var(--warning); color: #664d00; }
.alert-info    { background: #d0ebff; border-color: var(--info);    color: #0c3d6e; }
.alert ul      { margin-left: 1.2rem; }

/* ---- LOGIN PAGE ---- */
.login-body {
  background: linear-gradient(135deg, #1e2a5e 0%, #3b5bdb 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-wrapper { width: 100%; max-width: 420px; }
.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #fff;
}
.login-brand .brand-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.login-brand h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.login-brand p  { color: rgba(255,255,255,0.75); font-size: 14px; }
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-card h2 { font-size: 1.3rem; margin-bottom: 1.25rem; color: #1e2a5e; }
.login-footer { text-align: center; color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 1rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .main-container { padding: 1rem; }
  .navbar { height: auto; flex-wrap: wrap; padding: 0.5rem 1rem; gap: 0.5rem; }
  .navbar-menu { display: none; }
  .form-row { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 7px 8px; }
  .btn { font-size: 12px; padding: 6px 12px; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ---- TABLE RESPONSIVE WRAPPER ---- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- GLOBAL INPUT SIZING ---- */
@media (max-width: 480px) {
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="date"], select, textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
  }
}
