@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #0056b3;
  --primary-hover: #004494;
  --secondary: #f0f4f8;
  --text-dark: #1a202c;
  --text-light: #718096;
  --white: #ffffff;
  --border: #e2e8f0;
  --error: #e53e3e;
  --success: #38a169;
  --radius: 10px;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--secondary);
  color: var(--text-dark);
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

.admin-container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  margin-bottom: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.logo-container img {
  max-height: 80px;
  max-width: 150px;
  object-fit: contain;
}

.header h1 {
  color: var(--primary);
  font-size: 2.2rem;
  margin-bottom: 10px;
  font-weight: 700;
}

.header p {
  color: var(--text-light);
  font-size: 1.1rem;
}

.section-title {
  background: #edf2f7;
  padding: 15px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: 30px;
  color: var(--text-dark);
  font-size: 1.1rem;
  text-align: center;
}

.form-group {
  margin-bottom: 25px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  .form-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.form-group label {
  font-weight: 500;
  color: var(--text-dark);
}

.form-group .sub-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: 4px;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: inherit;
  background-color: #fafafa;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
  background-color: var(--white);
}

.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-label, .checkbox-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.95rem;
  color: #4a5568;
}

.radio-label input, .checkbox-label input {
  margin-right: 12px;
  margin-top: 4px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: var(--white);
  background-color: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 86, 179, 0.2);
}

.btn:active {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* Admin Styles */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.btn-small {
  padding: 8px 16px;
  width: auto;
}

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

.btn-danger:hover {
  background-color: #c53030;
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--white);
  padding: 25px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card h3 {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 10px;
  font-weight: 500;
}

.stat-card p {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.chart-container {
  position: relative;
  height: 350px;
  width: 100%;
}

.chart-card h3 {
  margin-bottom: 15px;
  color: var(--text-dark);
  font-size: 1.1rem;
  text-align: center;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: var(--white);
  padding: 15px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.table-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow: hidden;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1600px;
}

th, td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

td.cell-wrap {
  max-width: 220px;
  white-space: normal;
}

th {
  background-color: #f8fafc;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
}

tr:hover {
  background-color: #f1f5f9;
}

.btn-detail {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
  background-color: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

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

.btn-edit {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
  background-color: var(--success);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 6px;
}

.btn-edit:hover {
  background-color: #2f855a;
}

/* Detail Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 32, 44, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 550px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-box-wide {
  max-width: 700px;
}

.modal-box-wide .form-group {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  color: var(--primary);
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
}

.modal-close:hover {
  color: var(--text-dark);
}

.modal-body {
  padding: 10px 25px 25px;
  overflow-y: auto;
}

.detail-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

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

.detail-label {
  font-weight: 600;
  color: var(--text-light);
}

.detail-value {
  color: var(--text-dark);
  word-break: break-word;
}

@media (max-width: 480px) {
  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Modal / Alerts */
.alert {
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-weight: 500;
}
.alert-success {
  background-color: #c6f6d5;
  color: #276749;
}
.alert-error {
  background-color: #fed7d7;
  color: #9b2c2c;
}
