/* ══════════════════════════════════════════════════
   HAMQADAM – ADMIN.CSS
   ══════════════════════════════════════════════════ */

:root {
  --primary: #0066FF;
  --primary-dark: #0047CC;
  --primary-light: #EBF3FF;
  --accent: #00C896;
  --danger: #FF3B5C;
  --warning: #FF9500;
  --info: #5856D6;
  --success: #34C759;
  --text-primary: #0A0F1E;
  --text-secondary: #5A6478;
  --text-muted: #9BA8BC;
  --border: #E2E8F4;
  --bg: #F0F4FA;
  --surface: #FFFFFF;
  --sidebar-bg: #0A0F1E;
  --sidebar-text: rgba(255,255,255,.65);
  --sidebar-active: rgba(255,255,255,.1);
  --font: 'Plus Jakarta Sans', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.06);
  --shadow-md: 0 8px 32px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text-primary); -webkit-font-smoothing: antialiased; }

/* ── Login Page ─────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0A0F1E 0%, #0047CC 100%);
  padding: 24px;
}
.login-card {
  background: var(--surface); border-radius: 24px;
  padding: 48px 40px; width: 100%; max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,.3);
  text-align: center;
}
.login-logo { margin-bottom: 20px; }
.login-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
.login-field { text-align: left; margin-bottom: 16px; }
.login-field label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }
.field-input-wrap { position: relative; }
.field-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.field-input {
  width: 100%; padding: 13px 14px 13px 42px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; transition: all .2s;
}
.field-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,255,.1); }
.btn-login {
  width: 100%; padding: 14px; background: var(--primary); color: #fff;
  border: none; border-radius: 100px; font-family: var(--font);
  font-size: 15px; font-weight: 700; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px;
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); }
.alert-error { background: #FFF0F3; border: 1px solid #FFCDD6; color: var(--danger); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13px; margin-bottom: 16px; text-align: left; }
.field-error { font-size: 12px; color: var(--danger); display: block; margin-top: 4px; }

/* ── Admin Shell ────────────────────────────────── */
.admin-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────── */
.sidebar {
  width: 256px; background: var(--sidebar-bg); flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: transform .3s ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand { font-size: 17px; font-weight: 800; color: #fff; }
.sidebar-sub { font-size: 11px; color: var(--sidebar-text); font-weight: 500; }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 600; margin-bottom: 4px;
  transition: all .2s;
}
.nav-item:hover { background: var(--sidebar-active); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item i { font-size: 16px; width: 20px; }
.nav-logout { margin-top: auto; color: rgba(255,80,80,.7); }
.nav-logout:hover { background: rgba(255,80,80,.1); color: rgba(255,80,80,.9); }
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.07);
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 700; color: #fff; }
.user-role { font-size: 11px; color: var(--sidebar-text); }

/* ── Admin Main ─────────────────────────────────── */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 64px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle { background: none; border: none; font-size: 20px; color: var(--text-secondary); cursor: pointer; display: none; }
.page-title { font-size: 18px; font-weight: 800; flex: 1; }
.toast-success {
  background: #E8FAF3; border: 1px solid #34C759; color: #1B7340;
  padding: 8px 16px; border-radius: 100px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.admin-content { padding: 28px; flex: 1; }

/* ── Dashboard ──────────────────────────────────── */
.stats-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; display: flex; gap: 14px; align-items: center;
  box-shadow: var(--shadow-sm); transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.stat-card.primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.warning .stat-icon { background: #FFF5E6; color: var(--warning); }
.stat-card.info .stat-icon { background: #EEEEFF; color: var(--info); }
.stat-card.success .stat-icon { background: #E9FAF0; color: var(--success); }
.stat-card.danger .stat-icon { background: #FFECEF; color: var(--danger); }
.stat-num { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-name { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

.finance-banner {
  background: linear-gradient(135deg, var(--primary), #0090FF);
  border-radius: var(--radius); padding: 20px 28px;
  display: flex; align-items: center; gap: 32px; margin-bottom: 24px;
}
.finance-item { display: flex; flex-direction: column; gap: 4px; }
.finance-label { font-size: 12px; color: rgba(255,255,255,.7); font-weight: 600; }
.finance-val { font-size: 24px; font-weight: 800; color: #fff; }
.finance-val.approved { color: #7FFFCB; }
.finance-divider { width: 1px; height: 48px; background: rgba(255,255,255,.2); }

.dashboard-bottom { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.dashboard-panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 15px; font-weight: 700; }
.panel-link { font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 4px; }

/* ── Table ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--bg); padding: 12px 16px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: #FAFBFE; }
.data-table tr:last-child td { border-bottom: none; }
.id-cell { font-weight: 700; color: var(--text-muted); }
.amount-cell { font-weight: 700; color: var(--primary); }
.empty-table { text-align: center; color: var(--text-muted); padding: 40px !important; }

.applicant-cell { display: flex; align-items: center; gap: 10px; }
.applicant-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.applicant-name { font-weight: 600; font-size: 13px; }
.applicant-cnic { font-size: 11px; color: var(--text-muted); }

/* ── Status Badges ──────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 100px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.status-badge.pending { background: #FFF5E6; color: #CC6A00; }
.status-badge.under-review { background: #EEEEFF; color: var(--info); }
.status-badge.approved { background: #E9FAF0; color: #1B7340; }
.status-badge.rejected { background: #FFECEF; color: var(--danger); }
.status-lg { padding: 8px 20px; font-size: 13px; }

/* ── District Bar ───────────────────────────────── */
.district-list { padding: 16px 20px; }
.district-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.district-name { font-size: 12px; font-weight: 600; width: 90px; flex-shrink: 0; color: var(--text-secondary); }
.district-bar-wrap { flex: 1; background: var(--bg); border-radius: 4px; height: 8px; overflow: hidden; }
.district-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #0090FF); border-radius: 4px; transition: width .6s ease; }
.district-count { font-size: 12px; font-weight: 700; width: 24px; text-align: right; }

/* ── Apps Page ──────────────────────────────────── */
.apps-page { display: flex; flex-direction: column; gap: 16px; }
.filter-bar { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow-sm); }
.search-form { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 100px; padding: 8px 16px; flex: 1; min-width: 200px;
}
.search-wrap i { color: var(--text-muted); }
.search-input { border: none; background: none; font-family: var(--font); font-size: 14px; outline: none; width: 100%; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
  padding: 6px 14px; border-radius: 100px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-decoration: none;
  border: 1.5px solid var(--border); background: var(--surface); transition: all .2s;
}
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-tab:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.btn-search {
  padding: 8px 20px; background: var(--primary); color: #fff;
  border: none; border-radius: 100px; font-family: var(--font);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.result-meta { font-size: 13px; color: var(--text-secondary); }
.filter-chip { background: var(--primary-light); color: var(--primary); padding: 2px 10px; border-radius: 100px; margin-left: 8px; font-size: 12px; font-weight: 600; }
.filter-chip a { color: inherit; margin-left: 4px; text-decoration: none; }
.btn-view {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 100px;
  background: var(--primary-light); color: var(--primary);
  text-decoration: none; font-size: 12px; font-weight: 600; transition: all .2s;
}
.btn-view:hover { background: var(--primary); color: #fff; }

/* ── Detail Page ────────────────────────────────── */
.detail-page { display: flex; flex-direction: column; gap: 20px; }
.detail-header { display: flex; align-items: center; gap: 16px; }
.back-link { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); }
.profile-card { display: flex; gap: 20px; align-items: center; }
.profile-pic { width: 90px; height: 90px; border-radius: 50%; overflow: hidden; background: var(--primary-light); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.profile-pic img { width: 100%; height: 100%; object-fit: cover; }
.profile-placeholder { font-size: 36px; font-weight: 800; color: var(--primary); }
.profile-info h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.profile-info p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.profile-info i { color: var(--text-muted); width: 14px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-row { display: flex; flex-direction: column; gap: 4px; }
.info-row.full { grid-column: 1 / -1; }
.info-row span { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.info-row strong { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.amount-highlight { color: var(--primary) !important; font-size: 18px !important; }

/* Status Update Card */
.status-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.status-radio {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); cursor: pointer; transition: all .2s;
}
.status-radio input { accent-color: var(--primary); }
.status-radio span { font-size: 14px; font-weight: 600; }
.status-radio.pending:has(input:checked) { background: #FFF5E6; border-color: var(--warning); }
.status-radio.under-review:has(input:checked) { background: #EEEEFF; border-color: var(--info); }
.status-radio.approved:has(input:checked) { background: #E9FAF0; border-color: var(--success); }
.status-radio.rejected:has(input:checked) { background: #FFECEF; border-color: var(--danger); }
.notes-label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 8px; }
.notes-field {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font);
  font-size: 14px; resize: vertical; transition: all .2s;
  margin-bottom: 16px;
}
.notes-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,255,.1); }
.btn-update {
  width: 100%; padding: 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 100px; font-family: var(--font);
  font-size: 14px; font-weight: 700; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-update:hover { background: var(--primary-dark); }
.meta-list { display: flex; flex-direction: column; gap: 12px; }
.meta-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.meta-row span { color: var(--text-muted); }
.meta-row strong { font-weight: 600; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .dashboard-bottom { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -256px; z-index: 200; height: 100%; }
  .sidebar.open { left: 0; }
  .sidebar-toggle { display: flex; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .profile-card { flex-direction: column; text-align: center; }
}
