/* KKGS Corporate Green Theme */
:root {
  --primary-color: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-light: #4caf50;
  --secondary-color: #81c784;
  --accent-color: #c8e6c9;
  --bg-color: #f5f5f5;
  --card-bg: #ffffff;
  --text-color: #212121;
  --text-secondary: #757575;
  --border-color: #e0e0e0;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --danger-color: #f44336;
  --sidebar-width: 260px;
}

/* Dark Mode */
.dark-mode {
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --text-color: #ffffff;
  --text-secondary: #b0b0b0;
  --border-color: #333333;
  --accent-color: #1b5e20;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 20px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s;
  z-index: 1000;
}

.sidebar-header h1 {
  font-size: 24px;
  margin-bottom: 5px;
}

.sidebar-header p {
  font-size: 12px;
  opacity: 0.9;
}

.sidebar-nav {
  margin-top: 30px;
}

.sidebar-nav a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 12px 15px;
  margin-bottom: 5px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background-color: rgba(255, 255, 255, 0.2);
}

.sidebar-nav .btn-login,
.sidebar-nav .btn-logout {
  margin-top: 20px;
  background-color: rgba(255, 255, 255, 0.2);
  text-align: center;
  font-weight: bold;
}

.theme-toggle {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  padding: 12px;
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 30px;
  transition: margin-left 0.3s;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 60px 40px;
  border-radius: 16px;
  margin-bottom: 30px;
  text-align: center;
}

.hero h1 {
  font-size: 36px;
  margin-bottom: 10px;
}

.hero p {
  font-size: 18px;
  margin-bottom: 20px;
  opacity: 0.9;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--text-color);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  margin-right: 5px;
}

.btn-edit {
  background-color: var(--warning-color);
  color: white;
}

.btn-delete {
  background-color: var(--danger-color);
  color: white;
}

.btn-sm:hover {
  opacity: 0.9;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  background-color: var(--accent-color);
  color: var(--primary-dark);
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.status-active {
  background-color: var(--success-color);
  color: white;
}

.status-inactive {
  background-color: var(--text-secondary);
  color: white;
}

.status-paid {
  background-color: var(--success-color);
  color: white;
}

.status-unpaid {
  background-color: var(--danger-color);
  color: white;
}

.status-pending {
  background-color: var(--warning-color);
  color: white;
}

.status-planned {
  background-color: var(--accent-color);
  color: var(--primary-dark);
}

.status-ongoing {
  background-color: var(--warning-color);
  color: white;
}

.status-completed {
  background-color: var(--success-color);
  color: white;
}

.status-cancelled {
  background-color: var(--text-secondary);
  color: white;
}

textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
  font-family: inherit;
  resize: vertical;
}

/* Search & Filter */
.section-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
}

.filter-select {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
  cursor: pointer;
}

.table-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.btn-view {
  background-color: #2196f3;
  color: white;
}

.btn-export {
  background-color: #9c27b0;
  color: white;
}

/* Receipt Modal */
.modal-large .modal-content {
  max-width: 700px;
}

.receipt-container {
  border: 3px solid var(--primary-color);
  border-radius: 12px;
  padding: 30px;
  margin: 20px 0;
  background: linear-gradient(135deg, var(--accent-color), var(--card-bg));
}

.receipt-header {
  text-align: center;
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.receipt-header h2 {
  color: var(--primary-color);
  margin: 0 0 10px 0;
  font-size: 24px;
}

.receipt-header p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 14px;
}

.receipt-details {
  padding: 10px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.receipt-row:last-child {
  border-bottom: none;
}

.receipt-row .label {
  font-weight: 600;
  color: var(--text-secondary);
}

.receipt-row .value {
  font-weight: 500;
  color: var(--text-color);
}

.receipt-row .value.amount {
  font-size: 28px;
  color: var(--primary-color);
  font-weight: bold;
}

.receipt-footer {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 3px solid var(--primary-color);
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* Sections */
.section {
  background-color: var(--card-bg);
  padding: 30px;
  border-radius: 16px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section h2 {
  margin-bottom: 20px;
  color: var(--primary-color);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
}

.stat-card h3 {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 10px;
}

.stat-card p {
  font-size: 32px;
  font-weight: bold;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.program-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.2s;
}

.program-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.program-card h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

.program-card .date {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 10px;
}

.program-card .status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.status-planned {
  background-color: var(--accent-color);
  color: var(--primary-dark);
}

.status-completed {
  background-color: var(--success-color);
  color: white;
}

.status-ongoing {
  background-color: var(--warning-color);
  color: white;
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--accent-color);
  color: var(--primary-dark);
  font-weight: 600;
}

tr:hover {
  background-color: var(--bg-color);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
}

/* Login */
.login-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}

.login-card {
  background-color: var(--card-bg);
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-card h2 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary-color);
}

.login-hint {
  margin-top: 20px;
  padding: 15px;
  background-color: var(--accent-color);
  border-radius: 8px;
  font-size: 14px;
}

.error-message {
  background-color: var(--danger-color);
  color: white;
  padding: 12px;
  border-radius: 8px;
  margin-top: 15px;
  text-align: center;
}

/* Profile Card */
.profile-card {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 30px;
  border-radius: 12px;
}

.profile-card h3 {
  margin-bottom: 10px;
}

.profile-card p {
  margin-bottom: 8px;
  opacity: 0.9;
}

/* Fees Status */
.fees-status {
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.fees-status.paid {
  background-color: var(--accent-color);
  border-left: 4px solid var(--success-color);
}

.fees-status.unpaid {
  background-color: #ffebee;
  border-left: 4px solid var(--danger-color);
}

.dark-mode .fees-status.unpaid {
  background-color: #2d1f1f;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: var(--card-bg);
  padding: 30px;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h3 {
  margin-bottom: 20px;
  color: var(--primary-color);
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-content button {
  margin-top: 10px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 15px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  /* Mobile menu button */
  .mobile-menu-btn {
    display: block;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
  }

  /* Mobile tables */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
    font-size: 14px;
  }

  th, td {
    padding: 8px;
  }

  /* Mobile toolbar */
  .section-toolbar {
    flex-direction: column;
    gap: 10px;
  }

  .section-toolbar .search-input,
  .section-toolbar .filter-select,
  .section-toolbar .btn-primary {
    width: 100%;
  }

  .search-input {
    min-width: 100%;
  }

  /* Mobile table actions */
  .table-actions {
    flex-direction: column;
  }

  .table-actions button {
    width: 100%;
  }

  /* Mobile buttons */
  .btn-sm {
    padding: 5px 8px;
    font-size: 12px;
  }

  td .btn-sm {
    margin-right: 3px;
  }

  /* Mobile modals */
  .modal-content {
    width: 95%;
    max-height: 85vh;
    padding: 20px;
    margin: 10px auto;
  }

  .modal-large .modal-content {
    max-width: 95%;
  }

  /* Mobile receipt */
  .receipt-container {
    padding: 15px;
  }

  .receipt-row {
    flex-direction: column;
    gap: 5px;
  }

  .receipt-row .value.amount {
    font-size: 22px;
  }

  /* Mobile stats cards */
  .stat-card {
    padding: 15px;
  }

  .stat-card p {
    font-size: 24px;
  }

  /* Hide checkboxes on mobile */
  .member-checkbox,
  .fee-checkbox,
  .program-checkbox,
  #selectAllMembers,
  #selectAllFees,
  #selectAllPrograms {
    display: none;
  }

  /* Mobile form */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 14px;
  }

  /* Mobile modal actions */
  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button {
    width: 100%;
  }

  /* Hide sidebar theme toggle on mobile */
  .theme-toggle {
    position: static;
    margin-top: 20px;
  }
}

/* Mobile menu button - hidden on desktop */
.mobile-menu-btn {
  display: none;
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }
