/* ==========================================================================
   Howrah Lions Hospital (Charushila Manmathanath Dey Memorial Unit)
   Master Design System & Stylesheet
   ========================================================================== */

:root {
    --primary: #0f4c81;
    --primary-dark: #092c4c;
    --primary-light: #e0f2fe;
    --secondary: #0284c7;
    --accent-red: #e63946;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-rose: #f43f5e;
    --bg-main: #0b1329;
    --bg-card: #111c38;
    --bg-card-hover: #172447;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-light: rgba(255, 255, 255, 0.15);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #1e293b;
    --glass-bg: rgba(17, 28, 56, 0.75);
    --glass-border: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.4);
    --sidebar-width: 270px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #0b1329;
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0d1730 0%, #080e1e 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-red), #b91c1c);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4);
}

.brand-text h2 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
}

.brand-text span {
    font-size: 10px;
    color: #38bdf8;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: block;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-menu li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-menu li a.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.25) 0%, rgba(2, 132, 199, 0.08) 100%);
    border-left: 3px solid #38bdf8;
    font-weight: 600;
}

.nav-menu li a i {
    font-size: 16px;
    width: 22px;
    text-align: center;
    color: var(--text-muted);
}

.nav-menu li a.active i {
    color: #38bdf8;
}

.badge-nav {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.badge-free {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-special {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-blood {
    background: rgba(244, 63, 94, 0.2);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: #64748b;
    line-height: 1.4;
}

.sidebar-footer strong {
    color: #94a3b8;
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navigation Bar */
.topbar {
    height: 70px;
    background: rgba(13, 23, 48, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hospital-live-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.topbar-contacts {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #e2e8f0;
}

.topbar-contacts a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Bilingual Language Switcher */
.lang-switcher {
    display: flex;
    background: #172447;
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-full);
    padding: 3px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.btn-quick-action {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-quick-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

/* Page Content */
.content-body {
    padding: 30px;
    flex: 1;
}

.section-view {
    display: none;
}

.section-view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
}

.page-title h1 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

.page-title p {
    font-size: 13.5px;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-color-light);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.red { background: rgba(244, 63, 94, 0.15); color: #fb7185; }
.stat-icon.blue { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.stat-icon.green { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.stat-icon.amber { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.stat-icon.purple { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }

.stat-info span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
}

.stat-info h3 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin: 3px 0;
}

.stat-info small {
    font-size: 11px;
    color: #38bdf8;
    font-weight: 600;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Blood Bank Matrix Grid */
.stock-matrix-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.matrix-card {
    background: #172447;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    text-align: center;
    transition: all 0.2s;
}

.matrix-card:hover {
    border-color: #38bdf8;
    background: #1e305e;
}

.matrix-group {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: #fb7185;
    margin-bottom: 8px;
}

.matrix-items {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

.matrix-items strong {
    color: #fff;
}

/* ==========================================================================
   INTERACTIVE COMPONENT TREE VISUALIZER (Matching Handwritten Diagram)
   ========================================================================== */
.tree-container {
    background: #0d1730;
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    padding: 30px;
    overflow-x: auto;
    margin-bottom: 30px;
}

.tree-root {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.tree-card-node {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.tree-card-node.donor-node {
    border-left: 4px solid #38bdf8;
}

.tree-card-node.bag-node {
    border-left: 4px solid #fb7185;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.node-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-branches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.component-branch-card {
    background: #172447;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: all 0.2s;
}

.component-branch-card:hover {
    border-color: #38bdf8;
    transform: translateY(-2px);
}

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

.comp-type {
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
}

.comp-shelf {
    font-size: 10.5px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.comp-meta {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

.comp-storage-temp {
    display: inline-block;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-top: 6px;
    color: #cbd5e1;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.custom-table th {
    background: #172447;
    color: #94a3b8;
    padding: 14px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: #e2e8f0;
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pill.available { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-pill.quarantine { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-pill.reactive { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.status-pill.issued { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.status-pill.expired { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.status-pill.discarded { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

/* Buttons */
.btn {
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary { background: linear-gradient(135deg, #0284c7, #0369a1); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4); transform: translateY(-1px); }

.btn-danger { background: linear-gradient(135deg, var(--accent-red), #b91c1c); color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4); transform: translateY(-1px); }

.btn-success { background: linear-gradient(135deg, #10b981, #047857); color: #fff; }
.btn-success:hover { box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4); transform: translateY(-1px); }

.btn-secondary { background: #1e293b; color: #e2e8f0; border: 1px solid var(--border-color); }
.btn-secondary:hover { background: #334155; }

.btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: var(--radius-sm); }

/* Form Controls & Inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: #cbd5e1;
}

.form-control {
    background: #0f1830;
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: #fff;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 9, 20, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover { color: #fff; }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Tabs inside modules */
.tab-nav {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    background: #172447;
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 80px; }
    .sidebar-brand .brand-text, .nav-menu li a span, .badge-nav, .sidebar-footer { display: none; }
    .main-wrapper { margin-left: 80px; }
    .stock-matrix-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-wrapper { margin-left: 0; }
    .stock-matrix-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar { padding: 0 15px; }
    .content-body { padding: 15px; }
}
