@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --bg-light: #f4f6f9;
    --text-color: #333;
    --muted: #6c757d;
    --white: #ffffff;
    --sidebar-width: 250px;
    --border-color: #e9ecef;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

/* ---------------------------
   Layout Structure
--------------------------- */
/* ---------------------------
   Layout Structure
--------------------------- */
.app-container {
    display: flex;
    min-height: 100vh;
    background-color: #f0f2f5;
    /* Softer background */
}

/* Sidebar */
:root {
    --sidebar-width: 280px;
    /* Increased width for single line menu */
    --sidebar-bg: #ffffff;
    --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    --nav-item-color: #5e6e82;
    --nav-item-hover-bg: #f8f9fa;
    --nav-item-active-bg: #eef2ff;
    --nav-item-active-color: var(--primary);
    --logo-height: 70px;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    /* Higher z-index */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--sidebar-shadow);
}

.logo-area {
    height: var(--logo-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: -0.5px;
}

.logo-icon {
    font-size: 28px;
    margin-right: 12px;
    min-width: 32px;
    text-align: center;
    filter: drop-shadow(0 2px 4px rgba(var(--primary-rgb), 0.2));
    /* Assuming primary-rgb exists or fallback */
}

/* Custom Scrollbar for Sidebar */
.nav-menu {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.nav-menu::-webkit-scrollbar {
    width: 5px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    color: var(--nav-item-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border-radius: 8px;
    /* Modern pill shape */
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    /* Enforce single line */
}

.nav-item div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.nav-item:hover {
    color: var(--primary);
    background-color: var(--nav-item-hover-bg);
    transform: translateX(3px);
}

.nav-item.active {
    color: var(--nav-item-active-color);
    background-color: var(--nav-item-active-bg);
    font-weight: 600;
}

.nav-item i {
    width: 24px;
    font-size: 18px;
    text-align: center;
    margin-right: 12px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.nav-item.active i {
    color: var(--primary);
}

/* Arrow rotation for submenus */
.nav-item .arrow {
    margin-left: auto;
    margin-right: 0;
    font-size: 12px;
    width: auto;
    transition: transform 0.3s;
}

.nav-item.open .arrow {
    transform: rotate(90deg);
}

/* Submenu Styling */
.submenu {
    display: none;
    padding-left: 12px;
    /* Indent submenus */
    margin-bottom: 8px;
    animation: slideDown 0.2s ease-out;
}

.submenu.show {
    display: block;
}

.submenu .nav-item {
    padding: 10px 16px 10px 42px;
    /* Align deeply */
    font-size: 13.5px;
    color: #7987a1;
    background: transparent;
}

.submenu .nav-item:hover {
    color: var(--primary);
    background: transparent;
    /* Clean look for subitems */
    transform: translateX(3px);
}

.submenu .nav-item.active {
    color: var(--primary);
    background: transparent;
    font-weight: 600;
}

.submenu .nav-item::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    width: 6px;
    height: 6px;
    background-color: #cbd5e1;
    border-radius: 50%;
    transform: translateY(-50%);
    transition: background-color 0.2s;
}

.submenu .nav-item:hover::before,
.submenu .nav-item.active::before {
    background-color: var(--primary);
}


@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #fcfcfd;
}

.user-card {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #edf2f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.user-card img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
}

.user-info .name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.user-info .role {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Collapsed Sidebar State (Desktop) */
body.sidebar-collapsed .sidebar {
    width: 80px;
}

body.sidebar-collapsed .logo-area,
body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    font-size: 0;
    /* Hide all text */
}

body.sidebar-collapsed .logo-area div,
body.sidebar-collapsed .logo-area .lite,
body.sidebar-collapsed .nav-item div,
body.sidebar-collapsed .nav-item .arrow,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .submenu {
    display: none !important;
}

/* Show parent div for has-submenu items to display icon */
body.sidebar-collapsed .nav-item.has-submenu>div:first-child {
    display: flex !important;
    justify-content: center;
    align-items: center;
    font-size: 0;
    /* Hide text inside */
}

/* Keep icons visible even inside hidden divs */
body.sidebar-collapsed .nav-item div i,
body.sidebar-collapsed .nav-item i {
    display: inline-block !important;
    margin-right: 0;
    font-size: 20px;
    /* Restore icon size */
}

body.sidebar-collapsed .logo-icon {
    margin-right: 0;
    display: block !important;
    font-size: 24px;
    /* Restore logo icon size */
}

/* Tooltip for collapsed sidebar */
body.sidebar-collapsed .nav-item {
    position: relative;
}

body.sidebar-collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #2d3748;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, left 0.2s ease;
    margin-left: 10px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.sidebar-collapsed .nav-item::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #2d3748;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
    margin-left: 4px;
}

body.sidebar-collapsed .nav-item:hover::after,
body.sidebar-collapsed .nav-item:hover::before {
    opacity: 1;
}

body.sidebar-collapsed .nav-item:hover::after {
    left: calc(100% + 10px);
}

body.sidebar-collapsed .user-card {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    justify-content: center;
}

body.sidebar-collapsed .user-card img {
    margin: 0;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 16px 0;
    display: flex;
    justify-content: center;
}


/* Main Content Adjustment */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    background-color: #f0f2f5;
}

body.sidebar-collapsed .main-content {
    margin-left: 80px !important;
    width: calc(100% - 80px);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Overlay when sidebar matches */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        z-index: 900;
        animation: fadeIn 0.3s ease;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Top Header */
.top-header {
    height: 60px;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    position: sticky;
    top: 0;
    z-index: 99;
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}

.search-bar input {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background-color: #f8f9fa;
    outline: none;
    font-size: 13px;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--primary);
    background-color: #fff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--muted);
    cursor: pointer;
    position: relative;
}

.action-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 50%;
}

.btn-primary-rounded {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3);
    text-decoration: none;
}

.btn-primary-rounded:hover {
    background-color: var(--primary-dark);
    color: #fff;
}

/* Content Wrapper */
.content-wrapper {
    padding: 15px 10px;
    /* User requested minimal 10px padding */
    overflow-y: auto;
    /* Reset AdminLTE legacy margin if present */
    margin-left: 0 !important;
    background: transparent !important;
    min-height: calc(100vh - 60px);
}

/* ---------------------------
   Dashboard Widgets
--------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-right: 15px;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: #e7f1ff;
    color: var(--primary);
}

.stat-icon.green {
    background: #e6ffed;
    color: var(--success);
}

.stat-icon.orange {
    background: #fff8e6;
    color: var(--warning);
}

.stat-icon.red {
    background: #ffebee;
    color: var(--danger);
}

.stat-icon.purple {
    background: #f3e5f5;
    color: #9c27b0;
}

.stat-info h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.stat-info p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

/* Panels */
.panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    overflow: hidden;
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.panel-body {
    padding: 20px;
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom th {
    text-align: left;
    padding: 12px 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 12px 15px;
    font-size: 13px;
    border-bottom: 1px solid #f1f1f1;
    color: #444;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

/* Utilities */
.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.fw-bold {
    font-weight: 600;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 10px;
}

/* ---------------------------
   Login Page Styles (Preserved)
--------------------------- */
.login-page-body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    overflow: hidden;
}

.login-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

/* Left Side - Branding */
.login-branding {
    flex: 6;
    background: linear-gradient(135deg, #007bff 0%, #00d2ff 100%), url('../img/hospital-bg.jpg');
    background-blend-mode: multiply;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: #fff;
    position: relative;
}

.branding-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.login-branding h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.login-branding p {
    font-size: 1.2rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* Right Side - Form */
.login-form-container {
    flex: 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    background: #fff;
}

.login-header-form {
    margin-bottom: 40px;
}

.login-header-form h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
}

.login-header-form p {
    color: var(--muted);
}

.form-floating {
    position: relative;
    margin-bottom: 20px;
}

.form-floating input {
    width: 100%;
    padding: 15px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    background: #fdfdfd;
}

.form-floating input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    background: #fff;
}

.form-floating label {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    transition: 0.2s ease all;
    background: #fff;
    padding: 0 5px;
}

.form-floating input:focus~label,
.form-floating input:not(:placeholder-shown)~label {
    top: 0;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

.btn-login {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.login-footer-links {
    margin-top: 30px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
}

.login-footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

@media (max-width: 900px) {
    .login-branding {
        display: none;
    }

    .login-form-container {
        flex: 1;
        padding: 40px;
    }
}

/* Standard Badges */
.badge-primary {
    background-color: var(--primary);
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background-color: var(--success);
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}

.badge-warning {
    background-color: var(--warning);
    color: #212529;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}

.badge-danger {
    background-color: var(--danger);
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}

.badge-info {
    background-color: var(--info);
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}

.badge-light {
    background-color: #f8f9fa;
    color: #212529;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}

/* Payment Button Styles (Unified Premium - Compact) */
.payment-btn {
    cursor: pointer !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 12px 10px !important;
    text-align: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: #ffffff !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.payment-btn:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
}

.payment-btn.active {
    background: #eff6ff !important;
    border-color: #3b82f6 !important;
    color: #1d4ed8 !important;
    font-weight: 700 !important;
    box-shadow: 0 0 0 1px #3b82f6 !important;
    position: relative !important;
    transform: scale(1.02) !important;
}

.payment-btn.active::after {
    content: '\f058' !important;
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    font-size: 0.75rem !important;
    color: #3b82f6 !important;
}

.payment-btn i {
    font-size: 1.35rem !important;
    display: block !important;
    margin-bottom: 6px !important;
    transition: transform 0.2s !important;
}

.payment-btn:hover i {
    transform: scale(1.05) !important;
}

.payment-btn small {
    font-size: 0.65rem !important;
    letter-spacing: 0.3px !important;
    text-transform: uppercase !important;
    display: block !important;
    font-weight: 600 !important;
}

.wallet-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
}

/* ---------------------------
   Global Modal Fixes (Standardizing Custom Modals)
--------------------------- */
.modal {
    display: none;
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    z-index: 1050 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    outline: 0 !important;
    background-color: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(4px) !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding-top: 50px !important;
}

.modal.show,
.modal[style*='display: block'] {
    display: flex !important;
}

.modal-content {
    background: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid #e2e8f0 !important;
    position: relative !important;
    width: 95% !important;
    max-width: 500px !important;
    margin: 0 auto !important;
}

/* ---------------------------
   Standardized Page Header Box
--------------------------- */
.premium-header {
    background: white;
    padding: 15px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid #007bff;
}

.premium-header-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #007bff;
    letter-spacing: -0.5px;
}

.premium-header-title p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #6c757d;
}

/* Force Full Width for all legacy containers */
.content-wrapper>div:not(.modal) {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.paylater-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
}