/* =====================================================
   Pashu Sanvardhan Vibhag — Smart Governance Portal
   Color System: Government Green + Saffron accent
   ===================================================== */

:root {
  --primary: #1a5f3f;        /* Deep Forest Green */
  --primary-dark: #0f3d28;
  --primary-light: #2d8a5e;
  --accent: #e8852a;         /* Saffron/Govt Orange */
  --accent-light: #f5a55a;
  --bg: #f0f4f0;
  --bg-card: #ffffff;
  --text: #1a2e1a;
  --text-muted: #5a6b5a;
  --border: #c8d8c8;
  --success: #2e7d32;
  --warning: #f57c00;
  --danger: #c62828;
  --info: #1565c0;
  --sidebar-w: 260px;
}

* { 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; }

/* ── Sidebar Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  text-align: center;
}
.sidebar-brand .emblem { font-size: 2rem; margin-bottom: 6px; }
.sidebar-brand h2 { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.5px; color: #b8d4b8; line-height: 1.4; }
.sidebar-brand .portal-name { font-size: 0.95rem; font-weight: 700; color: var(--accent-light); margin-top: 4px; }

.sidebar-user {
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user .user-name { font-size: 0.9rem; font-weight: 600; }
.sidebar-user .user-role { font-size: 0.72rem; color: var(--accent-light); text-transform: uppercase; letter-spacing: 0.8px; }
.sidebar-user .user-location { font-size: 0.75rem; color: #9ab89a; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1.2px; color: #7a9a7a; padding: 14px 16px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: #c8e0c8;
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; border-left-color: var(--accent-light); }
.nav-link.active { background: rgba(232,133,42,0.18); color: #fff; border-left-color: var(--accent); font-weight: 600; }
.nav-link .icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.1); }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: #fff;
  border-bottom: 2px solid var(--accent);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--primary-dark); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.month-badge { background: var(--primary); color: #fff; padding: 4px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }

.page-content { padding: 24px; flex: 1; }

/* ── Flash Messages ── */
.flash-msgs { margin-bottom: 16px; }
.flash-msg {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.flash-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.flash-error { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }

/* ── Cards & Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  position: relative;
  overflow: hidden;
}
.stat-card.accent { border-top-color: var(--accent); }
.stat-card.success { border-top-color: var(--success); }
.stat-card.info { border-top-color: var(--info); }
.stat-card.warning { border-top-color: var(--warning); }
.stat-card.danger { border-top-color: var(--danger); }
.stat-icon { font-size: 2rem; position: absolute; top: 14px; right: 16px; opacity: 0.2; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--primary-dark); line-height: 1; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Section Cards ── */
.card { background: #fff; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 20px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  border-radius: 8px 8px 0 0;
  color: #fff;
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--primary-dark); }
.form-label .required { color: var(--danger); }
.form-control {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,95,63,0.12); }
.form-control[readonly] { background: #f4f8f4; color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
  margin: 22px 0 16px;
}

/* Monthly / Progressive dual columns */
.dual-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dual-header { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; align-items: center; margin-bottom: 8px; }
.dual-header span { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); text-align: center; }
.dual-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; align-items: center; padding: 4px 0; border-bottom: 1px solid #f0f0f0; }
.dual-row label { font-size: 0.83rem; color: var(--text); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th { background: var(--primary); color: #fff; padding: 10px 12px; text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
tbody tr { border-bottom: 1px solid #edf2ed; }
tbody tr:hover { background: #f4f9f4; }
tbody td { padding: 10px 12px; color: var(--text); vertical-align: middle; }
.td-right { text-align: right; }
.td-center { text-align: center; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.badge-draft { background: #fff3e0; color: #e65100; }
.badge-submitted { background: #e3f2fd; color: #0d47a1; }
.badge-reviewed { background: #e8f5e9; color: #1b5e20; }
.badge-green { background: #e8f5e9; color: #1b5e20; }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-red { background: #ffebee; color: #b71c1c; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; text-decoration: none;
  transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #c96d1a; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.page-header h1 { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); }
.page-header .subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; }

/* ── Progress Bar ── */
.progress-wrap { background: #e0ece0; border-radius: 10px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--primary-light), var(--primary)); transition: width 0.5s; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #2d8a5e 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-container { display: grid; grid-template-columns: 1fr 420px; gap: 0; max-width: 900px; width: 100%; margin: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); border-radius: 12px; overflow: hidden; }
.login-left { background: rgba(255,255,255,0.08); backdrop-filter: blur(10px); padding: 48px 40px; color: #fff; display: flex; flex-direction: column; justify-content: center; }
.login-left .logo-area { text-align: center; margin-bottom: 32px; }
.login-left .logo-area .emblem { font-size: 4rem; }
.login-left h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.login-left .subtitle { font-size: 0.85rem; color: rgba(255,255,255,0.75); line-height: 1.5; }
.login-left .feature-list { margin-top: 28px; list-style: none; }
.login-left .feature-list li { padding: 6px 0; font-size: 0.85rem; color: rgba(255,255,255,0.85); display: flex; align-items: center; gap: 8px; }
.login-right { background: #fff; padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
.login-right h2 { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.login-right .login-sub { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 28px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .login-container { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .page-actions, .btn { display: none !important; }
  .main-content { margin-left: 0; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal-panel {
  width: min(100%, 840px);
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  padding: 18px 22px 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px 20px;
}

.detail-grid-animals {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.detail-grid > div {
  background: #f8fafb;
  border: 1px solid #e8ebef;
  border-radius: 10px;
  padding: 14px 16px;
}

.detail-grid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.detail-grid div div {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

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

.remarks-text {
  margin: 10px 0 0;
  line-height: 1.6;
  color: #333;
}

/* ── Utility ── */
.text-muted { color: var(--text-muted); font-size: 0.82rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 16px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }
