/* ==========================================================================
   HAYIR ÇORBASI - ADMIN DASHBOARD & PWA STYLES
   Mobile-Optimized for Field Personnel & Super Admins
   ========================================================================== */

:root {
  --admin-bg: #090e1f;
  --admin-card: rgba(15, 23, 42, 0.85);
  --admin-card-hover: rgba(22, 33, 62, 0.95);
  --admin-border: rgba(255, 255, 255, 0.1);
  --admin-accent: #ea580c;
  --admin-teal: #0284c7;
}

body.admin-body {
  background: var(--admin-bg);
  color: #f8fafc;
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

/* Admin Top Bar */
.admin-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11, 19, 41, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--admin-border);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-brand img {
  height: 38px;
}

.admin-brand-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: #ffffff;
}

.admin-role-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
  border: 1px solid rgba(234, 88, 12, 0.4);
}

.admin-user-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Tab Navigation for Admin Views */
.admin-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--admin-border);
  overflow-x: auto;
  padding: 0 1rem;
  gap: 0.5rem;
}

.admin-tab-btn {
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-tab-btn:hover, .admin-tab-btn.active {
  color: #ffffff;
}

.admin-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--admin-accent);
  border-radius: 3px 3px 0 0;
}

.badge-count {
  background: var(--admin-accent);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
}

/* Tab Content */
.admin-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
}

.stat-box {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.stat-box-title {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}

.stat-box-val {
  font-size: 1.85rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
}

/* Focused super-admin overview: one actionable queue and two quiet totals. */
.overview-heading { margin-bottom: 1.25rem; }
.overview-heading h2 { margin: 0 0 0.35rem; color: #fff; font: 700 1.5rem 'Outfit', sans-serif; }
.overview-heading p { color: #94a3b8; font-size: 0.9rem; }
.overview-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}
.overview-pending-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: 180px;
  padding: 1.5rem;
  border-color: rgba(234, 88, 12, 0.45);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.overview-pending-card:hover { background: var(--admin-card-hover); border-color: var(--admin-accent); }
.overview-priority-label { margin-bottom: 0.5rem; color: #fb923c; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; }
.overview-pending-card .stat-box-title { margin-bottom: 0.15rem; }
.overview-pending-card .stat-box-val { font-size: 2.2rem; }
.overview-action-label { margin-top: 0.5rem; color: #fdba74; font-size: 0.85rem; font-weight: 700; }
.overview-pending-card:focus-visible { outline: 3px solid #fbbf24; outline-offset: 3px; }
.overview-secondary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.overview-secondary-card { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.overview-secondary-card .stat-box-val { font-size: 1.5rem; overflow-wrap: anywhere; }

@media (max-width: 768px) {
  .overview-heading { margin-bottom: 0.9rem; }
  .overview-metrics { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .overview-pending-card { min-height: 150px; padding: 1.15rem; }
  .overview-secondary-grid { gap: 0.65rem; }
  .overview-secondary-card { padding: 0.9rem; }
  .overview-secondary-card .stat-box-title { min-height: 2.4em; font-size: 0.76rem; }
  .overview-secondary-card .stat-box-val { font-size: 1.25rem; }
}

/* Pending Receipts Table / Cards */
.receipts-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}

.receipt-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: transform 0.2s;
}

.receipt-card:hover {
  transform: translateY(-3px);
  border-color: rgba(234, 88, 12, 0.4);
}

.receipt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.receipt-ref {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fde047;
}

.receipt-thumb-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  cursor: pointer;
}

.receipt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.receipt-thumb-wrap:hover .receipt-thumb {
  transform: scale(1.04);
}

.receipt-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.btn-approve {
  flex: 1;
  background: #10b981;
  color: #ffffff;
  padding: 0.65rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-approve:hover {
  background: #059669;
}

.btn-reject {
  flex: 1;
  background: #ef4444;
  color: #ffffff;
  padding: 0.65rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-reject:hover {
  background: #dc2626;
}

/* Blackboard Daily List for Field Staff */
.field-chalkboard-container {
  background: #18181b;
  border: 8px solid #78350f;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.chalkboard-title {
  font-family: 'Outfit', cursive, sans-serif;
  font-size: 1.75rem;
  color: #fef08a;
  text-align: center;
  margin-bottom: 0.5rem;
}

.chalkboard-sub {
  text-align: center;
  color: #94a3b8;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.chalk-name-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chalk-name-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chalk-name-text {
  font-family: 'Dancing Script', cursive, sans-serif;
  font-size: 1.6rem;
  color: #ffffff;
  letter-spacing: 0.03em;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}

/* Login Modal */
.admin-login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #090e1f;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-login-card {
  background: #0f1c3f;
  border: 1px solid var(--admin-border);
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.pin-input {
  letter-spacing: 0.4em;
  font-size: 1.75rem;
  text-align: center;
  font-family: monospace;
}

/* Admin navigation and responsive workspace */
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 1.25rem 0.85rem 0.9rem; background: #0c1528; border-right: 1px solid var(--admin-border); }
.admin-side-brand { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.6rem 1.15rem; border-bottom: 1px solid var(--admin-border); }
.admin-side-brand img { width: 38px; height: 38px; object-fit: contain; }
.admin-side-brand strong, .admin-side-brand span { display: block; }
.admin-side-brand strong { color: #fff; font-weight: 750; }
.admin-side-brand span { color: #94a3b8; font-size: 0.76rem; margin-top: 0.15rem; }
.admin-tabs { display: grid; align-content: start; gap: 1.25rem; overflow: visible; padding: 1.25rem 0 0; background: transparent; border: 0; }
.admin-nav-group { display: grid; gap: 0.25rem; }
.admin-nav-group-title { padding: 0.1rem 0.65rem 0.35rem; color: #71809a; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.admin-tab-btn { position: relative; display: flex; align-items: center; gap: 0.65rem; width: 100%; min-height: 42px; padding: 0.62rem 0.7rem; border: 0; border-radius: 9px; background: transparent; color: #c6d0e0; text-align: left; font-size: 0.86rem; font-weight: 600; white-space: normal; transition: background 0.15s ease, color 0.15s ease; }
.admin-tab-btn:hover, .admin-tab-btn.active { color: #fff; background: #1a2945; }
.admin-tab-btn.active::after { content: none; }
.admin-nav-icon { width: 1.3rem; flex: 0 0 1.3rem; text-align: center; font-size: 1.05rem; }
.admin-tab-btn .badge-count { margin-left: auto; }
.admin-sidebar-footer { margin-top: auto; padding: 1rem 0.65rem 0.1rem; border-top: 1px solid var(--admin-border); color: #71809a; font-size: 0.75rem; }
.admin-main { min-width: 0; }
.admin-navbar { min-height: 68px; padding: 0.75rem 1.6rem; }
.admin-navbar .admin-brand { display: none; }
.admin-navbar::before { content: 'Yönetim Paneli'; color: #fff; font-weight: 700; }
.admin-container { width: min(100%, 1480px); max-width: none; margin: 0 auto; padding: 1.75rem 2rem 4rem; }
.overview-heading { margin-bottom: 1.35rem; }
.overview-metrics { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.overview-pending-card { min-height: 170px; }
.overview-secondary-grid { align-content: stretch; }
.admin-data-panel { padding: 1.2rem; border: 1px solid var(--admin-border); border-radius: 14px; background: var(--admin-card); }
.admin-table-scroll { width: 100%; overflow-x: auto; }
.calendar-range-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; align-items: end; }
.calendar-range-form > div:last-child { grid-column: 1 / -1; }
.admin-settings-group { padding: 0.9rem 0; border-bottom: 1px solid var(--admin-border); }
.admin-settings-group:last-of-type { border-bottom: 0; }
.admin-settings-group summary { cursor: pointer; color: #f8fafc; font-weight: 700; padding: 0.35rem 0; }
.admin-settings-fields { padding: 1rem 0 0.1rem; }
.admin-settings-save-row { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0 -0.25rem; padding: 0.85rem 0.25rem 0.25rem; background: linear-gradient(180deg, transparent, #0f172a 22%); }
.admin-settings-save { min-width: 190px; }
#settings-save-status { color: #86efac; font-size: 0.84rem; }
.admin-mobile-nav { display: none; }
.admin-body:not(.admin-authenticated) .field-staff-only { display: none !important; }
.admin-table-scroll table { min-width: 620px; }
.admin-responsive-table td { vertical-align: top; }
.dist-edit-backdrop { display: none; position: fixed; inset: 0; z-index: 2500; background: rgba(3, 8, 20, 0.72); }
.dist-edit-backdrop.active { display: block; }
.dist-edit-drawer { position: fixed; z-index: 2501; inset: 0 0 0 auto; width: min(680px, 100%); max-height: 100dvh; overflow-y: auto; margin: 0; padding: 1.5rem; border: 1px solid var(--admin-border); border-radius: 16px 0 0 16px; background: #0f172a; box-shadow: -18px 0 48px rgba(0,0,0,.35); }
.dist-edit-close { position: absolute; top: 0.85rem; right: 1rem; width: 42px; height: 42px; border: 1px solid var(--admin-border); border-radius: 50%; background: #1e293b; color: #fff; font-size: 1.4rem; }
.dist-edit-drawer h3 { padding-right: 3rem; }
.admin-page-heading { margin-bottom: 1.25rem; }
.admin-page-heading h2 { margin: 0 0 0.4rem; color: #fff; font-size: 1.5rem; }
.admin-page-heading p { margin: 0; color: #94a3b8; font-size: 0.88rem; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.admin-filter-input { width: min(100%, 360px); }
.admin-filter-select { width: min(100%, 210px); }
.admin-responsive-table [hidden], .receipt-card[hidden] { display: none !important; }

@media (max-width: 950px) {
  .admin-shell { grid-template-columns: 215px minmax(0, 1fr); }
  .admin-container { padding-inline: 1.35rem; }
}

@media (max-width: 680px) {
  .admin-shell { display: block; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .admin-sidebar { display: none; }
  .admin-navbar { min-height: 60px; padding: 0.55rem 1rem; }
  .admin-navbar::before { content: none; }
  .admin-navbar .admin-brand { display: flex; gap: 0.5rem; }
  .admin-navbar .admin-brand img { height: 32px; width: 32px; object-fit: contain; }
  .admin-brand-title { max-width: 115px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; }
  .admin-role-badge { max-width: 95px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.12rem 0.45rem; font-size: 0.64rem; }
  .admin-user-controls { gap: 0.4rem; }
  .admin-user-controls .btn { padding: 0.42rem 0.55rem; font-size: 0.74rem; }
  .admin-container { padding: 1.2rem 0.9rem 2rem; margin: 0 auto; }
  .overview-heading { margin-bottom: 0.9rem; }
  .overview-metrics { grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }
  .overview-pending-card { min-height: 145px; padding: 1rem; }
  .overview-secondary-grid { gap: 0.55rem; }
  .overview-secondary-card { padding: 0.75rem; }
  .overview-secondary-card .stat-box-title { min-height: 2.4em; font-size: 0.72rem; }
  .overview-secondary-card .stat-box-val { font-size: 1.12rem; }
  .receipts-list { grid-template-columns: minmax(0, 1fr); gap: 0.85rem; }
  .receipt-card { min-width: 0; padding: 1rem; }
  .receipt-card-header { gap: 0.5rem; flex-wrap: wrap; }
  .receipt-actions { position: static; }
  .receipt-actions button { min-height: 44px; }
  .chalk-name-item { align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; padding: 0.85rem; }
  .chalk-name-item .btn { min-height: 42px; }
  #tab-field > div:first-child { align-items: stretch !important; }
  #field-date-select { width: 100% !important; min-height: 44px; }
  #tab-upload > div, #tab-settings > div { padding: 1.15rem !important; }
  .form-row { grid-template-columns: minmax(0, 1fr) !important; gap: 0; }
  .calendar-range-form { grid-template-columns: minmax(0, 1fr); }
  .calendar-range-form > div:last-child { grid-column: auto; }
  .calendar-range-form button { width: 100% !important; min-height: 44px; }
  .admin-data-panel { padding: 0.9rem; }
  .admin-responsive-table table { min-width: 0; }
  .admin-responsive-table thead { display: none; }
  .admin-responsive-table table, .admin-responsive-table tbody { display: block; width: 100%; }
  .admin-responsive-table tr { display: block; margin: 0; padding: 0.75rem 0; border-bottom: 1px solid var(--admin-border); }
  .admin-responsive-table td { display: flex; justify-content: space-between; gap: 0.8rem; width: 100%; padding: 0.42rem 0 !important; border: 0 !important; text-align: right !important; overflow-wrap: anywhere; }
  .admin-responsive-table td::before { content: attr(data-label); flex: 0 0 36%; color: #94a3b8; text-align: left; font-size: 0.78rem; }
  .admin-responsive-table td[data-label="Ad Soyad"], .admin-responsive-table td[data-label="Bağışçı"] { display: block; text-align: left !important; font-weight: 700; }
  .admin-responsive-table td[data-label="Ad Soyad"]::before, .admin-responsive-table td[data-label="Bağışçı"]::before { content: none; }
  .admin-responsive-table td[data-label="İşlem"] { display: grid; grid-template-columns: 1fr; text-align: left !important; }
  .admin-responsive-table td[data-label="İşlem"]::before { margin-bottom: 0.3rem; }
  .admin-responsive-table td[data-label="İşlem"] .btn { margin: 0.2rem 0; min-height: 40px; white-space: normal; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-filter-input { width: 100%; }
  .admin-filter-select { width: 100%; }
  .admin-mobile-nav { position: fixed; z-index: 1500; inset: auto 0 0; display: flex; align-items: stretch; justify-content: space-around; gap: 0.2rem; padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--admin-border); background: rgba(11, 19, 41, 0.98); backdrop-filter: blur(12px); }
  .admin-mobile-nav > button { position: relative; flex: 1; min-width: 0; min-height: 52px; display: grid; justify-items: center; align-content: center; gap: 0.08rem; padding: 0.25rem 0.1rem; border: 0; border-radius: 9px; background: transparent; color: #94a3b8; font-size: 1.12rem; }
  .admin-mobile-nav > button.active { color: #fff; background: #1a2945; }
  .admin-mobile-nav > button small { font-size: 0.64rem; line-height: 1.1; }
  .admin-mobile-nav > button b { position: absolute; top: 1px; right: 7px; min-width: 17px; padding: 0 4px; border-radius: 99px; background: var(--admin-accent); color: #fff; font-size: 0.65rem; }
  .admin-mobile-more-menu { position: absolute; right: 0.7rem; bottom: calc(100% + 0.5rem); width: min(250px, calc(100vw - 1.4rem)); display: grid; gap: 0.25rem; padding: 0.55rem; border: 1px solid var(--admin-border); border-radius: 13px; background: #111b31; box-shadow: 0 16px 38px rgba(0,0,0,.35); }
  .admin-mobile-more-menu[hidden] { display: none; }
  .admin-mobile-more-menu .admin-tab-btn { min-height: 44px; }
  .dist-edit-drawer { width: 100%; max-height: 92dvh; top: auto; bottom: 0; border-radius: 16px 16px 0 0; padding: 1.1rem; }
  .admin-settings-save-row { position: sticky; bottom: 0; }
  .admin-settings-save { min-width: 0; }
}

@media (max-width: 420px) {
  .admin-user-controls > a { display: none; }
  .admin-navbar .admin-brand img { width: 28px; height: 28px; }
}
