/* ============================================================
   SIR SYED MISSION SCHOOL (SSMS) — School ERP Master Stylesheet
   Theme: Islamic Mission Modern Green & Gold | High Responsiveness
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700;800&display=swap');

:root {
  --primary-dark:   #0A2816;
  --primary:        #0F3D25;
  --primary-mid:    #1B5E3B;
  --primary-light:  #2D7A55;
  --primary-pale:   #EAF4EE;
  --primary-subtle: #F4F9F6;
  
  --gold:           #C9A84C;
  --gold-dark:      #9E7520;
  --gold-light:     #EBD68C;
  --gold-pale:      #FDF9EE;

  --success:        #10B981;
  --success-bg:     #D1FAE5;
  --warning:        #F59E0B;
  --warning-bg:     #FEF3C7;
  --danger:         #EF4444;
  --danger-bg:      #FEE2E2;
  --info:           #3B82F6;
  --info-bg:        #DBEAFE;

  --white:          #FFFFFF;
  --bg-main:        #F8FAF9;
  --card-bg:        #FFFFFF;
  --text-dark:      #111827;
  --text-mid:       #374151;
  --text-light:     #6B7280;
  --border:         #E5E7EB;

  --sidebar-w:      260px;
  --header-h:       68px;
  --radius-sm:      6px;
  --radius:         12px;
  --radius-lg:      18px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.05);
  --shadow:         0 4px 16px rgba(15,61,37,0.06);
  --shadow-lg:      0 10px 30px rgba(15,61,37,0.1);
  --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ─── ERP Layout ─── */
.erp-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ─── Sidebar ─── */
.erp-sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  box-shadow: 2px 0 20px rgba(0,0,0,0.15);
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-mid), var(--primary));
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1.2;
}
.sidebar-brand-subtitle {
  font-size: 0.72rem;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.sidebar-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-heading {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  padding: 12px 12px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  transition: var(--transition);
}
.sidebar-link i { width: 20px; font-size: 1rem; color: var(--gold-light); text-align: center; }
.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(201, 168, 76, 0.15);
  color: var(--white);
}
.sidebar-link.active i { color: var(--gold); }
.sidebar-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 50px;
}

.sidebar-user {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  background: var(--primary-mid);
  border: 1px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--gold-light);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--gold-light);
  text-transform: capitalize;
}

/* ─── Main Content Area ─── */
.erp-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-w));
}

/* ─── Header ─── */
.erp-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.erp-header-left { display: flex; align-items: center; gap: 16px; }
.erp-toggle-sidebar {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-dark);
  cursor: pointer;
}
.erp-page-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.erp-header-right { display: flex; align-items: center; gap: 14px; }
.erp-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: var(--primary-mid);
  color: var(--white);
  transition: var(--transition);
}
.erp-btn-action:hover { background: var(--primary-dark); }
.erp-btn-gold {
  background: var(--gold);
  color: var(--primary-dark);
}
.erp-btn-gold:hover { background: var(--gold-dark); color: var(--white); }

/* ─── Body Container ─── */
.erp-content {
  padding: 24px;
  flex: 1;
}

/* ─── Cards & Grid ─── */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card-info h4 { font-size: 0.82rem; color: var(--text-light); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-card-info .stat-val { font-size: 1.7rem; font-weight: 800; color: var(--primary-dark); }
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.icon-green { background: var(--primary-pale); color: var(--primary-mid); }
.icon-gold  { background: var(--gold-pale);  color: var(--gold-dark); }
.icon-red   { background: var(--danger-bg);  color: var(--danger); }
.icon-blue  { background: var(--info-bg);    color: var(--info); }

.erp-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}
.erp-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.erp-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.erp-card-body { padding: 22px; }

/* ─── SPREADSHEET / MATRIX FEE GRID ─── */
.matrix-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  background: var(--primary-subtle);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.matrix-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.matrix-filter-control {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--white);
}

.spreadsheet-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  position: relative;
  max-height: 65vh;
}

.spreadsheet-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  min-width: 1100px;
}

.spreadsheet-table th,
.spreadsheet-table td {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.spreadsheet-table th {
  background: var(--primary-dark);
  color: var(--white);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 10;
}
.spreadsheet-table th.col-sticky,
.spreadsheet-table td.col-sticky {
  position: sticky;
  left: 0;
  z-index: 12;
  background: #F4F9F6;
  border-right: 2px solid var(--primary-mid);
  font-weight: 700;
  min-width: 180px;
}
.spreadsheet-table th.col-sticky {
  background: var(--primary-dark);
  z-index: 15;
}

.spreadsheet-table tr:hover td {
  background: #FDFBF7;
}

/* Status Badges for Fee Cells */
.fee-cell {
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  font-weight: 700;
  font-size: 0.78rem;
  border-radius: 4px;
}
.fee-cell:hover {
  outline: 2px solid var(--gold);
}
.status-paid {
  background: #D1FAE5;
  color: #065F46;
}
.status-partial {
  background: #FEF3C7;
  color: #92400E;
}
.status-due {
  background: #FEE2E2;
  color: #991B1B;
}

/* ─── MODAL DIALOG ─── */
.erp-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.erp-modal-overlay.open { display: flex; }
.erp-modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  overflow: hidden;
  animation: modalPop 0.2s ease-out;
}
@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.erp-modal-header {
  background: var(--primary-dark);
  color: var(--white);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.erp-modal-title { font-size: 1.1rem; font-weight: 700; color: var(--gold-light); }
.erp-modal-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.25rem;
  cursor: pointer;
}
.erp-modal-body { padding: 22px; max-height: 75vh; overflow-y: auto; }
.erp-modal-footer {
  padding: 14px 22px;
  background: #F9FAFB;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── PRINTABLE RECEIPT ─── */
.receipt-box {
  background: var(--white);
  border: 1.5px solid var(--primary-mid);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.receipt-header {
  text-align: center;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.receipt-school-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
}
.receipt-school-sub {
  font-size: 0.8rem;
  color: var(--text-mid);
}
.receipt-voucher-title {
  background: var(--primary-pale);
  color: var(--primary-dark);
  font-weight: 800;
  display: inline-block;
  padding: 4px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 0.88rem;
  margin-bottom: 20px;
}

@media print {
  .erp-sidebar, .erp-header, .btn-print, .no-print {
    display: none !important;
  }
  .erp-main { margin-left: 0 !important; width: 100% !important; }
  .erp-content { padding: 0 !important; }
  .receipt-box {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ─── RESPONSIVENESS ─── */
@media (max-width: 1024px) {
  .erp-sidebar { transform: translateX(-100%); }
  .erp-sidebar.open { transform: translateX(0); }
  .erp-main { margin-left: 0; width: 100%; }
  .erp-toggle-sidebar { display: block; }
}

@media (max-width: 640px) {
  .erp-content { padding: 16px; }
  .stats-cards-grid { grid-template-columns: 1fr; }
  .erp-modal { width: 95vw; }
}
