/*
  RQ HMS — Apollo-inspired Hospital UI Theme
  Clean white sidebar, navy primary, professional healthcare look.
  Injected into Frappe Desk (app_include_css) and Website (web_include_css).
*/

/* ─── Brand Palette — Apollo-inspired ───────────────────────────────────────── */
:root {
  /* Navy primary (Apollo deep brand color) */
  --hms-navy:        #1a1f5e;
  --hms-navy-dark:   #13174a;
  --hms-navy-light:  #2d3494;
  --hms-navy-xlight: #e8eaf6;

  /* Blue CTA (Apollo action blue) */
  --hms-blue:        #0066cc;
  --hms-blue-dark:   #0052a3;
  --hms-blue-light:  #3385d6;
  --hms-blue-xlight: #e0f0ff;

  /* Teal accent */
  --hms-teal:        #00897b;
  --hms-teal-dark:   #00695c;
  --hms-teal-light:  #e0f2f1;

  /* Neutrals */
  --hms-slate-900: #1a1a2e;
  --hms-slate-800: #2d2d44;
  --hms-slate-700: #4a4a6a;
  --hms-slate-600: #6b6b8a;
  --hms-slate-500: #8e8ea8;
  --hms-slate-400: #b0b0c8;
  --hms-slate-300: #d0d0e0;
  --hms-slate-200: #e8e8f0;
  --hms-slate-100: #f4f4f8;
  --hms-slate-50:  #f9f9fc;

  /* Status */
  --hms-success: #2e7d32;
  --hms-warning: #f57c00;
  --hms-danger:  #c62828;
  --hms-info:    #0277bd;
}

/* ─── Frappe v15 CSS Variable Overrides ─────────────────────────────────────── */
:root,
[data-theme="light"] {
  --primary-color:              #0066cc;
  --btn-primary-bg:             #0066cc;
  --btn-primary-hover-bg:       #0052a3;
  --btn-primary-border:         #0066cc;

  --text-color:                 #2d2d44;
  --text-muted:                 #6b6b8a;
  --text-light:                 #8e8ea8;
  --heading-color:              #1a1f5e;

  --bg-color:                   #f4f6fb;
  --bg-light-gray:              #eef0f7;
  --control-bg:                 #ffffff;
  --control-bg-on-gray:         #ffffff;
  --disabled-control-bg:        #f4f4f8;
  --card-bg:                    #ffffff;
  --modal-bg:                   #ffffff;

  --border-color:               #e0e0ee;
  --dark-border-color:          #c8c8dc;
  --table-border-color:         #e8e8f4;
  --input-border-color:         #c8c8dc;

  /* Sidebar — white, not dark */
  --sidebar-bg-color:           #ffffff;
  --sidebar-select-color:       #0066cc;
  --sidebar-text-color:         #4a4a6a;
  --sidebar-hover-bg:           #f0f4ff;

  /* Navbar — navy */
  --navbar-bg:                  #1a1f5e;
  --navbar-text:                #ffffff;
  --navbar-hover-bg:            #2d3494;

  --link-color:                 #0066cc;
  --link-hover-color:           #0052a3;

  --indicator-pill-blue:        #e0f0ff;
  --indicator-pill-green:       #e8f5e9;
  --indicator-pill-red:         #ffebee;
  --indicator-pill-orange:      #fff3e0;
  --indicator-pill-gray:        #f4f4f8;

  --shadow-sm:   0 1px 4px rgba(26,31,94,0.08), 0 1px 2px rgba(26,31,94,0.04);
  --shadow-md:   0 4px 12px rgba(26,31,94,0.10), 0 2px 4px rgba(26,31,94,0.06);
  --shadow-lg:   0 10px 30px rgba(26,31,94,0.12), 0 4px 8px rgba(26,31,94,0.06);

  --border-radius:      5px;
  --border-radius-md:   8px;
  --border-radius-lg:   10px;
  --border-radius-full: 9999px;

  --scrollbar-thumb: #c8c8dc;
  --scrollbar-track: #f4f4f8;
}

/* ─── Navbar — Navy ──────────────────────────────────────────────────────────── */
.navbar {
  background-color: #1a1f5e !important;
  border-bottom: 2px solid #0066cc !important;
  box-shadow: 0 2px 8px rgba(26,31,94,0.3) !important;
  min-height: 54px !important;
}
.navbar .navbar-brand,
.navbar .navbar-brand:hover { opacity: 1; }
.navbar .navbar-brand img,
.navbar .app-logo { max-height: 32px !important; }
.navbar .navbar-nav > li > a,
.navbar .nav-link {
  color: rgba(255,255,255,0.85) !important;
}
.navbar .navbar-nav > li > a:hover,
.navbar .nav-link:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.1) !important;
  border-radius: 4px !important;
}
.navbar .dropdown-menu {
  background: #ffffff !important;
  border: 1px solid #e0e0ee !important;
  border-radius: var(--border-radius-md) !important;
  box-shadow: 0 8px 24px rgba(26,31,94,0.15) !important;
}
.navbar .dropdown-menu a,
.navbar .dropdown-menu .dropdown-item {
  color: #2d2d44 !important;
}
.navbar .dropdown-menu a:hover,
.navbar .dropdown-menu .dropdown-item:hover {
  background: #f0f4ff !important;
  color: #1a1f5e !important;
}
#navbar-breadcrumbs a,
.breadcrumb-area a { color: rgba(255,255,255,0.65) !important; }
#navbar-breadcrumbs a:hover,
.breadcrumb-area a:hover { color: #ffffff !important; }

/* ─── Sidebar — White, Apollo-style ─────────────────────────────────────────── */

/* Sidebar shell — white with subtle right border */
.layout-side-section {
  background: #ffffff !important;
  border-right: 1px solid #e0e0ee !important;
  box-shadow: 2px 0 8px rgba(26,31,94,0.06) !important;
}
.desk-sidebar,
.list-sidebar {
  background: #ffffff !important;
}

/* Section header — "PUBLIC" / "PERSONAL" */
button.standard-sidebar-label {
  background: transparent !important;
  border: none !important;
  color: #8e8ea8 !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.12em !important;
  padding: 18px 14px 6px !important;
  width: 100% !important;
  text-align: left !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
button.standard-sidebar-label .section-title {
  color: #8e8ea8 !important;
}
button.standard-sidebar-label svg.icon,
button.standard-sidebar-label svg {
  stroke: #b0b0c8 !important;
  fill: none !important;
  width: 12px !important;
  height: 12px !important;
}

/* Sidebar item row */
.desk-sidebar-item.standard-sidebar-item {
  border-radius: 0 !important;
  margin: 0 !important;
  border-left: 3px solid transparent !important;
  transition: background 0.12s, border-color 0.12s !important;
}

/* Anchor inside each item */
.desk-sidebar-item.standard-sidebar-item a.item-anchor {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  color: #4a4a6a !important;
  text-decoration: none !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  transition: color 0.12s !important;
}

/* Label text */
.desk-sidebar-item.standard-sidebar-item .sidebar-item-label {
  color: #4a4a6a !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

/* Icons — dark stroke on white background, visible */
.desk-sidebar-item.standard-sidebar-item .sidebar-item-icon {
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  width: 18px !important;
  height: 18px !important;
}
.desk-sidebar-item.standard-sidebar-item .sidebar-item-icon svg,
.desk-sidebar-item.standard-sidebar-item .sidebar-item-icon svg.icon {
  stroke: #6b6b8a !important;
  fill: none !important;
  width: 16px !important;
  height: 16px !important;
}
.desk-sidebar-item.standard-sidebar-item .sidebar-item-icon svg *,
.desk-sidebar-item.standard-sidebar-item .sidebar-item-icon svg.icon * {
  stroke: #6b6b8a !important;
  fill: none !important;
}

/* Hover state */
.desk-sidebar-item.standard-sidebar-item:hover {
  background: #f0f4ff !important;
  border-left-color: #b0c4ff !important;
}
.desk-sidebar-item.standard-sidebar-item:hover a.item-anchor {
  color: #1a1f5e !important;
}
.desk-sidebar-item.standard-sidebar-item:hover .sidebar-item-label {
  color: #1a1f5e !important;
}
.desk-sidebar-item.standard-sidebar-item:hover .sidebar-item-icon svg,
.desk-sidebar-item.standard-sidebar-item:hover .sidebar-item-icon svg.icon,
.desk-sidebar-item.standard-sidebar-item:hover .sidebar-item-icon svg *,
.desk-sidebar-item.standard-sidebar-item:hover .sidebar-item-icon svg.icon * {
  stroke: #1a1f5e !important;
  fill: none !important;
}

/* Selected / active — blue left border, light blue bg */
.desk-sidebar-item.standard-sidebar-item.selected,
.desk-sidebar-item.standard-sidebar-item.active {
  background: #e8f0ff !important;
  border-left-color: #0066cc !important;
}
.desk-sidebar-item.standard-sidebar-item.selected a.item-anchor,
.desk-sidebar-item.standard-sidebar-item.active a.item-anchor {
  color: #0066cc !important;
}
.desk-sidebar-item.standard-sidebar-item.selected .sidebar-item-label,
.desk-sidebar-item.standard-sidebar-item.active .sidebar-item-label {
  color: #0066cc !important;
  font-weight: 600 !important;
}
.desk-sidebar-item.standard-sidebar-item.selected .sidebar-item-icon svg,
.desk-sidebar-item.standard-sidebar-item.selected .sidebar-item-icon svg.icon,
.desk-sidebar-item.standard-sidebar-item.selected .sidebar-item-icon svg *,
.desk-sidebar-item.standard-sidebar-item.active .sidebar-item-icon svg,
.desk-sidebar-item.standard-sidebar-item.active .sidebar-item-icon svg.icon,
.desk-sidebar-item.standard-sidebar-item.active .sidebar-item-icon svg * {
  stroke: #0066cc !important;
  fill: none !important;
}

/* ─── Page & Workspace Background ───────────────────────────────────────────── */
.page-container, .page-wrapper, .workspace-container, .modules-section,
.layout-main-section-wrapper, .layout-main { background: #f4f6fb !important; }

/* ─── Workspace / Module Cards ───────────────────────────────────────────────── */
.workspace-container,
.modules-section { background: #f4f6fb !important; }

.desk-card,
.module-card,
.widget.shortcut-widget-box,
.widget.links-widget-box,
.widget.chart-widget-box,
.widget.number-widget-box {
  background: #ffffff !important;
  border: 1px solid #e0e0ee !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(26,31,94,0.07) !important;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.desk-card:hover,
.module-card:hover,
.widget.shortcut-widget-box:hover,
.widget.links-widget-box:hover,
.widget.number-widget-box:hover {
  box-shadow: 0 6px 20px rgba(26,31,94,0.13) !important;
  border-color: #b0c4ff !important;
  transform: translateY(-1px);
}
.widget-head .widget-title,
.module-card .module-title {
  color: #1a1f5e !important;
  font-weight: 600 !important;
}
.shortcut-widget-box .shortcut-widget-icon {
  background: #e0f0ff !important;
  color: #0066cc !important;
  border-radius: 8px !important;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
/* Use hardcoded hex values (not CSS vars) so Frappe's own variable cascade
   cannot override these. Specificity boosted with body prefix. */
body .btn-primary, body button.btn-primary, body .btn.btn-primary,
body .primary-action, body .page-actions .btn-primary,
body .page-head .btn-primary, body .list-header-toolbar .btn-primary,
body .form-page-head .btn-primary, body .page-form .btn-primary {
  background-color: #0066cc !important;
  border-color: #0066cc !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border-radius: 5px !important;
  transition: background 0.15s, box-shadow 0.15s;
}
body .btn-primary:hover, body button.btn-primary:hover,
body .btn.btn-primary:hover, body .primary-action:hover,
body .page-actions .btn-primary:hover {
  background-color: #0052a3 !important;
  border-color: #0052a3 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0,102,204,0.35) !important;
}
body .btn-secondary, body button.btn-secondary,
body .btn-default, body button.btn-default {
  background: #ffffff !important;
  border: 1px solid #c8c8dc !important;
  color: #4a4a6a !important;
  border-radius: 5px !important;
  font-weight: 500 !important;
}
body .btn-secondary:hover, body button.btn-secondary:hover,
body .btn-default:hover, body button.btn-default:hover {
  background: #f0f4ff !important;
  border-color: #0066cc !important;
  color: #1a1f5e !important;
}
body .btn-danger, body button.btn-danger {
  background-color: #c62828 !important; border-color: #c62828 !important; color: #ffffff !important;
}
body .btn-success, body button.btn-success {
  background-color: #2e7d32 !important; border-color: #2e7d32 !important; color: #ffffff !important;
}
body .btn-warning, body button.btn-warning {
  background-color: #f57c00 !important; border-color: #f57c00 !important; color: #ffffff !important;
}

/* ─── Form Layout ────────────────────────────────────────────────────────────── */
.page-head, .page-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e0e0ee !important;
  box-shadow: 0 1px 4px rgba(26,31,94,0.06) !important;
}
.page-title, .title-text, h1.title-text {
  color: #1a1f5e !important;
  font-weight: 700 !important;
}
.form-layout, .form-page {
  background: #ffffff !important;
  border: 1px solid #e0e0ee !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(26,31,94,0.07) !important;
}
.section-head, .form-section .section-head {
  color: #1a1f5e !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  border-bottom: 2px solid #e0f0ff !important;
  padding-bottom: 8px !important;
}

/* ─── Form Controls ──────────────────────────────────────────────────────────── */
.form-control, .input-with-feedback,
.frappe-control input, .frappe-control textarea, .frappe-control select {
  border: 1px solid #c8c8dc !important;
  border-radius: 5px !important;
  background: #ffffff !important;
  color: #2d2d44 !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .input-with-feedback:focus,
.frappe-control input:focus, .frappe-control textarea:focus {
  border-color: #0066cc !important;
  box-shadow: 0 0 0 3px rgba(0,102,204,0.12) !important;
  outline: none !important;
}
.control-label, .frappe-control label {
  color: #4a4a6a !important;
  font-weight: 600 !important;
  font-size: 12px !important;
}
.help-box, .form-control-description {
  color: #8e8ea8 !important;
  font-size: 11px !important;
}

/* ─── List View ──────────────────────────────────────────────────────────────── */
.list-row, .result-list .list-row {
  border-bottom: 1px solid #eef0f7 !important;
  transition: background 0.1s;
}
.list-row:hover { background: #f4f6fb !important; }
.list-row.checked, .list-row.selected { background: #e0f0ff !important; }
.list-filters-area, .filter-area {
  background: #ffffff !important;
  border-bottom: 1px solid #e0e0ee !important;
}
.list-header-subject, .list-row-head {
  background: #f4f6fb !important;
  color: #6b6b8a !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
}

/* ─── Data Table ─────────────────────────────────────────────────────────────── */
.datatable .dt-header .dt-cell, .datatable .dt-cell--header {
  background: #f4f6fb !important;
  color: #4a4a6a !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  border-bottom: 2px solid #e0e0ee !important;
}
.datatable .dt-row:hover .dt-cell { background: #f4f6fb !important; }
.datatable .dt-row--highlight .dt-cell { background: #e0f0ff !important; }

/* ─── Indicators / Badges / Pills ───────────────────────────────────────────── */
.indicator-pill, .badge {
  border-radius: 9999px !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  padding: 2px 10px !important;
}
.indicator-pill.blue,  .badge-primary   { background: #e0f0ff !important; color: #0052a3 !important; }
.indicator-pill.green, .badge-success   { background: #e8f5e9 !important; color: #1b5e20 !important; }
.indicator-pill.red,   .badge-danger    { background: #ffebee !important; color: #b71c1c !important; }
.indicator-pill.orange,.badge-warning   { background: #fff3e0 !important; color: #e65100 !important; }
.indicator-pill.gray,  .badge-secondary { background: #f4f4f8 !important; color: #6b6b8a !important; }

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert-primary { background: #e0f0ff !important; border-color: #90c4f0 !important; color: #0052a3 !important; }
.alert-success { background: #e8f5e9 !important; border-color: #a5d6a7 !important; color: #1b5e20 !important; }
.alert-danger  { background: #ffebee !important; border-color: #ef9a9a !important; color: #b71c1c !important; }
.alert-warning { background: #fff3e0 !important; border-color: #ffcc80 !important; color: #e65100 !important; }

/* ─── Modals ─────────────────────────────────────────────────────────────────── */
.modal-content {
  border: none !important;
  border-radius: 10px !important;
  box-shadow: 0 20px 60px rgba(26,31,94,0.2) !important;
}
.modal-header {
  background: #1a1f5e !important;
  border-bottom: none !important;
  border-radius: 10px 10px 0 0 !important;
  padding: 16px 20px !important;
}
.modal-title { color: #ffffff !important; font-weight: 700 !important; }
.modal-header .close, .modal-header .btn-modal-close { color: rgba(255,255,255,0.8) !important; }
.modal-footer {
  border-top: 1px solid #e0e0ee !important;
  background: #f4f6fb !important;
  border-radius: 0 0 10px 10px !important;
}
.modal-backdrop { background: rgba(26,31,94,0.5) !important; }

/* ─── Tabs ───────────────────────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 2px solid #e0e0ee !important; }
.nav-tabs .nav-link {
  color: #6b6b8a !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -2px !important;
  font-weight: 500 !important;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tabs .nav-link:hover { color: #1a1f5e !important; }
.nav-tabs .nav-link.active {
  color: #0066cc !important;
  border-bottom-color: #0066cc !important;
  background: transparent !important;
  font-weight: 700 !important;
}

/* ─── Progress Bars ──────────────────────────────────────────────────────────── */
.progress { background: #e0e0ee !important; border-radius: 9999px !important; }
.progress-bar { background-color: #0066cc !important; }

/* ─── Links ──────────────────────────────────────────────────────────────────── */
a { color: #0066cc !important; }
a:hover { color: #0052a3 !important; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f4f4f8; }
::-webkit-scrollbar-thumb { background: #c8c8dc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #8e8ea8; }

/* ─── Typography ─────────────────────────────────────────────────────────────── */
body, .frappe-app {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  color: #2d2d44 !important;
  background: #f4f6fb !important;
}
h1, h2, h3, h4, h5, h6 { color: #1a1f5e !important; font-weight: 700 !important; }

/* ─── Hide Frappe/ERPNext Attributions ───────────────────────────────────────── */
.footer-powered,
.page-footer .powered-by,
.login-footer,
footer .powered-by,
a[href*="frappe.io"],
a[href*="erpnext.com"],
a[href*="frappecloud.com"],
.frappe-chat-badge { display: none !important; }

/* ─── Misc Polish ────────────────────────────────────────────────────────────── */
.frappe-card, .card {
  border: 1px solid #e0e0ee !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(26,31,94,0.07) !important;
}
.divider, hr { border-color: #e0e0ee !important; }
.text-muted    { color: #6b6b8a !important; }
.text-primary  { color: #0066cc !important; }
.text-success  { color: #2e7d32 !important; }
.text-danger   { color: #c62828 !important; }
.text-warning  { color: #f57c00 !important; }
