/* ============================================================
   UROMED HEALTHCARE RENTALS — Main Stylesheet
   Brand: Dark Navy (#0d1b2a) + Green-to-Blue gradient
   Font: Outfit (headings) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:        #0d1b2a;
  --navy-mid:    #152536;
  --navy-light:  #1e3a52;
  --accent-g:    #3dd68c;
  --accent-b:    #38bdf8;
  --grad:        linear-gradient(135deg, #3dd68c 0%, #0ea5e9 100%);
  --grad-soft:   linear-gradient(135deg, rgba(61,214,140,.15) 0%, rgba(56,189,248,.15) 100%);
  --white:       #ffffff;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-200:    #e2e8f0;
  --gray-300:    #cbd5e1;
  --gray-400:    #94a3b8;
  --gray-500:    #64748b;
  --gray-600:    #475569;
  --gray-700:    #334155;
  --gray-800:    #1e293b;
  --red:         #ef4444;
  --red-soft:    #fee2e2;
  --green:       #22c55e;
  --green-soft:  #dcfce7;
  --yellow:      #f59e0b;
  --yellow-soft: #fef3c7;
  --text-main:   #1e293b;
  --text-sub:    #64748b;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 2px 12px rgba(13,27,42,.08);
  --shadow-md:   0 6px 24px rgba(13,27,42,.12);
  --shadow-lg:   0 20px 48px rgba(13,27,42,.18);
  --sidebar-w:   260px;
  --header-h:    64px;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--gray-100);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .3s ease;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-light) transparent;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img { width: 150px; object-fit: contain; display: block; margin: 0 auto; }

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

.nav-section {
  padding: 8px 20px 4px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  margin-top: 8px;
}

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  transition: all .2s;
  position: relative;
  border-radius: 0;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.active {
  color: #fff;
  background: var(--grad-soft);
  border-right: 3px solid var(--accent-g);
}
.nav-link svg, .nav-link .icon { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
.nav-link.active svg, .nav-link.active .icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.5);
  text-decoration: none;
  font-size: .85rem;
  transition: color .2s;
  padding: 8px;
  border-radius: 8px;
}
.sidebar-footer a:hover { color: #fff; background: rgba(255,255,255,.06); }

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

.top-bar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 var(--gray-200);
}
.top-bar-title { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--navy); }
.top-bar-right { display: flex; align-items: center; gap: 16px; }

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

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 24px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(14,165,233,.3); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(14,165,233,.45); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); color: #fff; }
.btn-outline { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: 8px; }

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

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control, .form-select {
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text-main);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-b);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-green  { background: var(--green-soft);  color: #166534; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: var(--yellow-soft); color: #78350f; }
.badge-red    { background: var(--red-soft);    color: #991b1b; }
.badge-gray   { background: var(--gray-100);    color: var(--gray-600); }

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; justify-content: space-between;
  border-left: 4px solid transparent;
}
.stat-card.green  { border-color: var(--accent-g); }
.stat-card.blue   { border-color: var(--accent-b); }
.stat-card.yellow { border-color: var(--yellow); }
.stat-card.navy   { border-color: var(--navy); }
.stat-value { font-family: 'Outfit',sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height:1; }
.stat-label { font-size: .8rem; color: var(--text-sub); margin-top: 4px; font-weight: 500; }
.stat-icon  { width: 44px; height: 44px; border-radius: 10px; display:flex;align-items:center;justify-content:center;font-size:1.3rem; }
.stat-icon.green  { background: #dcfce7; }
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.navy   { background: #e0f2fe; }

/* ── Alerts ── */
.alert { padding: 13px 16px; border-radius: 8px; font-size: .875rem; margin-bottom: 16px; display:flex; gap:8px; align-items:flex-start; }
.alert-success { background: var(--green-soft);  color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-soft);    color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe;            color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: var(--yellow-soft); color: #78350f; border: 1px solid #fcd34d; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 18px;
  background: none; border: none;
  font-family: inherit; font-size: .875rem; font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--accent-b); }
.tab-btn:hover { color: var(--navy); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Invoice Item Types ── */
.item-type-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.item-equipment   { background: #dbeafe; color: #1e40af; }
.item-doctor      { background: #fce7f3; color: #9d174d; }
.item-technician  { background: #fef3c7; color: #78350f; }
.item-miscellaneous { background: #f3f4f6; color: #374151; }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(13,27,42,.6);
  z-index: 1000; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  max-width: 700px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.96) translateY(-10px); } to { opacity:1; transform:none; } }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: 'Outfit',sans-serif; font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.4rem; color: var(--gray-400); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: var(--gray-100); color: var(--text-main); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
}
.upload-zone:hover { border-color: var(--accent-b); background: #f0f9ff; }
.upload-zone img { max-height: 80px; max-width: 240px; object-fit: contain; margin: 0 auto 12px; display: block; }
.upload-zone p { color: var(--gray-500); font-size: .875rem; }

/* ── Invoice Create Page ── */
.invoice-section {
  margin-bottom: 28px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.invoice-section-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: .9rem;
  font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.invoice-section-body { padding: 20px; }

/* Items Table */
.items-table-wrap { overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 900px; }
.items-table th {
  background: var(--navy);
  color: rgba(255,255,255,.8);
  padding: 10px 12px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  white-space: nowrap;
}
.items-table td { padding: 8px 6px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.items-table tbody tr:last-child td { border-bottom: none; }
.items-table input, .items-table select {
  padding: 7px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  background: #fff;
  width: 100%;
}
.items-table input:focus, .items-table select:focus {
  outline: none; border-color: var(--accent-b);
}
.items-table .col-type { width: 130px; }
.items-table .col-desc { min-width: 200px; }
.items-table .col-hsn  { width: 100px; }
.items-table .col-qty  { width: 80px; }
.items-table .col-uom  { width: 80px; }
.items-table .col-rate { width: 110px; }
.items-table .col-amt  { width: 110px; }
.items-table .col-act  { width: 48px; text-align: center; }
.items-table tfoot td {
  padding: 10px 12px;
  font-weight: 600;
  border-top: 2px solid var(--gray-200);
}

/* Totals Box */
.totals-box { max-width: 380px; margin-left: auto; }
.totals-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: .9rem; border-bottom: 1px solid var(--gray-100); }
.totals-row:last-child { border-bottom: none; }
.totals-row.total-final { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 800; color: var(--navy); border-top: 2px solid var(--navy); padding-top: 12px; margin-top: 4px; }

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

/* ── Print/Invoice Preview ── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; font-size: 12px; }
}

/* ── Misc Utilities ── */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: .875rem; } .text-xs { font-size: .75rem; }
.text-sub { color: var(--text-sub); } .text-navy { color: var(--navy); }
.font-bold { font-weight: 700; } .font-heading { font-family: 'Outfit', sans-serif; }
.text-right { text-align: right; } .text-center { text-align: center; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 1rem; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--gray-200); border-top-color: var(--accent-b); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login Page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  background: var(--navy);
  position: relative;
  overflow: hidden;
}
.login-deco {
  flex: 1; background: linear-gradient(145deg, var(--navy-mid) 0%, var(--navy-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
}
.login-deco-inner { max-width: 360px; text-align: center; }
.login-deco img { width: 200px; margin-bottom: 32px; }
.login-deco h2 { font-family:'Outfit',sans-serif; font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 12px; }
.login-deco p { color: rgba(255,255,255,.5); line-height: 1.7; font-size: .9rem; }
.login-form-area {
  width: 420px; flex-shrink: 0;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 44px;
}
.login-form-inner { width: 100%; }
.login-logo { margin-bottom: 32px; }
.login-logo h1 { font-family:'Outfit',sans-serif; font-size: 1.4rem; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.login-logo p { color: var(--text-sub); font-size: .875rem; }
.form-group.login-field label { font-size: .8rem; color: var(--gray-500); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.btn-login {
  width: 100%; padding: 13px;
  background: var(--grad);
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 700; font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(14,165,233,.35);
  transition: all .2s;
  margin-top: 8px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(14,165,233,.45); }

@media (max-width: 640px) {
  .login-deco { display: none; }
  .login-form-area { width: 100%; padding: 32px 24px; }
}
