/* =====================================================
   Bhagirathi Enterprises — Admin Panel Stylesheet
   ===================================================== */

:root {
  --navy:       #0B2239;
  --navy-dark:  #071829;
  --navy-light: #0e2d4a;
  --teal:       #0D8A72;
  --teal-light: #10a688;
  --gold:       #D4AF37;
  --gold-light: #e8c84a;
  --white:      #FFFFFF;
  --offwhite:   #FAF9F6;
  --sidebar-w:  260px;
  --header-h:   65px;
  --font-body:  'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-head:  'Playfair Display', 'Georgia', serif;
  --shadow-sm:  0 2px 8px rgba(11,34,57,.08);
  --shadow-md:  0 8px 24px rgba(11,34,57,.12);
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --transition: all .25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: #F0F4F8;
  color: #1e293b;
  font-size: .925rem;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
img { max-width: 100%; height: auto; }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy) 100%);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.sidebar-brand img { height: 38px; width: auto; }
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-text .name {
  font-family: var(--font-head);
  font-size: .95rem;
  color: white;
  font-weight: 700;
}
.sidebar-brand-text .sub {
  font-size: .68rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 1rem 0; }

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 1.25rem 1.25rem .4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.65);
  font-size: .88rem;
  font-weight: 500;
  border-radius: 0;
  margin: .08rem .6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: .95rem;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.08);
  color: white;
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--teal), rgba(13,138,114,.7));
  color: white;
  box-shadow: 0 4px 12px rgba(13,138,114,.3);
}

.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy);
  font-size: .68rem;
  font-weight: 700;
  padding: .15em .5em;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  background: rgba(212,175,55,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-weight: 700;
  font-size: .95rem;
  border: 1.5px solid rgba(212,175,55,.3);
}
.sidebar-user-info .name {
  font-size: .85rem;
  color: white;
  font-weight: 600;
  line-height: 1.2;
}
.sidebar-user-info .role {
  font-size: .7rem;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: rgba(255,255,255,.5);
  transition: var(--transition);
  padding: .3rem 0;
}
.btn-logout:hover { color: #ef4444; }

/* ---- MAIN CONTENT ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOPBAR ---- */
.admin-topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: #F0F4F8;
  border: 1.5px solid #E2E8F0;
  border-radius: 50px;
  padding: .4rem 1rem;
  font-size: .88rem;
  color: #64748b;
  transition: var(--transition);
}
.topbar-search:focus-within { border-color: var(--teal); background: white; }
.topbar-search input {
  background: none;
  border: none;
  outline: none;
  font-size: .88rem;
  color: #1e293b;
  width: 180px;
}

.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.topbar-btn {
  width: 38px; height: 38px;
  background: #F0F4F8;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #64748b;
  font-size: .95rem;
  transition: var(--transition);
  position: relative;
  cursor: pointer;
}
.topbar-btn:hover { background: var(--navy); color: white; border-color: var(--navy); }

.topbar-notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 50%;
  border: 2px solid white;
}

/* ---- CONTENT AREA ---- */
.admin-content {
  flex: 1;
  padding: 2rem 1.75rem;
}

/* ============================================================
   ADMIN COMPONENTS
   ============================================================ */

/* KPI Cards */
.kpi-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-card.navy::after   { background: var(--navy); }
.kpi-card.teal::after   { background: var(--teal); }
.kpi-card.gold::after   { background: var(--gold); }
.kpi-card.green::after  { background: #22c55e; }
.kpi-card.red::after    { background: #ef4444; }

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi-icon {
  width: 50px; height: 50px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.kpi-icon.navy   { background: rgba(11,34,57,.1);  color: var(--navy); }
.kpi-icon.teal   { background: rgba(13,138,114,.1); color: var(--teal); }
.kpi-icon.gold   { background: rgba(212,175,55,.1); color: var(--gold-light); }
.kpi-icon.green  { background: rgba(34,197,94,.1);  color: #22c55e; }
.kpi-icon.red    { background: rgba(239,68,68,.1);   color: #ef4444; }

.kpi-label {
  font-size: .78rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: .3rem;
}
.kpi-value {
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.kpi-change {
  font-size: .78rem;
  margin-top: .3rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.kpi-change.up   { color: #22c55e; }
.kpi-change.down { color: #ef4444; }

/* Admin Cards */
.admin-card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid #E2E8F0;
  overflow: hidden;
}

.admin-card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.admin-card-header h6 {
  font-size: .92rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.admin-card-header h6 i { color: var(--teal); }
.admin-card-body { padding: 1.5rem; }

/* Tables */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead th {
  background: #F8FAFC;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  padding: .75rem 1rem;
  border-bottom: 1.5px solid #E2E8F0;
  white-space: nowrap;
}
.admin-table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid #F1F5F9;
  font-size: .88rem;
  color: #1e293b;
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #F8FAFC; }

/* Status Badges */
.badge-status {
  font-size: .72rem;
  font-weight: 700;
  padding: .3em .75em;
  border-radius: 50px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-paid      { background: rgba(34,197,94,.12);  color: #15803d; }
.badge-unpaid    { background: rgba(239,68,68,.12);   color: #dc2626; }
.badge-partial   { background: rgba(234,179,8,.12);   color: #92400e; }
.badge-draft     { background: rgba(100,116,139,.1);  color: #475569; }
.badge-sent      { background: rgba(59,130,246,.12);  color: #1d4ed8; }
.badge-new       { background: rgba(212,175,55,.15);  color: #92400e; }
.badge-converted { background: rgba(13,138,114,.12);  color: var(--teal); }

/* Action buttons */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 600;
  padding: .3rem .7rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  transition: var(--transition);
  cursor: pointer;
}
.btn-action.edit   { color: var(--teal);  border-color: rgba(13,138,114,.3);  background: rgba(13,138,114,.06); }
.btn-action.delete { color: #ef4444; border-color: rgba(239,68,68,.3);   background: rgba(239,68,68,.06); }
.btn-action.view   { color: var(--navy);  border-color: rgba(11,34,57,.2);    background: rgba(11,34,57,.04); }
.btn-action.pdf    { color: var(--gold);  border-color: rgba(212,175,55,.3);  background: rgba(212,175,55,.06); }
.btn-action:hover  { opacity: .85; transform: translateY(-1px); }

/* Admin Buttons */
.btn-admin-primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark, #0a7260));
  color: white;
  font-weight: 600;
  font-size: .88rem;
  padding: .6rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: var(--transition);
  cursor: pointer;
}
.btn-admin-primary:hover {
  background: linear-gradient(135deg, var(--teal-light), var(--teal));
  box-shadow: 0 4px 16px rgba(13,138,114,.3);
  transform: translateY(-1px);
  color: white;
}

.btn-admin-secondary {
  background: white;
  color: var(--navy);
  font-weight: 600;
  font-size: .88rem;
  padding: .58rem 1.4rem;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: var(--transition);
  cursor: pointer;
}
.btn-admin-secondary:hover { border-color: var(--navy); background: var(--navy); color: white; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #b8942a);
  color: var(--navy);
  font-weight: 700;
  font-size: .88rem;
  padding: .6rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: var(--transition);
  cursor: pointer;
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,175,55,.4); color: var(--navy); }

/* ============================================================
   FORM STYLES (ADMIN)
   ============================================================ */
.form-section {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid #E2E8F0;
  margin-bottom: 1.5rem;
}
.form-section-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1.5px solid #F1F5F9;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.form-section-title i { color: var(--teal); }

.admin-form-label {
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: .4rem;
  display: block;
}
.admin-form-control {
  width: 100%;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  font-size: .9rem;
  color: #1e293b;
  background: white;
  transition: var(--transition);
  font-family: var(--font-body);
}
.admin-form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,138,114,.1);
  outline: none;
}
.admin-form-control.is-invalid { border-color: #ef4444; }

/* Line Items Table (Quotation/Invoice) */
.line-items-table { width: 100%; border-collapse: collapse; }
.line-items-table thead th {
  background: #F8FAFC;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  padding: .6rem .75rem;
  border: 1px solid #E2E8F0;
  white-space: nowrap;
}
.line-items-table tbody td {
  padding: .4rem .5rem;
  border: 1px solid #E2E8F0;
  vertical-align: middle;
}
.line-items-table tbody td input,
.line-items-table tbody td select {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: .88rem;
  padding: .3rem .4rem;
  font-family: var(--font-body);
}
.line-items-table tbody td input:focus { background: #F0FDF4; border-radius: var(--radius-sm); }
.line-items-table tfoot td {
  padding: .5rem .75rem;
  font-size: .88rem;
}

/* GST Totals Panel */
.gst-totals-panel {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}
.gst-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem 0;
  font-size: .88rem;
}
.gst-row + .gst-row { border-top: 1px solid #E2E8F0; }
.gst-row.total {
  padding-top: .75rem;
  margin-top: .3rem;
  border-top: 2px solid var(--navy) !important;
}
.gst-row.total .amount {
  font-family: var(--font-head);
  font-size: 1.3rem;
  color: var(--navy);
  font-weight: 700;
}
.gst-row label { color: #64748b; }
.gst-row .amount { font-weight: 600; color: #1e293b; }

/* Amount in words */
.amount-words {
  background: rgba(13,138,114,.06);
  border: 1px dashed rgba(13,138,114,.3);
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font-size: .85rem;
  color: var(--teal);
  font-style: italic;
  margin-top: .75rem;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.admin-page-header h1 {
  font-size: 1.4rem;
  color: var(--navy);
  font-family: var(--font-head);
}
.breadcrumb-admin {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: #64748b;
  margin-top: .2rem;
}
.breadcrumb-admin a { color: var(--teal); }
.breadcrumb-admin i { font-size: .6rem; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(145deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 60% at 80% 50%, rgba(13,138,114,.15) 0%, transparent 70%);
}

.login-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo img { height: 56px; margin: 0 auto .75rem; }
.login-logo h2 {
  font-size: 1.3rem;
  color: var(--navy);
  margin-bottom: .3rem;
}
.login-logo p { font-size: .82rem; color: #64748b; }

/* ============================================================
   RESPONSIVE ADMIN
   ============================================================ */
.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(-100%);
    z-index: 1001;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-sidebar-overlay.show { display: block; }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 1.25rem; }
}

@media (max-width: 575.98px) {
  .admin-topbar { padding: 0 1rem; }
  .topbar-search { display: none; }
  .kpi-value { font-size: 1.4rem; }
}

/* Chart containers */
.chart-container { position: relative; }
.chart-container canvas { max-height: 320px; }

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.page-btn {
  width: 34px; height: 34px;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
  background: white;
  cursor: pointer;
  transition: var(--transition);
}
.page-btn.active, .page-btn:hover { background: var(--navy); border-color: var(--navy); color: white; }

