@font-face {
  font-family: "CustomChineseFont";
  src: url("../chinese.ttf") format("truetype");
  font-display: swap;
}

:root {
  --primary: #ea6a1b;
  --primary-dark: #c45713;
  --bg: #f4f5f7;
  --border: #e3e7ee;
  --text: #1f2a37;
}

.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Prompt", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.app-header h1 {
  margin: 0;
  font-size: 1.9rem;
}

.app-header p {
  margin: 4px 0 0;
  color: #5b6574;
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: 0.2s;
}

.ghost-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(234, 106, 27, 0.18);
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.nav-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: #4a5668;
  font-weight: 600;
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  outline: none;
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 12px 24px rgba(234, 106, 27, 0.28);
}

.page {
  display: none;
  background: #fff;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.page.active {
  display: block;
}

.page h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.muted {
  color: #6b7280;
  font-size: 0.95rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.summary-card {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 20px;
  background: #fbfbfd;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.summary-card span {
  font-size: 0.9rem;
  color: #9da6b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-card strong {
  display: block;
  font-size: 2rem;
  margin-top: 12px;
  color: #232838;
}

.primary-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

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

.secondary-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: #4b5563;
}

.secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.controls {
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.controls button {
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
}

.controls button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 680px;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid #f0f0f0;
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
}

th {
  background-color: #f9fafb;
  font-weight: 700;
}

tr:nth-child(even) td {
  background-color: #fcfdff;
}

.action-cell {
  text-align: center;
  width: 60px;
}

.delete-btn {
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  color: #d9534f;
}

.delete-btn:hover {
  color: #b52b27;
}

.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #6b7280;
}

.status.success {
  color: #15803d;
}

.status.error {
  color: #b91c1c;
}

.form-grid {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.input-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
  transition: 0.2s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(234, 106, 27, 0.1);
}

form button[type="submit"] {
  width: 100%;
  margin-top: 6px;
}

.form-hint {
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 16px;
}

.image-preview {
  margin-top: 20px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 20px;
  background: #fbfbfd;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.image-preview img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
}

.preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 768px) {
  .app-shell {
    padding: 24px 16px 40px;
  }

  .page {
    padding: 22px;
  }
}

@media (max-width: 640px) {
  .main-nav {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .primary-actions {
    flex-direction: column;
  }

  .table-wrapper {
    border: none;
  }

  #donationTable {
    border-collapse: separate;
    border-spacing: 0;
  }

  #donationTable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  #donationTable tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #donationTable tr {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
    background: #fff;
  }

  #donationTable td {
    border: none;
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
  }

  #donationTable td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    margin-right: 12px;
    text-align: left;
  }

  #donationTable .action-cell {
    justify-content: flex-end;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  line-height: 1;
}

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

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

.add-boon-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.add-boon-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.boon-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.boon-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.boon-item span {
  font-weight: 500;
}

.delete-boon-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: 0.2s;
}

.delete-boon-btn:hover {
  background: #fee2e2;
}