/* ==========================================
   PANJRAPOLE DONATION ENTRY - Stylesheet
   Theme: warm maroon/saffron, matching the paper receipt book
   ========================================== */

:root {
  --primary: #7B3F00;
  --primary-light: #A0522D;
  --accent: #D4A017;
  --accent-light: #F0C040;
  --bg: #FDF6EC;
  --bg-card: #FFFFFF;
  --bg-nav: #7B3F00;
  --text: #2C1A0E;
  --text-light: #6B4C2A;
  --text-muted: #9C7B5A;
  --border: #E8D5B7;
  --success: #2E7D32;
  --danger: #C62828;
  --warning: #F57F17;
  --shadow: 0 2px 12px rgba(123,63,0,0.10);
  --radius: 10px;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ========== SCREENS ========== */
.screen { display: none; }
.screen.active { display: block; }

/* ========== LOGIN ========== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #7B3F00 0%, #A0522D 50%, #D4A017 100%);
  padding: 16px;
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.logo-area { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 48px; margin-bottom: 8px; }
.logo-area h1 { color: var(--primary); font-size: 22px; font-weight: 700; }
.logo-area .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ========== TOPBAR + NAV TABS ========== */
.app-header-sticky { position: sticky; top: 0; z-index: 100; }

.topbar {
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.app-title { font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.role-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
}

.btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ========== NAV TABS ========== */
.nav-tabs {
  display: flex;
  background: var(--primary);
  border-top: 1px solid rgba(255,255,255,0.1);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  flex: 0 0 auto;
  padding: 10px 18px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}
.nav-tab:hover { color: white; }
.nav-tab.active { color: var(--accent-light); border-bottom-color: var(--accent-light); }

/* ========== PAGE CONTENT ========== */
.page-content { padding: 16px; max-width: 900px; margin: 0 auto; }

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* ========== FORMS ========== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ========== BUTTONS ========== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--primary); color: white; }

.btn-accent {
  background: var(--accent);
  color: var(--primary);
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-accent:hover { background: var(--accent-light); }

.btn-danger { background: var(--danger); color: white; border: none; padding: 7px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; cursor: pointer; border: none; font-weight: 600; }

.btn-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* ========== TABLE ========== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: var(--primary); color: white; padding: 10px 12px; text-align: left; font-size: 12px; text-transform: uppercase; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: #FFF8F0; }
.data-table tr:last-child td { border-bottom: none; }

/* ========== BADGES ========== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-live { background: #E8F5E9; color: var(--success); }
.badge-draft { background: #FFF8E1; color: var(--warning); }
.badge-cash { background: #E3F2FD; color: #1565C0; }
.badge-online { background: #F3E5F5; color: #7B1FA2; }
.badge-cheque { background: #FFF3E0; color: #E65100; }
.badge-locked { background: #FFEBEE; color: var(--danger); }
.badge-open { background: #E8F5E9; color: var(--success); }

/* ========== LIVE TOTALS ========== */
.total-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.total-card { background: white; border: 1.5px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.total-card .head-name { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.total-card .total-amount { font-size: 22px; font-weight: 800; color: var(--primary); }
.total-card .entry-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ========== SECTION HEADERS ========== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.section-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); }

/* ========== LIST ITEMS ========== */
.list-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 6px; }
.list-item:last-child { border-bottom: none; }
.list-item-name { font-size: 14px; font-weight: 500; }
.list-item-sub { font-size: 12px; color: var(--text-muted); }
.list-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary); color: white;
  padding: 12px 24px; border-radius: 25px; font-size: 14px; font-weight: 500;
  z-index: 9999; transition: transform 0.3s ease; box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ========== MODAL ========== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: white; border-radius: 14px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ========== ERROR ========== */
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; text-align: center; }

/* ========== EMPTY STATE ========== */
.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state p { font-size: 14px; }

/* ========== LIVE INDICATOR ========== */
.live-dot { display: inline-block; width: 8px; height: 8px; background: #4CAF50; border-radius: 50%; margin-right: 5px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }

/* ========== AMOUNT INPUT ========== */
.amount-input-wrap { position: relative; }
.amount-input-wrap::before { content: '₹'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--primary); font-size: 15px; }
.amount-input-wrap input { padding-left: 28px !important; font-size: 18px !important; font-weight: 700 !important; }

/* ========== CART (donation heads picked for this receipt) ========== */
.cart-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cart-row:last-child { border-bottom: none; }
.cart-row .cart-head-name { flex: 1; font-size: 14px; }
.cart-row .cart-amount { width: 120px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
  .page-content { padding: 12px; }
  .total-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px; }
}

/* ========== PRINT STYLES (for the app shell itself, not the receipt popup) ========== */
@media print {
  .topbar, .nav-tabs, .btn-primary, .btn-secondary,
  .btn-accent, .btn-danger, .btn-sm, .toast, .modal-overlay { display: none !important; }
  body { background: white; }
  .page-content { padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
}
