/* ══════════════════════════════════════════════════════════
   GRAMPROFILE UNIFIED DESIGN SYSTEM v5
   Symmetric UI across all pages · Green + Saffron · Mobile-first
══════════════════════════════════════════════════════════ */
:root {
  /* Brand */
  --green:        #16a34a;
  --green-dark:   #15803d;
  --green-darker: #14532d;
  --green-light:  #dcfce7;
  --green-bg:     #f0fdf4;
  --forest:       #14532d;
  --forest2:      #166534;
  --saffron:      #ea580c;
  --saffron-lt:   #fff7ed;
  --amber:        #b45309;
  --amber-lt:     #fef3c7;
  --blue:         #1e40af;
  --blue-lt:      #dbeafe;
  --red:          #dc2626;
  --red-lt:       #fef2f2;
  --purple:       #6d28d9;
  --purple-lt:    #ede9fe;

  /* Surfaces */
  --bg:           #f5f5f0;
  --surface:      #ffffff;
  --surface2:     #f8fafc;
  --border:       #e2e8f0;
  --border2:      #cbd5e1;

  /* Text */
  --text:         #0f172a;
  --text-2:       #334155;
  --text-3:       #64748b;
  --text-4:       #94a3b8;

  /* Layout */
  --nav-h:        60px;
  --max-w:        1200px;
  --radius-sm:    10px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-full:  9999px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:       0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:    0 10px 40px rgba(0,0,0,.12);
  --shadow-btn:   0 2px 8px rgba(22,163,74,.25);

  /* Font */
  --font:         'Baloo 2', 'Noto Sans Devanagari', system-ui, -apple-system, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Transitions */
  --tr:           all .25s cubic-bezier(.4,0,.2,1);
  --ease:         cubic-bezier(.4,0,.2,1);
}

/* Dark mode */
.dark, [data-theme="dark"] {
  --bg:           #080f0a;
  --surface:      #0f1a10;
  --surface2:     #162012;
  --border:       #243320;
  --border2:      #2f4028;
  --text:         #f0fdf4;
  --text-2:       #d1fae5;
  --text-3:       #86efac;
  --text-4:       #4ade80;
  --green-light:  #052e16;
  --green-bg:     #061209;
  --blue-lt:      #0c1a3a;
  --saffron-lt:   #1c0800;
  --amber-lt:     #1a0e00;
  --purple-lt:    #150b2a;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── Unified Buttons with Icons ── */
.btn, .gp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.25;
  border-radius: var(--radius);
  border: 2px solid transparent;
  padding: 10px 18px;
  cursor: pointer;
  transition: var(--tr);
  white-space: nowrap;
  text-decoration: none;
  min-height: 44px; /* touch target */
}
.btn i, .gp-btn i { font-size: 1.1em; line-height: 1; }

.btn-primary, .gp-btn-primary {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff !important;
  border-color: var(--green-dark);
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover, .gp-btn-primary:hover {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--forest) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(22,163,74,.35);
}

.btn-secondary, .gp-btn-secondary {
  background: var(--surface);
  color: var(--text-2) !important;
  border-color: var(--border2);
}
.btn-secondary:hover, .gp-btn-secondary:hover {
  background: var(--surface2);
  border-color: var(--green);
  color: var(--green) !important;
}

.btn-saffron, .gp-btn-saffron {
  background: linear-gradient(135deg, var(--saffron) 0%, #c2410c 100%);
  color: #fff !important;
  border-color: #c2410c;
}
.btn-saffron:hover, .gp-btn-saffron:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-outline-primary, .gp-btn-outline {
  background: transparent;
  color: var(--green) !important;
  border-color: var(--green);
}
.btn-outline-primary:hover, .gp-btn-outline:hover {
  background: var(--green-light);
}

.btn-danger, .gp-btn-danger {
  background: var(--red);
  color: #fff !important;
  border-color: #b91c1c;
}
.btn-sm, .gp-btn-sm {
  padding: 6px 12px;
  font-size: .8rem;
  min-height: 36px;
  border-radius: var(--radius-sm);
}
.btn-lg, .gp-btn-lg {
  padding: 14px 24px;
  font-size: 1.05rem;
  min-height: 52px;
}
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

/* ── Cards ── */
.gp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--tr);
}
.gp-card:hover { box-shadow: var(--shadow); }

/* ── Tables – Responsive ── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.table-responsive table {
  width: 100%;
  min-width: 600px; /* force scroll on small screens */
  border-collapse: collapse;
  font-size: .9rem;
}
.table-responsive th {
  background: var(--green-bg);
  color: var(--forest);
  font-weight: 800;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 2px solid var(--green-light);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-responsive td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.table-responsive tbody tr:hover {
  background: var(--green-bg);
}
.table-responsive tbody tr:last-child td {
  border-bottom: none;
}

/* Mobile: card-style table alternative */
@media (max-width: 640px) {
  .table-card-mobile { display: block; }
  .table-card-mobile thead { display: none; }
  .table-card-mobile tbody,
  .table-card-mobile tr,
  .table-card-mobile td {
    display: block;
    width: 100%;
  }
  .table-card-mobile tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }
  .table-card-mobile td {
    border: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .table-card-mobile td::before {
    content: attr(data-label);
    font-weight: 800;
    color: var(--text-3);
    font-size: .78rem;
    text-transform: uppercase;
    flex-shrink: 0;
  }
  .table-responsive table { min-width: 0; }
}

/* ── Form controls ── */
.form-control, .gp-input, select.gp-select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
  transition: var(--tr);
}
.form-control:focus, .gp-input:focus, select.gp-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(22,163,74,.15);
}
.form-label, .gp-label {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* ── Page container ── */
.gp-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px;
  width: 100%;
}
@media (min-width: 768px) {
  .gp-container { padding: 24px; }
}

/* ── Utility ── */
.text-green { color: var(--green) !important; }
.text-saffron { color: var(--saffron) !important; }
.bg-green-light { background: var(--green-light) !important; }
.rounded-gp { border-radius: var(--radius) !important; }
.shadow-gp { box-shadow: var(--shadow) !important; }

/* Full width on mobile for main content */
@media (max-width: 640px) {
  .gp-full-mobile {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
  }
  body { font-size: 15px; }
  .btn, .gp-btn { width: 100%; } /* optional full-width buttons on very small screens when stacked */
  .btn-group-mobile { display: flex; flex-direction: column; gap: 8px; }
  .btn-group-mobile .btn { width: 100%; }
}
