/* ═══════════════════════════════════════════════════════
   ANTIGRAVITY HMS — Professional Medical Theme
   Clean · Modern · Readable
═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand Colors */
    --primary:        #1a6b4a;   /* Deep medical green */
    --primary-dark:   #145538;
    --primary-light:  #e8f5ee;
    --secondary:      #0f4c75;   /* Deep navy */
    --accent:         #00b894;   /* Teal accent */

    /* UI Colors */
    --sidebar-bg:     #0d1b2a;   /* Deep navy sidebar */
    --sidebar-hover:  rgba(255,255,255,0.07);
    --sidebar-active: rgba(0,184,148,0.15);
    --sidebar-border: rgba(0,184,148,0.4);
    --topbar-bg:      #ffffff;

    /* Semantic */
    --success:        #00b894;
    --warning:        #fdcb6e;
    --warning-dark:   #e17055;
    --danger:         #d63031;
    --info:           #0984e3;

    /* Neutrals */
    --bg-body:        #f4f6f9;
    --bg-card:        #ffffff;
    --text-dark:      #1a202c;
    --text-muted:     #718096;
    --border-color:   #e2e8f0;

    /* Layout */
    --sidebar-width:  260px;
    --card-radius:    12px;
    --transition:     all 0.2s cubic-bezier(0.4,0,0.2,1);
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:      0 10px 40px rgba(0,0,0,0.12);
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

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

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    overflow: hidden;
}

#sidebar .sidebar-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

#sidebar .sidebar-header h5 {
    color: #ffffff;
    font-size: 0.95rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: 0.3px;
}

#sidebar .sidebar-header .user-context {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 14px;
}

#sidebar ul.components {
    padding: 8px 10px 20px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

#sidebar ul.components::-webkit-scrollbar { width: 3px; }
#sidebar ul.components::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

#sidebar ul li a {
    padding: 9px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    transition: var(--transition);
    border-radius: 8px;
    margin-bottom: 2px;
    letter-spacing: 0.2px;
}

#sidebar ul li a i {
    margin-right: 10px;
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

#sidebar ul li a:hover {
    color: #ffffff;
    background: var(--sidebar-hover);
}
#sidebar ul li a:hover i { opacity: 1; }

#sidebar ul li.active > a {
    color: #ffffff;
    background: var(--sidebar-active);
    border-left: 3px solid var(--accent);
    padding-left: 9px;
    font-weight: 600;
}
#sidebar ul li.active > a i { opacity: 1; color: var(--accent); }

/* POS highlight in sidebar */
#sidebar ul li a.pos-link {
    background: rgba(0,184,148,0.12);
    color: var(--accent);
    border: 1px solid rgba(0,184,148,0.2);
    font-weight: 600;
}
#sidebar ul li a.pos-link:hover {
    background: rgba(0,184,148,0.22);
    color: #fff;
}

/* Logout — target by class instead of last-child */
#sidebar ul li.logout-item a {
    background: rgba(214,48,49,0.08) !important;
    color: rgba(214,48,49,0.75) !important;
    border-left: none !important;
}
#sidebar ul li.logout-item a:hover {
    background: rgba(214,48,49,0.15) !important;
    color: #d63031 !important;
}

.sidebar-label {
    padding: 14px 14px 5px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: rgba(255,255,255,0.2);
    pointer-events: none;
    display: block;
}

#sidebar.active { margin-left: calc(-1 * var(--sidebar-width)); }

/* ═══════════════════════════════════════════════════════
   CONTENT AREA
═══════════════════════════════════════════════════════ */
#content {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
}
#content.active { width: 100%; margin-left: 0; }

/* ═══════════════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════════════ */
.top-navbar, nav.top-navbar {
    background: var(--topbar-bg);
    box-shadow: 0 1px 0 var(--border-color), var(--shadow-sm);
    padding: 10px 24px !important;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: none;
}

.top-navbar h5 { color: var(--text-dark) !important; font-size: 1rem; }
.top-navbar .text-muted { color: var(--text-muted) !important; }
.top-navbar .btn-light {
    background: var(--bg-body) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-dark) !important;
}

/* POS button in topbar */
.btn-pos {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff !important;
    border: none;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 7px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,184,148,0.3);
}
.btn-pos:hover {
    background: linear-gradient(135deg, var(--primary-dark), #00a381);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,184,148,0.4);
}

/* ═══════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════ */
.card {
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color) !important;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 14px 20px;
}
.card-header.bg-white { background: #fafbfc !important; }

.stat-card {
    border: none !important;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    background: var(--bg-card);
    border-left: 4px solid var(--primary) !important;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.stat-icon {
    font-size: 2.5rem;
    opacity: 0.08;
    position: absolute;
    right: 16px;
    bottom: 8px;
}

/* ═══════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════ */
.table > :not(caption) > * > * { padding: 0.75rem 0.875rem; }
.table-hover tbody tr:hover { background-color: rgba(26,107,74,0.04); }
.table thead.table-light th,
thead.table-light th {
    background-color: #f8fafc !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.7rem;
    border-bottom: 2px solid var(--border-color) !important;
}

/* ═══════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════ */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
    transition: var(--transition);
    background-color: #fff;
    color: var(--text-dark);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,107,74,0.12);
    background-color: #fff;
}
.form-label { font-weight: 600; color: var(--text-dark); margin-bottom: 5px; }
.form-text { color: var(--text-muted); font-size: 0.78rem; }

/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn {
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
    letter-spacing: 0.2px;
    padding: 0.45rem 1rem;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(26,107,74,0.3);
    color: #fff;
}
.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: #fff;
}
.btn-success:hover {
    background-color: #00a381;
    border-color: #00a381;
    box-shadow: 0 4px 12px rgba(0,184,148,0.3);
    color: #fff;
}
.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-danger:hover { background-color: #b71c1c; border-color: #b71c1c; color: #fff; }
.btn-warning {
    background-color: var(--warning);
    border-color: var(--warning);
    color: #1a202c;
}
.btn-dark {
    background-color: #2d3748;
    border-color: #2d3748;
    color: #fff;
}
.btn-dark:hover { background-color: #1a202c; border-color: #1a202c; color: #fff; }
.btn-light {
    background-color: #f8fafc;
    border-color: var(--border-color);
    color: var(--text-dark);
}
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background-color: var(--primary); color: #fff; }

/* ═══════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════ */
.badge {
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.2px;
    padding: 4px 8px;
}

/* ═══════════════════════════════════════════════════════
   NAV TABS & PILLS
═══════════════════════════════════════════════════════ */
.nav-tabs { border-bottom: 2px solid var(--border-color); }
.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    transition: var(--transition);
    margin-bottom: -2px;
}
.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
    font-weight: 700;
}
.nav-tabs .nav-link:hover:not(.active) {
    color: var(--text-dark);
    border-bottom-color: var(--border-color);
}

.nav-pills .nav-link {
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
}
.nav-pills .nav-link.active {
    background-color: var(--primary);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════ */
.modal-content {
    border-radius: 14px;
    border: none;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    border-radius: 14px 14px 0 0;
    padding: 16px 20px;
}
.modal-header.bg-primary { background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important; }
.modal-header.bg-dark    { background: linear-gradient(135deg, #1a202c, #2d3748) !important; }
.modal-header.bg-success { background: linear-gradient(135deg, #00a381, var(--success)) !important; }
.modal-header.bg-danger  { background: linear-gradient(135deg, #b71c1c, var(--danger)) !important; }
.modal-header.bg-warning { background: linear-gradient(135deg, #e17055, var(--warning)) !important; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 14px 20px; }

/* ═══════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════ */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
    padding: 12px 16px;
}
.alert-success  { background: #e8f8f2; color: #0d5c3a; border-left: 4px solid var(--success) !important; }
.alert-danger   { background: #fdf0f0; color: #7b1c1c; border-left: 4px solid var(--danger) !important; }
.alert-warning  { background: #fffbeb; color: #7c4a00; border-left: 4px solid var(--warning-dark) !important; }
.alert-info     { background: #eff8ff; color: #0c4a6e; border-left: 4px solid var(--info) !important; }

/* ═══════════════════════════════════════════════════════
   DROPDOWNS
═══════════════════════════════════════════════════════ */
.dropdown-menu {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    padding: 6px;
}
.dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    transition: var(--transition);
    color: var(--text-dark);
}
.dropdown-item:hover { background-color: var(--primary-light); color: var(--primary); }

/* ═══════════════════════════════════════════════════════
   UTILITY CLASSES
═══════════════════════════════════════════════════════ */
.text-indigo   { color: #5a67d8 !important; }
.bg-indigo     { background-color: #5a67d8 !important; }
.bg-indigo-light { background-color: rgba(90,103,216,0.1) !important; }
.text-teal     { color: var(--accent) !important; }
.bg-teal       { background-color: var(--accent) !important; }

.btn-indigo {
    background-color: #5a67d8;
    color: white;
    border: none;
}
.btn-indigo:hover {
    background-color: #4c51bf;
    color: white;
    box-shadow: 0 4px 12px rgba(90,103,216,0.3);
}
.btn-outline-indigo { color: #5a67d8; border-color: #5a67d8; }
.btn-outline-indigo:hover { background-color: #5a67d8; color: white; }

/* ═══════════════════════════════════════════════════════
   AUTH PAGE
═══════════════════════════════════════════════════════ */
.auth-body {
    background: linear-gradient(135deg, #0d1b2a 0%, #1a3a5c 50%, #0d2b1e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    background: #ffffff;
    border-top: 4px solid var(--primary);
}

/* ═══════════════════════════════════════════════════════
   BED PAGE
═══════════════════════════════════════════════════════ */
.ward-block { border: 1px solid var(--border-color) !important; transition: var(--transition); }
.ward-block:hover { transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }

.bed-item-wrapper {
    border-color: var(--border-color) !important;
    background: #fff !important;
    border-radius: 12px;
}
.bed-item-wrapper.occupied { background: #fff5f5 !important; border-color: #fed7d7 !important; }
.bed-item-wrapper.available:hover { border-color: var(--primary) !important; background: var(--primary-light) !important; }
.available .bed-sheets { background: var(--success) !important; }
.occupied .bed-sheets  { background: var(--danger) !important; }
.bed-headboard, .bed-footboard { background: #4a5568 !important; }

/* ═══════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════ */
@media print {
    #sidebar, nav.top-navbar, .btn, .no-print { display: none !important; }
    #content { margin-left: 0 !important; width: 100% !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    #sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
    #sidebar.active { margin-left: 0; }
    #content { width: 100%; margin-left: 0; }
    #content.active { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); }
}

/* ═══════════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

/* ═══════════════════════════════════════════════════════
   MISC
═══════════════════════════════════════════════════════ */
.transition-all { transition: var(--transition); }
.font-monospace { font-family: 'Courier New', monospace; }
.letter-spacing-1 { letter-spacing: 0.5px; }
.shadow-xs { box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
