/* ===============================================
   WCSH KAIZEN ASSESSMENT SYSTEM — MAIN STYLES
   ወራቤ ኮምፕሬሄንሲቭ ስፔሻላይዝድ ሆስፒታል
   =============================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Ethiopic:wght@300;400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --primary:       #1B4F72;   /* deep hospital navy */
  --primary-dark:  #0E2F45;
  --accent:        #E67E22;   /* warm amber — warmth & energy */
  --accent-light:  #F39C12;
  --success:       #1E8449;
  --warning:       #B7950B;
  --danger:        #922B21;
  --bg:            #F4F6F8;
  --surface:       #FFFFFF;
  --surface-alt:   #EBF5FB;
  --border:        #D5DBDB;
  --text:          #1C2833;
  --text-muted:    #5D6D7E;
  --text-light:    #ABB2B9;

  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     20px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.14);

  --font-body:    'Noto Sans Ethiopic', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  --transition:   0.22s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* ── TOPBAR ───────────────────────────────────── */
.topbar {
  background: var(--primary-dark);
  color: #fff;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-logo {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
  flex-shrink: 0;
}
.topbar-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.topbar-title span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  opacity: .65;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-weight: 500;
}
.topbar-nav a:hover,
.topbar-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255,255,255,.7);
}
.topbar-user-avatar {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

/* ── PAGE CONTAINER ───────────────────────────── */
.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}
.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-dark);
}
.page-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}
.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── CARDS ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--bg);
}
.card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 .icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.icon-blue  { background: #D6EAF8; }
.icon-green { background: #D5F5E3; }
.icon-orange{ background: #FDEBD0; }
.icon-red   { background: #FADBD8; }

/* ── FORMS ─────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,79,114,.12);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── RATING ITEMS ────────────────────────────────── */
.rating-group {
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  transition: var(--transition);
}
.rating-group:hover { border-color: var(--primary); background: var(--surface-alt); }
.rating-group label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
  display: block;
}
.rating-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rating-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  font-weight: 500;
}
.rating-btn:hover { border-color: var(--primary); color: var(--primary); }
.rating-btn.selected-1 { background:#FADBD8; border-color:#E74C3C; color:#922B21; }
.rating-btn.selected-2 { background:#FDEBD0; border-color:#E67E22; color:#784212; }
.rating-btn.selected-3 { background:#FEF9E7; border-color:#F1C40F; color:#7D6608; }
.rating-btn.selected-4 { background:#D5F5E3; border-color:#27AE60; color:#1E8449; }
.rating-btn.selected-5 { background:#D6EAF8; border-color:#2980B9; color:#1A5276; }

/* ── SECTION TABS ─────────────────────────────── */
.section-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.section-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: var(--transition);
  background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: var(--font-body);
}
.section-tab:hover { color: var(--primary); }
.section-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── PROGRESS ─────────────────────────────────── */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .5s ease;
}
.progress-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ── SCORE BADGE ──────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 800;
}
.score-badge.poor    { background:#FADBD8; color:#922B21; }
.score-badge.fair    { background:#FDEBD0; color:#784212; }
.score-badge.good    { background:#FEF9E7; color:#7D6608; }
.score-badge.great   { background:#D5F5E3; color:#1E8449; }
.score-badge.excel   { background:#D6EAF8; color:#1A5276; }

/* ── BUTTONS ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: var(--accent-light); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--surface-alt); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── STAT CARDS ──────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}
.stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

/* ── TABLE ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  background: var(--primary-dark);
  color: #fff;
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:hover td { background: var(--surface-alt); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background:#D5F5E3; color:#1E8449; }
.badge-orange { background:#FDEBD0; color:#784212; }
.badge-red    { background:#FADBD8; color:#922B21; }
.badge-blue   { background:#D6EAF8; color:#1A5276; }

/* ── ALERTS ──────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background:#D5F5E3; border-color:var(--success); color:#1E8449; }
.alert-warning { background:#FDEBD0; border-color:var(--accent);  color:#784212; }
.alert-danger  { background:#FADBD8; border-color:var(--danger);  color:#922B21; }
.alert-info    { background:#D6EAF8; border-color:var(--primary); color:#1A5276; }

/* ── SECTION HEADER STRIP ─────────────────────── */
.section-strip {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin: -24px -24px 20px -24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-strip h3 {
  font-size: 15px;
  font-weight: 700;
}
.section-strip .strip-meta {
  font-size: 12px;
  opacity: .75;
  margin-left: auto;
}

/* ── LOGIN ───────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #1a6fa0 100%);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .logo-mark {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}
.login-logo h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-dark);
}
.login-logo p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── CHECKLIST PRINT ─────────────────────────── */
.checklist-section {
  margin-bottom: 28px;
}
.checklist-section-title {
  background: var(--primary-dark);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary);
}
.checklist-item-text { flex: 1; }
.checklist-item-text .item-title { font-weight: 500; }
.checklist-item-text .item-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.checklist-score-cols {
  display: grid;
  grid-template-columns: 1fr 60px 60px 60px 60px 60px;
  gap: 0;
  background: #EBF5FB;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary);
}

/* ── SPINNER ─────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ───────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--primary-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease;
  min-width: 240px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(80px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
  /* ── Topbar ── */
  .topbar { padding: 0 14px; }
  .topbar-nav { display: none; }
  .topbar-title span { display: none; }   /* hide subtitle on small screens */
  .topbar-user span { display: none; }    /* hide username text, keep avatar */

  /* ── Layout ── */
  .page-container { padding: 16px 14px 60px; }
  .card { padding: 16px; }
  .section-strip { margin: -16px -16px 16px -16px; padding: 12px 16px; }
  .section-strip h3 { font-size: 13px; }

  /* ── Grids collapse to single column ── */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .form-row  { grid-template-columns: 1fr !important; }

  /* ── Page headers ── */
  .page-header h1 { font-size: 19px; }

  /* ── Tables ── */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* ── Buttons ── */
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; justify-content: center; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }

  /* ── Rating buttons wrap nicely ── */
  .rating-options { gap: 6px; }
  .rating-btn { padding: 5px 10px; font-size: 12px; }

  /* ── Section tabs scroll horizontally ── */
  .section-tabs { gap: 0; padding-bottom: 2px; }
  .section-tab { padding: 9px 14px; font-size: 12px; }

  /* ── Score summary grid ── */
  .score-ring-wrap { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* ── Float submit button ── */
  .float-submit { bottom: 16px; right: 14px; }

  /* ── Toast ── */
  #toast-container { right: 14px; left: 14px; }
  .toast { min-width: unset; width: 100%; }
}

@media (max-width: 480px) {
  /* ── Extra small phones ── */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 14px 10px; }
  .stat-card .stat-value { font-size: 24px; }

  .topbar-logo { width: 30px; height: 30px; font-size: 14px; }
  .topbar-title { font-size: 12px; }

  .section-tab { padding: 8px 11px; font-size: 11px; }

  .rating-btn { padding: 5px 8px; font-size: 11px; }

  /* checklist score circles still usable */
  .score-circle { width: 24px; height: 24px; font-size: 9px; }
}

@media print {
  .topbar, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ── MOBILE BOTTOM NAV ───────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--primary-dark);
  border-top: 2px solid rgba(255,255,255,.1);
  z-index: 150;
  padding: 0;
}
.mbn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 10px 4px 12px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  transition: var(--transition);
  font-size: 10px;
  gap: 3px;
}
.mbn-item:hover, .mbn-item.active {
  color: var(--accent-light);
}
.mbn-icon { font-size: 20px; line-height: 1; }
.mbn-label { font-size: 10px; font-weight: 600; letter-spacing: .2px; }

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }
  /* push page content above bottom nav */
  body { padding-bottom: 64px; }
}