/* ===== Hospital Management ERP Styles ===== */
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 60px;
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0d6efd;
    --top-bar-height: 56px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    margin: 0;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: 60px;
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .dropdown-icon,
.sidebar.collapsed span {
    display: none;
}

.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.sidebar-nav > li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 0.9rem;
}

.sidebar-nav > li > a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav > li.active > a {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-nav > li > a i:first-child {
    font-size: 1.15rem;
    min-width: 22px;
    text-align: center;
}

.dropdown-icon {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.sidebar-dropdown.open .dropdown-icon {
    transform: rotate(180deg);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0,0,0,0.15);
}

.sidebar-nav ul li a {
    display: block;
    padding: 9px 20px 9px 54px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

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

/* ===== Main Content ===== */
#main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

.sidebar.collapsed ~ #main-content {
    margin-left: var(--sidebar-collapsed);
}

.top-navbar {
    background: #fff;
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    height: var(--top-bar-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

#sidebarToggle {
    color: #475569;
    padding: 4px 8px;
}

.content-wrapper {
    padding: 24px;
}

/* ===== Dashboard Cards ===== */
.stat-card {
    border: none;
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    font-size: 2.2rem;
    opacity: 0.85;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.bg-gradient-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-gradient-success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.bg-gradient-warning { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.bg-gradient-info    { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

/* ===== Cards & Tables ===== */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    padding: 14px 20px;
}

.card-body { padding: 20px; }

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-card h2 {
    font-weight: 700;
    color: #1e293b;
}

.login-card .form-control {
    padding: 10px 14px;
    border-radius: 8px;
}

/* ===== Buttons ===== */
.btn { border-radius: 8px; font-size: 0.9rem; }
.btn-sm { font-size: 0.8rem; }

/* ===== Badge ===== */
.badge { font-weight: 500; font-size: 0.78rem; }

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h4 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
}

/* ===== Print Styles ===== */
@media print {
    .sidebar, .top-navbar, .no-print { display: none !important; }
    #main-content { margin-left: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    .sidebar span, .sidebar .dropdown-icon, .sidebar-title {
        display: none;
    }
    #main-content {
        margin-left: var(--sidebar-collapsed);
    }
    .sidebar.mobile-open {
        width: var(--sidebar-width);
    }
    .sidebar.mobile-open span,
    .sidebar.mobile-open .dropdown-icon,
    .sidebar.mobile-open .sidebar-title {
        display: inline;
    }
    .content-wrapper { padding: 16px; }
}

/* ===== DataTables overrides ===== */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

/* ===== Utilities ===== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer { cursor: pointer; }
