/* ============================================================
   Hospital Task Manager — Global CSS Design System
   Light theme only. No dark mode.
   Font: Inter (Google Fonts)
   Accent: Teal #0D9488
   ============================================================ */

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

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* User-Provided 5-Color Palette */
  --palette-grey:         #D6D9DC; /* Swatch 1: Soft Neutral Cool Grey */
  --palette-white:        #FFFFFF; /* Swatch 2: Pure White */
  --palette-royal-blue:   #2352B2; /* Swatch 3: Deep Royal Blue */
  --palette-azure-blue:   #2C85EA; /* Swatch 4: Vibrant Azure Blue */
  --palette-bright-cyan:  #45E3F3; /* Swatch 5: Electric Bright Cyan */

  /* Backgrounds */
  --bg-page:    #EAEFF5;
  --bg-card:    #FFFFFF;
  --bg-nav:     #FFFFFF;
  --bg-sidebar: #FFFFFF;

  /* Text */
  --text-primary:   #1E293B;
  --text-secondary: #475569;
  --text-muted:     #64748B;
  --text-inverse:   #FFFFFF;

  /* Accent / Brand */
  --accent:         #2352B2;
  --accent-hover:   #1A3E8A;
  --accent-light:   #EBF3FE;
  --accent-border:  #2C85EA;

  /* Cyan & Azure Highlights */
  --cyan-accent:    #45E3F3;
  --cyan-light:     #E6FBFD;
  --azure-accent:   #2C85EA;

  /* Borders & Shadows */
  --border:         #D0D7DE;
  --border-focus:   #2C85EA;
  --shadow-sm:      0 1px 3px rgba(35, 82, 178, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md:      0 4px 8px rgba(35, 82, 178, .08), 0 2px 4px rgba(0, 0, 0, .04);
  --shadow-lg:      0 12px 20px rgba(35, 82, 178, .12), 0 4px 6px rgba(0, 0, 0, .04);

  /* Priority badge colours */
  --color-prod-bug:     #FEE2E2;
  --color-prod-bug-text:#991B1B;
  --color-prod-bug-border:#FECACA;

  --color-critical:     #FEF3C7;
  --color-critical-text:#92400E;
  --color-critical-border:#FDE68A;

  --color-high:         #E0F2FE;
  --color-high-text:    #0369A1;
  --color-high-border:  #BAE6FD;

  --color-normal:       #E0F7FA;
  --color-normal-text:  #006064;
  --color-normal-border:#B2EBF2;

  --color-low:          #F1F5F9;
  --color-low-text:     #475569;
  --color-low-border:   #CBD5E1;

  /* Status pill colours */
  --status-todo-bg:        #E0F2FE;
  --status-todo-text:      #0369A1;
  --status-inprog-bg:      #ECFDF5;
  --status-inprog-text:    #047857;
  --status-blocked-bg:     #FEF2F2;
  --status-blocked-text:   #B91C1C;
  --status-review-bg:      #F5F3FF;
  --status-review-text:    #6D28D9;
  --status-done-bg:        #F0FDF4;
  --status-done-text:      #15803D;

  /* Spacing */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-full:9999px;

  /* Sidebar */
  --sidebar-w: 250px;
  --topnav-h:  60px;
}

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

html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

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

.sidebar {
  width: var(--sidebar-w);
  background: #FFFFFF;
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.03);
}

.sidebar-logo {
  padding: 18px 20px 16px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFC 100%);
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.sidebar-logo-icon svg { color: white; width: 20px; height: 20px; }

.sidebar-logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 0.68rem;
  color: #64748B;
  font-weight: 600;
}

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

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #94A3B8;
  padding: 16px 10px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #F1F5F9;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9.5px 14px;
  border-radius: 10px;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  margin-bottom: 3px;
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  background: #F1F5F9;
  color: #2563EB;
  transform: translateX(3px);
  text-decoration: none;
}

.nav-item.active {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transform: translateX(2px);
  text-decoration: none;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  transition: transform .2s ease, color .2s ease;
  stroke-width: 2px;
}

.nav-item:hover svg {
  color: #2563EB;
  transform: scale(1.08);
}

.nav-item.active svg {
  color: #FFFFFF;
  transform: scale(1.1);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid #F1F5F9;
  margin: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer .avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.avatar-name {
  font-size: 0.83rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
}

.avatar-role {
  font-size: 0.68rem;
  color: #2563EB;
  font-weight: 700;
  margin-top: 2px;
}

/* ── Main content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
}

.topbar {
  height: var(--topnav-h);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-content {
  padding: 24px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card-body {
  padding: 20px;
  min-width: 0;
  max-width: 100%;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.card-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, box-shadow .15s, transform .1s;
  text-decoration: none !important;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg-page); }

.btn-danger {
  background: #DC2626;
  color: #FFFFFF !important;
  border-color: #B91C1C;
}
.btn-danger:hover { background: #B91C1C; color: #FFFFFF !important; }

.btn-success {
  background: #059669;
  color: #FFFFFF !important;
  border-color: #047857;
}
.btn-success:hover { background: #047857; color: #FFFFFF !important; }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-error {
  color: #DC2626;
  font-size: 0.8rem;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFA; }

/* ── Priority Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-production-bug {
  background: var(--color-prod-bug);
  color: var(--color-prod-bug-text);
  border-color: var(--color-prod-bug-border);
}

.badge-critical {
  background: var(--color-critical);
  color: var(--color-critical-text);
  border-color: var(--color-critical-border);
}

.badge-high {
  background: var(--color-high);
  color: var(--color-high-text);
  border-color: var(--color-high-border);
}

.badge-normal {
  background: var(--color-normal);
  color: var(--color-normal-text);
  border-color: var(--color-normal-border);
}

.badge-low {
  background: var(--color-low);
  color: var(--color-low-text);
  border-color: var(--color-low-border);
}

/* ── Status Pills ──────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.status-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-todo        { background: var(--status-todo-bg);    color: var(--status-todo-text); }
.status-in-progress { background: var(--status-inprog-bg);  color: var(--status-inprog-text); }
.status-blocked     { background: var(--status-blocked-bg); color: var(--status-blocked-text); }
.status-review      { background: var(--status-review-bg);  color: var(--status-review-text); }
.status-done        { background: var(--status-done-bg);    color: var(--status-done-text); }

/* Project status */
.badge-status-active  { background: #ECFDF5; color: #065F46; border-color: #6EE7B7; }
.badge-status-onhold  { background: #FEF9C3; color: #713F12; border-color: #FDE047; }
.badge-status-done    { background: #F3F4F6; color: #374151; border-color: #D1D5DB; }

/* ── Task Cards (board) ────────────────────────────────────── */
.task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
  cursor: grab;
}

.task-card-content {
  flex: 1;
  min-width: 0;
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.task-card:active { cursor: grabbing; }

.task-card.is-auto-top {
  border-left: 3px solid #EF4444;
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.task-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

.task-card-dates {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.task-card-project {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.lock-icon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: #EF4444;
  font-weight: 600;
}

/* ── Alert / Flash ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background .15s;
}

.pagination a:hover { background: var(--accent-light); color: var(--accent); }
.pagination .active { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Timeline / Gantt Bar ──────────────────────────────────── */
.timeline-bar {
  height: 20px;
  border-radius: var(--radius-full);
  min-width: 6px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  color: white;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.timeline-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: 120px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-track {
  flex: 1;
  height: 28px;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

/* ── Stat Card ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  opacity: .4;
}

.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 0.85rem; }

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F0FDFA 0%, #E0F2FE 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-header {
  padding: 30px 32px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.login-logo {
  width: 48px; height: 48px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}

.login-logo svg { width: 26px; height: 26px; color: white; }

.login-header h1 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.login-header p  { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.login-body { padding: 28px 32px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Utility ───────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.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-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sortable.js drag ghost */
.sortable-ghost { opacity: .4; }
.sortable-drag   { opacity: .9; box-shadow: var(--shadow-lg); }

/* ── Pagination Styling & SVG Bounds Fix ───────────────────────── */
nav[role="navigation"] svg,
.pagination svg,
div:has(> nav) svg,
div:has(> .pagination) svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.pagination {
  display: flex !important;
  padding-left: 0 !important;
  list-style: none !important;
  gap: 4px !important;
  align-items: center !important;
  margin: 12px 0 0 0 !important;
}

.pagination .page-item .page-link,
.pagination li a,
.pagination li span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 6px 12px !important;
  font-size: 0.85rem !important;
  color: #334155 !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.pagination .page-item.active .page-link,
.pagination li.active span {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  font-weight: 600 !important;
}

.pagination .page-item.disabled .page-link,
.pagination li.disabled span {
  color: #94a3b8 !important;
  background: #f8fafc !important;
  cursor: not-allowed !important;
}

