/* ═══════════════════════════════════════════════════
   eClinicOne – Premium Design System
   Colors: Navy #0f4c81 | Cyan #00b4d8 | White #fff
═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #0f4c81;
  --primary-dark: #0a3259;
  --primary-light: #1a6bb5;
  --accent: #00b4d8;
  --accent-light: #48cae4;
  --success: #06d6a0;
  --warning: #ffd166;
  --danger: #ef233c;
  --text: #1a2332;
  --muted: #6b7a8d;
  --border: #dde3ec;
  --bg: #f0f4f8;
  --card: #ffffff;
  --sidebar-w: 245px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { text-decoration: none; }
img { max-width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f4f8; }
::-webkit-scrollbar-thumb { background: #c0cfe0; border-radius: 10px; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; position: fixed; top: 0; left: 0;
  background: linear-gradient(175deg, var(--primary-dark) 0%, var(--primary) 60%, #1565a8 100%);
  display: flex; flex-direction: column; z-index: 1000;
  transition: transform .3s ease;
  box-shadow: 4px 0 20px rgba(0,0,0,.15);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 11px; padding: 22px 18px 18px;
  color: #fff; border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .brand-mark {
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(255,255,255,.15); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo .brand-e { font-size: 22px; font-weight: 900; color: var(--accent); line-height: 1; }
.sidebar-logo .brand-text { font-size: 15px; font-weight: 800; color: #fff; line-height: 1.2; }
.sidebar-logo .brand-sub { font-size: 10px; color: rgba(255,255,255,.55); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-section { font-size: 9.5px; font-weight: 700; letter-spacing: 1.5px; color: rgba(255,255,255,.4);
  text-transform: uppercase; padding: 14px 10px 6px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.7); font-size: 13px; font-weight: 500; margin-bottom: 2px;
  transition: all .18s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 700; }
.sidebar-nav a i { font-size: 16px; flex-shrink: 0; }
.nav-badge { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px; margin-left: auto; min-width: 18px; text-align: center; }

.sidebar-footer { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.1); }
.user-card { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 10px; background: rgba(0,180,216,.3);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  color: var(--accent); flex-shrink: 0; }
.user-name { font-size: 12.5px; font-weight: 700; color: #fff; }
.user-role { font-size: 10px; color: rgba(255,255,255,.5); }

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

/* ── Topbar ── */
.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 900; box-shadow: 0 1px 8px rgba(0,0,0,.05);
}
.topbar-title { font-size: 16px; font-weight: 800; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ── Page Body ── */
.page-body { padding: 28px 28px 40px; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card-header {
  padding: 16px 20px; font-size: 14px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border); background: transparent; border-radius: 14px 14px 0 0;
}
.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; display: flex; align-items: center; gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 13px; display: flex; align-items: center;
  justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-num { font-size: 28px; font-weight: 900; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ── Forms ── */
.form-control, .form-select {
  border: 1.5px solid var(--border); border-radius: 9px; padding: 10px 13px;
  font-size: 13.5px; font-family: inherit; transition: border-color .2s, box-shadow .2s;
  width: 100%; background: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px rgba(15,76,129,.1);
}
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; display: block; }
.form-text { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .form-control { padding-left: 36px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: none; transition: all .18s; font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #009bbf; color: #fff; }
.btn-success { background: #06d6a0; color: #fff; }
.btn-success:hover { background: #05ba8c; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #cc1a32; color: #fff; }
.btn-warning { background: var(--warning); color: var(--text); }
.btn-secondary { background: #e8eef6; color: var(--text); }
.btn-secondary:hover { background: #dde3ec; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(15,76,129,.04); }
.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-danger { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 13px 26px; font-size: 15px; font-weight: 700; border-radius: 11px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 8px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: 0 0 14px 14px; }
table { width: 100%; border-collapse: collapse; }
thead th { background: #f7f9fc; font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
tbody td { padding: 13px 16px; border-bottom: 1px solid #f0f4f8; vertical-align: middle; font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
.td-name { font-weight: 600; color: var(--text); }
.td-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge-active { background: #d4f8ed; color: #0a7c56; }
.badge-expired { background: #fde8ea; color: #c0152a; }
.badge-pending { background: #fff3e0; color: #b85c00; }
.badge-trial { background: #e7f3ff; color: var(--primary); }
.badge-info { background: #e0f5fb; color: #0086a8; }
.badge-gray { background: #f0f4f8; color: var(--muted); }

/* ── Alerts ── */
.alert { padding: 14px 18px; border-radius: 11px; font-size: 13.5px; margin-bottom: 18px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: #d4f8ed; color: #0a5c3c; border: 1px solid #a7edda; }
.alert-danger { background: #fde8ea; color: #8b0e1e; border: 1px solid #f5b8c0; }
.alert-warning { background: #fff3e0; color: #7a4200; border: 1px solid #ffd9a0; }
.alert-info { background: #e0f5fb; color: #005670; border: 1px solid #9de0ef; }

/* ── Login Page ── */
.login-bg {
  min-height: 100vh; background: linear-gradient(135deg, var(--primary-dark), var(--primary) 50%, #1565a8);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card { background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.25); width: 100%; max-width: 480px; overflow: hidden; }
.login-header { background: linear-gradient(135deg, var(--primary), var(--accent)); padding: 36px 32px; text-align: center; color: #fff; }
.login-icon { width: 72px; height: 72px; background: rgba(255,255,255,.18); border-radius: 20px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.login-body { padding: 32px; }
.role-tabs { display: flex; gap: 6px; padding: 5px; background: var(--bg); border-radius: 11px; margin-bottom: 24px; }
.role-tab { flex: 1; padding: 8px 4px; text-align: center; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all .18s; border: none; background: transparent; font-family: inherit; }
.role-tab.active { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(15,76,129,.3); }

/* ── Mobile Overlay ── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }
.menu-toggle { display: none; background: none; border: 1.5px solid var(--border); border-radius: 8px;
  width: 36px; height: 36px; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }

/* ── Misc ── */
.page-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.page-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.section-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 48px; opacity: .25; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Pill / Tag ── */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill-blue { background: #e7f3ff; color: var(--primary); }
.pill-green { background: #d4f8ed; color: #0a5c3c; }
.pill-red { background: #fde8ea; color: #8b0e1e; }
.pill-gray { background: #f0f4f8; color: var(--muted); }

/* ── Search input ── */
.search-bar { position: relative; }
.search-bar i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.search-bar input { padding-left: 40px; background: var(--bg); border-color: transparent; }
.search-bar input:focus { background: #fff; border-color: var(--primary); }

/* ── Quick action tiles ── */
.action-tile { background: #fff; border: 1.5px solid var(--border); border-radius: 13px; padding: 18px;
  display: flex; align-items: center; gap: 13px; transition: all .2s; cursor: pointer; color: var(--text); }
.action-tile:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(15,76,129,.1); color: var(--primary); transform: translateY(-1px); }
.action-tile .tile-icon { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0; }
.action-tile .tile-title { font-weight: 700; font-size: 13.5px; }
.action-tile .tile-sub { font-size: 11.5px; color: var(--muted); }

/* ── Autocomplete dropdown ── */
.autocomplete-box { position: absolute; z-index: 999; width: 100%; background: #fff; border: 1.5px solid var(--border);
  border-radius: 11px; box-shadow: 0 12px 36px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; top: calc(100% + 4px); }
.autocomplete-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f0f4f8; transition: background .15s; display: flex; align-items: center; gap: 10px; }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f7f9fc; }
.autocomplete-item .ac-name { font-weight: 700; font-size: 13.5px; color: var(--text); }
.autocomplete-item .ac-sub { font-size: 11.5px; color: var(--muted); }
.autocomplete-item .ac-icon { width: 36px; height: 36px; background: var(--bg); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; color: var(--primary); }

/* ════════════════════════════
   RESPONSIVE — Mobile First
════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .menu-toggle { display: flex; }
  .page-body { padding: 16px; }
  .topbar { padding: 0 16px; }
  .stat-num { font-size: 22px; }
  .login-header { padding: 26px 20px; }
  .login-body { padding: 22px; }
}
@media (max-width: 480px) {
  .role-tabs { flex-wrap: wrap; }
  .role-tab { flex: 0 0 calc(50% - 3px); }
}
