/* ============================================================
   Noorul Eilm Academy — Canteen Cashless Payment System
   Custom Stylesheet
   ============================================================ */

:root {
  --primary:       #7b1c2e;   /* School maroon */
  --primary-dark:  #5a1220;
  --primary-light: #a0253f;
  --accent:        #c9993a;   /* School gold */
  --accent-light:  #e8b94a;
  --sidebar-width: 260px;
  --sidebar-bg:    #1a0a10;
  --sidebar-hover: rgba(201,153,58,0.15);
  --sidebar-active:#c9993a;
  --text-light:    rgba(255,255,255,0.75);
  --card-shadow:   0 2px 15px rgba(0,0,0,0.07);
  --transition:    all 0.25s ease;
}

/* ── Base ── */
* { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f0f2f5; }

/* ── Sidebar ── */
#sidebar-wrapper {
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: var(--transition);
  z-index: 1000;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#sidebar-wrapper.collapsed {
  min-width: 64px;
  max-width: 64px;
}

#sidebar-wrapper.collapsed .brand-text,
#sidebar-wrapper.collapsed .sidebar-user div:not(.avatar-circle),
#sidebar-wrapper.collapsed .nav-section-label,
#sidebar-wrapper.collapsed .nav-item span {
  display: none;
}

#sidebar-wrapper.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.6rem;
  color: var(--text-light);
  line-height: 1.2;
}

/* Sidebar user */
.sidebar-user {
  text-align: center;
  padding: 16px 12px 12px;
}

/* Nav */
.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 12px 18px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 8px;
  margin: 1px 8px;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--accent-light);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(201,153,58,0.35);
}

.nav-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-divider {
  border-color: rgba(255,255,255,0.1);
  margin: 4px 12px;
}

.sidebar-footer {
  padding: 12px 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Avatar circle ── */
.avatar-circle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.avatar-circle.large {
  width: 52px;
  height: 52px;
  font-size: 1.3rem;
  margin: 0 auto;
}

/* ── Page content ── */
#page-content-wrapper { min-width: 0; background: #f0f2f5; }

/* ── Cards ── */
.card {
  border: none;
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Stat cards ── */
.stat-card {
  border-radius: 14px;
  padding: 20px 22px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.stat-card .stat-icon {
  font-size: 2rem;
  opacity: 0.85;
}

.stat-card .stat-label { font-size: 0.75rem; opacity: 0.85; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card .stat-sub   { font-size: 0.72rem; opacity: 0.75; }

.bg-maroon   { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.bg-gold     { background: linear-gradient(135deg, #b8860b, var(--accent-light)); }
.bg-teal     { background: linear-gradient(135deg, #0d6e74, #1a9aa3); }
.bg-purple   { background: linear-gradient(135deg, #5b21b6, #7c3aed); }
.bg-success2 { background: linear-gradient(135deg, #065f46, #059669); }
.bg-orange   { background: linear-gradient(135deg, #9a3412, #ea580c); }

/* ── Tables ── */
.table thead th {
  background: #f8f9fa;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #dee2e6;
}

.table tbody td { font-size: 0.875rem; vertical-align: middle; }

/* ── Badges ── */
.badge { font-weight: 500; }

/* ── Form controls ── */
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,153,58,0.15);
}

/* ── Buttons ── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-accent:hover { background: #b8860b; border-color: #b8860b; color: white; }

/* ── RFID Tap animation ── */
.rfid-scan-area {
  border: 3px dashed var(--accent);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  background: rgba(201,153,58,0.04);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.rfid-scan-area:hover {
  background: rgba(201,153,58,0.08);
  border-color: var(--accent-light);
}

.rfid-scan-area.scanning {
  border-color: var(--primary);
  background: rgba(123,28,46,0.05);
  animation: pulse-border 1.5s infinite;
}

.rfid-scan-area.success {
  border-color: #198754;
  background: rgba(25,135,84,0.06);
}

.rfid-scan-area.error {
  border-color: #dc3545;
  background: rgba(220,53,69,0.06);
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123,28,46,0.3); }
  50%       { box-shadow: 0 0 0 12px rgba(123,28,46,0); }
}

.tap-icon {
  font-size: 4rem;
  color: var(--accent);
  transition: var(--transition);
}

.rfid-scan-area:hover .tap-icon { transform: scale(1.1); }
.rfid-scan-area.scanning .tap-icon { animation: bounce-tap 0.8s infinite; color: var(--primary); }

@keyframes bounce-tap {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

/* ── Receipt card ── */
.receipt-card {
  border: 1px dashed #adb5bd;
  border-radius: 12px;
  background: #fff;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
}

.receipt-header {
  background: var(--primary);
  color: white;
  border-radius: 11px 11px 0 0;
  padding: 12px;
  text-align: center;
}

/* ── Balance chip ── */
.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 50px;
  padding: 6px 18px;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 3px 10px rgba(123,28,46,0.3);
}

/* ── Loading spinner ── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.spinner-ring {
  width: 50px; height: 50px;
  border: 5px solid rgba(255,255,255,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page loading bar ── */
.page-loader {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 99999;
  animation: loadbar 1.2s ease forwards;
}
@keyframes loadbar { from { width: 0; } to { width: 100%; } }

/* ── Responsive ── */
@media (max-width: 768px) {
  #sidebar-wrapper {
    position: fixed;
    left: -260px;
    transition: var(--transition);
    z-index: 1050;
  }

  #sidebar-wrapper.show-mobile {
    left: 0;
  }

  .sidebar-overlay {
    display: block !important;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
  }
}

/* ── DataTables overrides ── */
div.dataTables_wrapper div.dataTables_filter input {
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 4px 10px;
}

div.dataTables_wrapper div.dataTables_length select {
  border: 1px solid #ced4da;
  border-radius: 6px;
}

/* ── Status badges ── */
.status-active   { background: #d1fae5; color: #065f46; }
.status-inactive { background: #fee2e2; color: #991b1b; }
.status-lost     { background: #fef3c7; color: #92400e; }

/* ── Chart container ── */
.chart-container { position: relative; height: 260px; }

/* ── Print ── */
@media print {
  #sidebar-wrapper, nav.navbar, .breadcrumb, .btn, .no-print { display: none !important; }
  #page-content-wrapper { margin: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
}
#wrapper > *:not(#page-content-wrapper) {
    flex-shrink: 0;
    flex-basis: 260px;
    width: 260px;
    max-width: 260px;
}
