/* ============================================================
   RAHNUMA — Shared Design System
   Citizens Benefits Portal · Pakistan
   ============================================================ */

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

:root {
  /* Palette */
  --green-900: #0a2116;
  --green-800: #0d2818;
  --green-700: #0d7a45;
  --green-600: #16a05c;
  --green-400: #4ade80;
  --green-100: #e6f7ee;
  --green-50:  #f6fdf9;

  --surface:   #ffffff;
  --surface2:  #f6fdf9;
  --border:    #d0eadb;
  --border2:   #b8dfc8;

  --text:      #0d2818;
  --text2:     #3a6b50;
  --text3:     #7aaa90;
  --text-inv:  #ffffff;

  --gold:      #c9a84c;
  --gold-bg:   #fffbeb;
  --gold-border: #f5d87a;
  --gold-text: #7a5800;

  --red:       #dc2626;
  --red-bg:    #fef2f2;
  --blue:      #2563eb;
  --blue-bg:   #eff6ff;

  --accent:       var(--green-700);
  --accent-mid:   var(--green-600);
  --accent-light: var(--green-100);
  --accent-dim:   rgba(13,122,69,0.09);

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(13,122,69,0.07), 0 2px 12px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 20px rgba(13,122,69,0.10), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(13,122,69,0.14), 0 2px 8px rgba(0,0,0,0.06);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Nav */
  --nav-w: 240px;
  --header-h: 60px;

  /* Urdu font */
  --urdu-font: "Noto Nastaliq Urdu", serif;
}

/* ── BASE ── */
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--green-50);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── TYPOGRAPHY ── */
.t-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
}

.t-urdu {
  font-family: var(--urdu-font);
  direction: rtl;
}

/* ── SHARED HEADER (top bar) ── */
.top-bar {
  height: var(--header-h);
  background: var(--accent);
  display: flex;
  align-items: center;
  padding: 0 clamp(12px, 3vw, 28px);
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(13,122,69,0.25);
  flex-shrink: 0;
}

.top-bar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.top-bar-logo .flag { font-size: 22px; }
.top-bar-logo h1 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
}
.top-bar-logo span {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-weight: 400;
  margin-left: 2px;
}

.top-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 5px 12px;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  flex-shrink: 0;
  transition: background 0.3s;
}
.status-dot.online { background: #86efac; box-shadow: 0 0 6px rgba(134,239,172,0.6); }
.status-label { font-size: 11px; color: rgba(255,255,255,0.85); font-weight: 500; }

/* User avatar in header */
.header-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
.header-avatar:hover { background: rgba(255,255,255,0.3); text-decoration: none; }

/* ── SIDEBAR NAV ── */
.portal-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

.sidebar-nav {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  padding: 14px 10px 6px;
}
.nav-section-label:first-child { padding-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
}
.nav-item i { font-size: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--accent-light); color: var(--accent); text-decoration: none; }
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: clamp(16px, 3vw, 32px);
  overflow-y: auto;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 2.5vw, 24px);
  box-shadow: var(--shadow-sm);
}

.card-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(13,122,69,0.3);
}
.btn-primary:hover { background: var(--accent-mid); box-shadow: 0 4px 16px rgba(13,122,69,0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border2);
}
.btn-outline:hover { background: var(--accent-light); border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: none;
}
.btn-ghost:hover { background: var(--accent-dim); color: var(--accent); }

.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── BADGES / STATUS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: var(--green-100); color: var(--green-700); }
.badge-gold   { background: var(--gold-bg); color: var(--gold-text); border: 1px solid var(--gold-border); }
.badge-red    { background: var(--red-bg); color: var(--red); }
.badge-blue   { background: var(--blue-bg); color: var(--blue); }
.badge-gray   { background: #f1f5f9; color: #64748b; }

/* ── FORM ELEMENTS ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.form-label .urdu-label {
  font-size: 12px;
  color: var(--text3);
  font-weight: 400;
  margin-left: 6px;
  font-family: var(--urdu-font);
  direction: rtl;
}

.form-input, .form-select {
  padding: 11px 14px;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,122,69,0.1);
}
.form-input::placeholder { color: var(--text3); }
.form-input.error { border-color: var(--red); }
.form-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.form-error {
  font-size: 11px;
  color: var(--red);
  margin-top: 2px;
  display: none;
}

/* ── GRID HELPERS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── DIVIDER ── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 12px;
  font-weight: 500;
  margin: 4px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── TOAST NOTIFICATION ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green-800);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast i { font-size: 16px; color: var(--green-400); }

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}
.page-header .urdu {
  font-size: 13px;
  color: var(--text3);
  direction: rtl;
  margin-top: 2px;
  font-family: var(--urdu-font);
}
.page-header p {
  font-size: 14px;
  color: var(--text2);
  margin-top: 4px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── MOBILE NAV (bottom tab bar) ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  color: var(--text3);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
  border: none;
  background: transparent;
  font-family: inherit;
}
.mobile-nav-item i { font-size: 20px; }
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item:hover { color: var(--accent); text-decoration: none; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  :root { --nav-w: 200px; }
}

@media (max-width: 700px) {
  .sidebar-nav { display: none; }
  .mobile-nav  { display: block; }
  .main-content { padding: 16px 14px 80px; } /* bottom padding for mobile nav */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 440px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}