/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Arial', sans-serif;
}

body {
  background: #f4f7f5;
  color: #333;
}

/* ================= LOGIN ================= */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.login-box {
  width: 420px;
  background: #fff;
  padding: 40px;
  border: 2px solid #1f7a45;
  box-shadow: 12px 12px 0 #1f7a45;
  text-align: center;
}

.login-box h1 {
  color: #1f7a45;
  margin-bottom: 5px;
}

.login-box p {
  font-size: 12px;
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #ccc;
}

.login-box input:focus {
  outline: none;
  border: 1px solid #1f7a45;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: #1f7a45;
  color: white;
  border: none;
  margin-top: 15px;
  cursor: pointer;
  font-weight: bold;
}

.login-box button:hover {
  background: #166b3b;
}

.register {
  margin-top: 20px;
  font-size: 12px;
}

.register span {
  color: #1f7a45;
  cursor: pointer;
}

/* ================= LAYOUT ================= */
.container {
  display: flex;
  min-height: 100vh;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 230px;
  min-height: 100vh;
  background: linear-gradient(180deg, #1f7a45 0%, #166b3b 100%);
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
}

.main {
  flex: 1;
  margin-left: 0;
  padding: 20px;
}

.sidebar h2 {
  margin-bottom: 30px;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  padding: 12px;
  margin: 6px 0;
  cursor: pointer;
  border-radius: 8px;
  transition: 0.2s;
}

.sidebar ul li:hover {
  background: rgba(255,255,255,0.2);
}

.sidebar ul li.active {
  background: white;
  color: #1f7a45;
  font-weight: bold;
}

.sidebar i {
  margin-right: 10px;
}

.logout {
  margin-top: 10px;
  padding: 10px;
  border: none;
  background: transparent;
  color: white;
  cursor: pointer;
}

/* ================= MAIN ================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

header i {
  margin-right: 5px;
}

.header-right {
  justify-content: flex-end;
}

.page-toolbar {
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-select {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.status-bar {
  margin-bottom: 10px;
  font-weight: bold;
}

.primary-btn {
  background: #16a34a;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.empty-table {
  text-align: center;
}

.card-panel {
  padding: 20px;
}

.report-section {
  margin-bottom: 20px;
  margin-top: 20px;
}

.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.reports-section {
  margin-top: 30px;
}

.proof-content {
  position: relative;
}

.close-proof {
  cursor: pointer;
  float: right;
}

.proof-image {
  max-width: 400px;
  display: block;
  margin-top: 10px;
}

.payment-select {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
}

.table-spaced {
  margin-top: 15px;
}

.section-title {
  margin-top: 20px;
}

.funds-highlight {
  color: #22c55e;
}

.btn-qr {
  background: #16a34a;
  color: white;
  padding: 3px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  margin-right: 4px;
}

.btn-qr:hover {
  background: #15803d;
}

.pending-select-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 5px 10px;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  background: #fff7ed;
  color: #b45309;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.pending-select-button:hover {
  background: #ffedd5;
  border-color: #d97706;
  transform: translateY(-1px);
}

.pending-selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid #b7dcff;
  border-radius: 9px;
  background: #e5f3ff;
}

.pending-selected-count {
  color: #123a91;
  font-weight: 700;
}

.pending-selected-count i {
  margin-right: 5px;
}

.pending-selection-bar button {
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.pending-select-all {
  background: #4a6cf7;
  color: white;
}

.pending-deselect-all {
  background: #dce5ee;
  color: #243447;
}

.pending-selection-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 576px) {
  .pending-selection-actions {
    width: 100%;
    margin-left: 0;
  }

  .pending-selection-actions button {
    flex: 1;
  }
}

.student-qr-modal {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  z-index: 2000;
}

.student-qr-content {
  position: relative;
  width: min(100%, 360px);
  padding: 28px;
  text-align: center;
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.student-qr-content h3 {
  color: #1f7a45;
  margin-bottom: 8px;
}

.student-qr-content p {
  color: #555;
  margin-bottom: 14px;
}

#studentQrCode {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.student-qr-value {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.student-qr-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 20px;
  cursor: pointer;
}

@media (min-width: 769px) {
  html,
  body {
    width: 100%;
    min-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
  }

  .container {
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .sidebar {
    margin-left: 0 !important;
  }
}

@media (max-width: 768px) {
  html,
  body {
    background: #252525 !important;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .container {
    width: min(100vw, 600px) !important;
    min-height: 100vh;
    margin: 0 auto !important;
    background: #f4f7f5;
  }

  .mobile-menu-toggle,
  .menu-toggle {
    position: fixed !important;
    top: 13px !important;
    left: max(16px, calc(50% - 284px)) !important;
    z-index: 1055 !important;
    width: 44px !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    background: #ffffff !important;
    border: 1px solid #d8dee5 !important;
    border-radius: 10px !important;
    color: #1f7a45 !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12) !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: max(0px, calc(50% - 300px)) !important;
    width: 270px !important;
    height: 100vh !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: none !important;
    visibility: hidden;
    pointer-events: none;
    z-index: 1050 !important;
  }

  body.sidebar-open .sidebar {
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  body.sidebar-open .sidebar-nav {
    display: block !important;
    width: 100% !important;
    padding: 10px !important;
    overflow-y: auto !important;
  }

  body.sidebar-open .sidebar-nav li {
    display: flex !important;
    width: 100% !important;
    margin: 4px 0 !important;
    padding: 12px 16px !important;
  }

  body.sidebar-open .sidebar-bottom {
    display: block !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    padding: 16px 20px !important;
  }

  body:not(.sidebar-open) .sidebar {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    transform: none !important;
  }

  body.sidebar-open .sidebar-overlay {
    display: block !important;
  }

  .main {
    width: 100%;
    padding: 72px 15px 20px !important;
  }
}

header input {
  padding: 10px;
  width: 260px;
  border: 1px solid #ccc;
}

header span {
  font-weight: bold;
}

/* TITLE */
h1 {
  color: #1f7a45;
  margin-bottom: 20px;
}

h1 i {
  margin-right: 10px;
  color: #1f7a45;
}

/* ================= CARDS ================= */
.cards {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.card {
  background: white;
  padding: 20px;
  flex: 1;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: 0.3s;
}

.card:hover {
  transform: translateY(-3px);
}

.scanner-card {
  text-align: center;
  padding: 20px;
}

.scanner-reader {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.scanner-result {
  margin-top: 15px;
  font-weight: bold;
}

.scanner-table-card {
  margin-top: 20px;
  padding: 20px;
}

.scanner-table-card h3 {
  margin-bottom: 15px;
}

.table-card {
  padding: 20px;
  margin-top: 20px;
}

.table-card h3 {
  margin-bottom: 15px;
}

.empty-state {
  text-align: center;
}

.card h2 {
  margin-top: 10px;
  color: #1f7a45;
}

/* DASHBOARD GRID */
.dashboard-grid {
  display: flex;
  gap: 20px;
}

/* ACTIVITY */
.activity {
  flex: 2;
}

.card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}

.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
}

.activity-item span {
  float: right;
  font-size: 12px;
  color: gray;
}

/* ACTIONS */
.actions {
  flex: 1;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.action-btn {
  padding: 15px;
  border: 1px solid #1f7a45;
  background: white;
  cursor: pointer;
}

.action-btn:hover {
  background: #1f7a45;
  color: white;
}

/* ================= TABLE ================= */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  margin-top: 20px;
}

table th {
  background: #f1f5f3;
  text-align: left;
  font-weight: 600;
}

table th, table td {
  border: none;
  padding: 12px;
}

table tr:nth-child(even) {
  background: #f9fbfa;
}

table tr:hover {
  background: #eef7f1;
}

/* ================= BUTTON ================= */
.btn {
  background: #1f7a45;
  color: white;
  padding: 8px 14px;
  border: none;
  cursor: pointer;
  margin: 5px 0;
  border-radius: 8px;
  font-weight: 500;
}

.btn:hover {
  background: #166b3b;
}

.btn i {
  margin-right: 5px;
}

.btn-outline {
  padding: 7px 10px;
  border: 1px solid #cbd5d1;
  background: white;
  color: #37513b;
  border-radius: 8px;
  cursor: pointer;
}

.btn-success {
  padding: 7px 10px;
  border: none;
  background: #16a34a;
  color: white;
  border-radius: 8px;
  cursor: pointer;
}

.btn-danger {
  padding: 7px 10px;
  border: none;
  background: #dc2626;
  color: white;
  border-radius: 8px;
  cursor: pointer;
}

.btn-disabled {
  opacity: 0.7;
  cursor: default;
}

.muted {
  color: #6b7280;
  font-size: 13px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-chip.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-chip.approved {
  background: #dcfce7;
  color: #166534;
}

.status-chip.declined {
  background: #fee2e2;
  color: #b91c1c;
}

.status-chip.paid {
  background: #dcfce7;
  color: #166534;
}

.status-chip.unpaid {
  background: #fee2e2;
  color: #b91c1c;
}

.status-chip.present {
  background: #dcfce7;
  color: #15803d;
}

.status-chip.absent {
  background: #fee2e2;
  color: #dc2626;
}

.status-chip.excused {
  background: #fef3c7;
  color: #d97706;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ================= STATUS ================= */
.status {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 3px;
}

.pending {
  background: #ffe0a3;
  color: #a66b00;
}

.verified {
  background: #c8f7c5;
  color: #1f7a45;
}

/* ================= ATTENDANCE ================= */
.qr-box {
  display: flex;
  gap: 20px;
  align-items: center;
}

.qr-box img {
  width: 120px;
}

/* ================= REPORT ================= */
.report-box {
  background: white;
  padding: 20px;
  border: 1px solid #1f7a45;
  box-shadow: 6px 6px 0 #1f7a45;
  margin-top: 20px;
}

/* ================= CHARTS ================= */
.charts {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.chart-card {
  flex: 1;
  padding: 15px;
  margin-bottom: 15px;
}

.chart-card canvas {
  max-height: 140px;
}

/* ================= GRID ================= */
.attendance-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.attendance-card {
  flex: 1;
  min-width: 250px;
  text-align: left;
}

.attendance-card img {
  display: block;
  margin-bottom: 10px;
}

/* ================= PROGRESS ================= */
.progress-text {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 5px;
  font-size: 14px;
}

.progress-bar {
  background: #eee;
  height: 8px;
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar div {
  height: 100%;
  background: #1f7a45;
}

/* ================= CARD ACTIONS ================= */
.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.create-btn {
  background: #1f7a45;
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.create-btn:hover {
  background: #1d4ed8;
}

/* ================= MODAL ================= */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(3px);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 25px;
  border-radius: 15px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  animation: pop 0.3s ease;
}

@keyframes pop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-content input, .modal-content select {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
}

.modal-actions button {
  padding: 8px 14px;
  border: none;
  cursor: pointer;
  border-radius: 8px;
}

.modal-actions .cancel {
  background: #ccc;
}

.modal-actions .submit {
  background: #1f7a45;
  color: white;
}

.modal-actions .submit:hover {
  background: #166534;
}

.modal-actions .cancel:hover {
  background: #bbb;
}

/* ================= LOGO ================= */
.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 25px;
}

.sidebar-logo img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  background: white;
  padding: 5px;
  margin-bottom: 8px;
}

.sidebar-logo h3 {
  font-size: 25px;
  color: white;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: 1px;
}

/* ================= EVENT BAR ================= */
.event-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.active-event {
  background: #f5f5f5;
  padding: 12px 18px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
}

.active-event i {
  color: #16a34a;
}

/* ================= REPORT GRID ================= */
.report-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.report-card {
  text-align: center;
  padding: 20px;
}

.report-card h3 {
  font-size: 14px;
  color: #666;
}

.report-card h2 {
  font-size: 28px;
  color: #16a34a;
}

/* ================= ROLE BADGES ================= */
.role {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.role.admin {
  background: #ffe5e5;
  color: #c62828;
}

.role.staff {
  background: #fff3e0;
  color: #ef6c00;
}

.role.viewer {
  background: #e8f5e9;
  color: #2e7d32;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }

  .main {
    padding: 15px;
  }

  .user-management-container {
    flex-direction: column;
  }

  .cards,
  .dashboard-grid,
  .charts,
  .report-grid,
  .attendance-grid {
    flex-direction: column;
  }

  .report-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .report-grid {
    grid-template-columns: 1fr;
  }
}