/* =====================================================================
   Dr. Bhat ENT-EYE Hospital  |  Theme
   Palette derived from the logo:
     Primary red  #E31E24 / dark #B71C1C
     ENT accent   #16a085 (green)   EYE accent #2980b9 (blue)
     Icon accents orange #F39C12, yellow #F1C40F
   ===================================================================== */
:root {
  --brand:        #E31E24;
  --brand-dark:   #B71C1C;
  --brand-light:  #fdecec;
  --ent:          #16a085;
  --eye:          #2980b9;
  --orange:       #F39C12;
  --yellow:       #F1C40F;
  --ink:          #2b2b2b;
  --muted:        #6b7280;
  --line:         #e7e9ee;
  --bg:           #f4f6fa;
  --sidebar-w:    250px;
  --header-h:     58px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ---- Top header ---------------------------------------------------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: #fff;
  border-bottom: 3px solid var(--brand);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem; z-index: 1030;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.app-header .brand {
  display: flex; align-items: center; gap: .55rem;
  font-weight: 700; color: var(--brand); font-size: 1.05rem;
  white-space: nowrap;
}
.app-header .brand .logo-badge {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 1rem;
}
.app-header .brand small { color: var(--muted); font-weight: 500; }
.header-spacer { flex: 1; }

.dept-pill {
  font-size: .72rem; font-weight: 700; letter-spacing: .3px;
  padding: .18rem .55rem; border-radius: 999px; color: #fff;
}
.dept-ent { background: var(--ent); }
.dept-eye { background: var(--eye); }

.user-chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .5rem; border-radius: 8px; cursor: pointer;
}
.user-chip:hover { background: var(--bg); }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: grid; place-items: center; font-weight: 700;
}
.user-chip .u-name { font-weight: 600; font-size: .9rem; line-height: 1; }
.user-chip .u-role { font-size: .72rem; color: var(--muted); }

.menu-toggle {
  border: 0; background: transparent; color: var(--brand);
  font-size: 1.4rem; cursor: pointer; display: none;
}

/* ---- Sidebar ------------------------------------------------------- */
.app-sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0;
  width: var(--sidebar-w); background: #fff;
  border-right: 1px solid var(--line);
  overflow-y: auto; z-index: 1020;
  transition: transform .2s ease;
}
.app-sidebar .nav-group-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); font-weight: 700;
  padding: 1rem 1.1rem .35rem;
}
.app-sidebar .nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem 1.1rem; color: var(--ink); font-weight: 500;
  border-left: 3px solid transparent;
}
.app-sidebar .nav-link i { width: 20px; text-align: center; color: var(--muted); }
.app-sidebar .nav-link:hover { background: var(--brand-light); color: var(--brand-dark); }
.app-sidebar .nav-link:hover i { color: var(--brand); }
.app-sidebar .nav-link.active {
  background: var(--brand-light); color: var(--brand-dark);
  border-left-color: var(--brand); font-weight: 600;
}
.app-sidebar .nav-link.active i { color: var(--brand); }

/* ---- Main content -------------------------------------------------- */
.app-main {
  margin-left: var(--sidebar-w); padding: calc(var(--header-h) + 1.1rem) 1.25rem 2rem;
  min-height: 100vh;
}
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0 0 .25rem; }
.page-sub { color: var(--muted); margin: 0 0 1.1rem; font-size: .9rem; }

/* ---- Cards / tables ------------------------------------------------ */
.card { border: 1px solid var(--line); border-radius: 12px; }
.card-header {
  background: #fff; border-bottom: 1px solid var(--line);
  font-weight: 600; border-radius: 12px 12px 0 0;
}
.table thead th {
  background: #fafbfc; color: var(--muted); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 2px solid var(--line);
}
.table td { vertical-align: middle; }

/* ---- DataTables ---------------------------------------------------- */
.dataTables_wrapper { padding: .9rem 1rem; }
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; margin-left: .4rem;
}
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line); border-radius: 8px; padding: .3rem 1.6rem .3rem .5rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--brand) !important; border-color: var(--brand) !important;
  color: #fff !important; border-radius: 6px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--brand-light) !important; border-color: var(--brand-light) !important;
  color: var(--brand-dark) !important; border-radius: 6px;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { color: var(--muted); font-size: .85rem; }
table.dataTable thead th { cursor: pointer; }

/* ---- Buttons ------------------------------------------------------- */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

/* ---- Badges -------------------------------------------------------- */
.badge-active   { background: #e7f6ee; color: #1c8a4e; }
.badge-inactive { background: #feecec; color: var(--brand-dark); }
.badge-vacant   { background: #e7f6ee; color: #1c8a4e; }
.badge-occupied { background: #fff3e0; color: #b26a00; }

/* ---- Stat cards (dashboard) ---------------------------------------- */
.stat-card { border-radius: 14px; padding: 1.1rem 1.2rem; color: #fff; }
.stat-card .stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { opacity: .9; font-size: .85rem; }
.stat-card .stat-icon { font-size: 2rem; opacity: .35; }
.bg-brand  { background: linear-gradient(135deg,#E31E24,#B71C1C); }
.bg-ent    { background: linear-gradient(135deg,#1abc9c,#16a085); }
.bg-eye    { background: linear-gradient(135deg,#3498db,#2980b9); }
.bg-amber  { background: linear-gradient(135deg,#f5b53f,#F39C12); }

/* ---- Login --------------------------------------------------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg,#fdecec 0%,#f4f6fa 100%);
  padding: 1rem;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: 16px; box-shadow: 0 12px 40px rgba(179,28,28,.12);
  border-top: 5px solid var(--brand); padding: 2rem;
}
.login-logo { width: 62px; height: 62px; border-radius: 50%;
  background: var(--brand); color:#fff; display: grid; place-items:center;
  font-size: 1.7rem; margin: 0 auto 1rem; }

/* ---- Responsive ---------------------------------------------------- */
@media (max-width: 991px) {
  .menu-toggle { display: inline-block; }
  .app-sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .app-header .brand small { display: none; }
  .sidebar-backdrop.show {
    position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.35);
    z-index: 1010;
  }
}
