/* ZKDonate Dashboard v1.0 - 管理後台樣式 */

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: #f0f2f5;
  color: #263238;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Login Page ===== */
.login-page {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
}

.login-page.active {
  display: flex;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  text-align: center;
}

.login-card h1 {
  font-size: 24px;
  color: #1a73e8;
  margin-bottom: 8px;
}

.login-card .subtitle {
  font-size: 14px;
  color: #666;
  margin-bottom: 28px;
}

.login-card input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #dde3ea;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}

.login-card input[type="password"]:focus {
  border-color: #1a73e8;
}

.login-card .btn {
  width: 100%;
  padding: 14px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card .btn:hover {
  background: #1557b0;
}

.login-card .error {
  color: #d93025;
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

/* ===== Dashboard Layout ===== */
.dashboard-page {
  display: none;
}

.dashboard-page.active {
  display: block;
}

/* ===== Navbar ===== */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a73e8;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-actions .btn {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: #1a73e8;
  color: #fff;
}

.btn-primary:hover {
  background: #1557b0;
}

.btn-outline {
  background: #fff;
  color: #1a73e8;
  border: 1px solid #1a73e8 !important;
}

.btn-outline:hover {
  background: #e8f0fe;
}

.btn-danger {
  background: #d93025;
  color: #fff;
}

.btn-danger:hover {
  background: #b71c1c;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

/* ===== Tab Bar ===== */
.tab-bar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  padding: 0 24px;
  overflow-x: auto;
}

.tab {
  padding: 14px 20px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  user-select: none;
}

.tab:hover {
  color: #1a73e8;
}

.tab.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 600;
}

/* ===== Content Area ===== */
.content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card .label {
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: #263238;
}

.stat-card.warning .value {
  color: #e65100;
}

.stat-card.danger .value {
  color: #d93025;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: #1a73e8;
}

.filter-bar label {
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Section Header ===== */
.section-header {
  font-size: 16px;
  font-weight: 600;
  color: #263238;
  margin-bottom: 12px;
}

/* ===== Table ===== */
.table-wrap {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #f5f7fa;
}

th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #e0e0e0;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
}

tr:hover td {
  background: #fafbfc;
}

tr.deleted td {
  opacity: 0.5;
  text-decoration: line-through;
}

/* Clickable row to expand detail */
.clickable {
  cursor: pointer;
}

.detail-row {
  display: none;
  background: #fafbfc;
}

.detail-row.expanded {
  display: table-row;
}

.detail-row td {
  padding: 16px;
  color: #666;
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
}

.detail-grid .key {
  color: #888;
  font-weight: 600;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: #e6f4ea;
  color: #1e8e3e;
}

.badge-pending {
  background: #fef7e0;
  color: #e65100;
}

.badge-danger {
  background: #fce8e6;
  color: #d93025;
}

.badge-neutral {
  background: #e8eaed;
  color: #555;
}

/* ===== Overdue Alert ===== */
.overdue-alert {
  background: #fce8e6;
  border: 1px solid #f5b7b1;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #d93025;
}

.overdue-alert ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

/* ===== Settings Page ===== */
.settings-section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.settings-section h3 {
  font-size: 16px;
  color: #263238;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.setting-row label {
  width: 160px;
  font-size: 13px;
  color: #555;
  text-align: right;
  flex-shrink: 0;
}

.setting-row input,
.setting-row textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.setting-row input:focus,
.setting-row textarea:focus {
  border-color: #1a73e8;
}

.setting-row textarea {
  min-height: 60px;
  resize: vertical;
}

/* ===== Toasts ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #263238;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 999;
  animation: fadeInUp 0.3s ease;
}

.toast.error {
  background: #d93025;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Print Styles ===== */
@media print {
  .navbar, .tab-bar, .filter-bar, .btn, .btn-sm,
  .sidebar, .stats-grid, .overdue-alert, .toast {
    display: none !important;
  }

  .content {
    padding: 0;
    max-width: 100%;
  }

  .table-wrap {
    box-shadow: none;
  }

  table {
    font-size: 11px;
  }

  th, td {
    padding: 6px 8px;
  }

  .badge {
    border: 1px solid #ccc;
  }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-bar {
    flex-direction: column;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .setting-row label {
    text-align: left;
    width: auto;
  }
}
