/* Modal Adjustments */
.modal-content {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
}

.modal-open .modal {
    overflow-x: hidden;
    overflow-y: auto;
}

/* Ensure Bootstrap Modals Are Always On Top */
.modal-backdrop {
    z-index: 99990 !important;
    pointer-events: auto !important;
}

.modal {
    z-index: 99991 !important;
    pointer-events: auto !important;
}

.modal-dialog {
    pointer-events: auto !important;
}

.modal-content {
    pointer-events: auto !important;
    position: relative;
    z-index: 99992 !important;
}

.modal-body, .modal-header, .modal-footer {
    pointer-events: auto !important;
}

.modal-body * {
    pointer-events: auto !important;
}

/* Ensure sidebar is below modals */
#sidebar-wrapper, .sidebar {
    z-index: 1040 !important;
}

.sidebar-overlay {
    z-index: 1039 !important;
    pointer-events: auto !important;
}

.sidebar-overlay:not(.active) {
    pointer-events: none !important;
    opacity: 0 !important;
    display: none !important;
}

/* Fix Bootstrap modal header close button */
.modal-header .close {
    padding: 1rem;
    margin: -1rem -1rem -1rem auto;
}

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

* {
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6; /* Modern Blue */
    --primary-dark: #2563eb;
    --secondary: #2a5298;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --sidebar-width: 280px;
    --sidebar-gradient: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: #3b82f6;
    --sidebar-collapsed-width: 80px;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', 'Poppins', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Glassmorphism Effect */
.glass-morphism {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

#wrapper {
    width: 100%;
    display: block !important;
    position: relative;
    /* Ensure this doesn't create a stacking context that traps modals */
    z-index: auto !important;
}

#page-content-wrapper {
    position: relative;
    z-index: auto !important;
}

/* Sidebar Styles */
#sidebar-wrapper, .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important; /* Visible by default on desktop */
    width: 250px !important;
    height: 100% !important;
    background: var(--sidebar-gradient);
    z-index: 1040 !important; /* Below Bootstrap modals (1050) */
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebar-wrapper.collapsed, .sidebar.collapsed {
    width: 0 !important;
    left: -250px !important;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 1039 !important; /* Just below sidebar */
    display: none; /* Hidden by default */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block !important;
}

/* Mobile Overrides */
@media (max-width: 768px) {
    #sidebar-wrapper {
        left: -260px !important; /* Hidden off-screen on mobile */
    }
    
    #sidebar-wrapper.active {
        left: 0 !important;
    }
}

/* Sidebar Header (Modern SaaS Logo) */
.sidebar-heading-modern {
    padding: 1rem; /* Consistent padding */
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
    transition: all 0.4s ease;
    cursor: pointer;
    overflow: hidden;
    min-height: 80px;
    position: relative; /* For absolute button positioning if needed */
}

.logo-icon-container {
    position: relative;
    width: 40px; /* Reduced from 45px */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    border: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

.sidebar-logo-img {
    width: 40px; /* Reduced from 45px */
    height: 40px;
    object-fit: contain;
    z-index: 2;
    filter: brightness(1.1);
}

.logo-icon {
    font-size: 1.4rem;
    color: #3b82f6;
    z-index: 2;
}

.logo-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #3b82f6;
    filter: blur(15px);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 12px;
}

.logo-text-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.4s ease;
    overflow: hidden;
    flex: 1; /* Take all available space */
    min-width: 0;
    padding-right: 5px; /* Tiny gap before button */
}

/* Ensure mobile close button is always visible and doesn't overlap */
.sidebar-heading-modern button {
    flex-shrink: 0;
    padding: 5px !important;
    margin-left: auto;
    z-index: 10;
}

.logo-main-text {
    font-size: 0.85rem; /* Reduced from 0.95rem for long names */
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.5px;
    line-height: 1.3; /* Increased line-height */
    text-transform: uppercase;
    margin-bottom: 2px;
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.logo-sub-text {
    font-size: 0.6rem; /* Reduced from 0.65rem */
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.2;
}

/* Mobile Adjustments for Sidebar Header */
@media (max-width: 768px) {
    .sidebar-heading-modern {
        padding: 1rem !important;
        gap: 10px !important;
    }
    .logo-main-text {
        font-size: 0.8rem !important;
    }
    .logo-icon-container, .sidebar-logo-img {
        width: 35px !important;
        height: 35px !important;
    }
}

/* Sidebar Hover Animation */
.sidebar-heading-modern:hover .logo-icon-container {
    transform: scale(1.1) rotate(5deg);
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

.sidebar-heading-modern:hover .logo-glow {
    opacity: 0.3;
}

.sidebar-heading-modern:hover .logo-main-text {
    color: #3b82f6;
    transition: color 0.3s ease;
}

/* Collapsed Sidebar Adjustments */
#sidebar-wrapper.collapsed .sidebar-heading-modern {
    padding: 2rem 0;
    justify-content: center;
}

#sidebar-wrapper.collapsed .logo-text-container {
    width: 0;
    opacity: 0;
    margin-left: 0;
    pointer-events: none;
}

#sidebar-wrapper.collapsed .sidebar-heading-modern .logo-icon-container {
    margin: 0;
}

#sidebar-wrapper.collapsed .sidebar-heading-modern span {
    display: none;
}

.sidebar-heading {
    padding: 2.5rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1.5rem;
    transition: all 0.4s ease;
    white-space: nowrap;
}

#sidebar-wrapper.collapsed .sidebar-heading {
    padding: 2.5rem 0;
    justify-content: center;
}

#sidebar-wrapper .list-group-item {
    padding: 0.85rem 1.25rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    margin: 0.5rem 15px;
    border-radius: 12px;
    font-size: 0.95rem;
    height: 50px;
    box-sizing: border-box;
    width: auto;
    white-space: nowrap;
    position: relative;
}

#sidebar-wrapper .list-group-item span {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#sidebar-wrapper.collapsed .list-group-item span,
#sidebar-wrapper.collapsed .sidebar-heading span {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
}

#sidebar-wrapper .list-group-item i {
    width: 25px;
    margin-right: 15px;
    font-size: 1.1rem;
    text-align: center;
    transition: all 0.3s ease;
}

/* Sidebar Dropdown Styles */
.sidebar-dropdown-content {
    display: none;
    background: rgba(0, 0, 0, 0.15);
    margin: 0 15px 0.5rem 15px;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar-dropdown-content.show {
    display: block;
}

.sub-item {
    margin: 0.2rem 0 !important;
    padding-left: 2.5rem !important;
    font-size: 0.85rem !important;
    height: 45px !important;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.dropdown-toggle-sidebar.open .dropdown-arrow,
.dropdown-toggle-sidebar.active .dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-section-label {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
}

/* Sidebar Animations */
#sidebar-wrapper .list-group-item:hover {
    background: var(--sidebar-hover);
    color: var(--white);
    transform: translateX(5px);
}

#sidebar-wrapper .list-group-item.active {
    background: var(--sidebar-active);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

#sidebar-wrapper .list-group-item.active i {
    color: var(--white);
}

#sidebar-wrapper.collapsed .list-group-item {
    margin: 0.5rem 10px;
    justify-content: center;
}

#sidebar-wrapper.collapsed .list-group-item:hover {
    transform: scale(1.1);
}

/* Page Content Styles */
#page-content-wrapper, .main-content {
    margin-left: 250px !important; /* Match sidebar width */
    width: calc(100% - 250px) !important;
    min-height: 100vh;
    position: relative !important;
    display: block !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#sidebar-wrapper.collapsed, .sidebar.collapsed {
    left: -250px !important;
}

#sidebar-wrapper.collapsed + #page-content-wrapper,
#page-content-wrapper.expanded, .main-content.expanded {
    margin-left: 0 !important;
    width: 100% !important;
}

#menu-toggle i {
    transition: transform 0.3s ease;
}

#menu-toggle.rotated i {
    transform: rotate(180deg);
}

/* Navbar Styles */
.navbar {
    background-color: var(--white) !important;
    padding: 1rem 2rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
    margin-bottom: 0;
}

#menu-toggle {
    background: #f8fafc;
    border: none;
    font-size: 1.1rem;
    color: var(--text-dark);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.user-profile {
    display: flex;
    align-items: center;
}

.user-profile-icon {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 10px;
}

/* Dashboard Content Padding */
.dashboard-content {
    padding: 30px;
}

/* Statistic Cards */
.stat-card {
    background: var(--white);
    padding: 2rem 1.5rem;
    border-radius: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: all 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover .stat-icon-box {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.stat-card:active {
    transform: translateY(-2px) scale(0.98);
}

.stat-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-count {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Content Cards (Charts, Activity) */
.content-card {
    background: var(--white);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.content-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.content-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.content-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.content-card-body {
    padding: 1.5rem;
}

/* Quick Action Cards */
.action-card {
    background: var(--white);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.action-card i {
    font-size: 2.5rem;
    margin-bottom: 1.25rem;
    display: block;
    transition: all 0.4s ease;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.action-card h6 {
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    transition: all 0.4s ease;
    font-size: 1.1rem;
}

.action-card:hover i {
    transform: scale(1.1);
}

.action-card:hover h6 {
    color: var(--primary);
}

/* Gradient Icon Backgrounds */
.bg-grad-primary { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.bg-grad-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.bg-grad-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.bg-grad-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.bg-grad-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

/* Modern Button Styles */
.btn-modern {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-modern:active {
    transform: translateY(0);
}

.btn-gradient-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white !important;
    border: none;
}

.btn-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white !important;
    border: none;
}

.btn-outline-modern {
    background: transparent;
    border: 2px solid #e2e8f0;
    color: var(--text-dark);
}

.btn-outline-modern:hover {
    border-color: var(--primary);
    background: #f8fafc;
    color: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #sidebar-wrapper {
        left: -260px !important; /* Ensure it starts hidden */
        width: 250px !important;
        max-width: 85% !important;
        transition: 0.3s !important;
        z-index: 9999 !important;
        display: block !important;
        box-shadow: none !important;
    }
    
    #sidebar-wrapper.active {
        left: 0 !important;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5) !important;
    }

    /* Force visibility of all nested elements when sidebar is active */
    #sidebar-wrapper.active * {
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* App-like Overlay */
    .sidebar-overlay {
        z-index: 9998 !important;
    }

    #page-content-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
        z-index: 1 !important;
    }

    /* Ensure no parent container blocks sidebar */
    #wrapper, body, html {
        overflow-x: hidden !important;
        position: relative !important;
    }

    /* Redesigned Navbar for mobile */
    .navbar {
        padding: 0.5rem 1rem 0.5rem 3.5rem !important;
        z-index: 1030 !important; /* Below sidebar, but above content */
    }

    /* Fixed Sidebar Toggle */
    #menu-toggle {
        position: fixed !important;
        top: 12px !important;
        left: 15px !important;
        z-index: 1041 !important; /* Above sidebar (1040), below modals (1050) */
        display: flex !important;
        width: 42px !important;
        height: 42px !important;
    }

    /* Handle very small screens */
    @media (max-width: 350px) {
        #sidebar-wrapper {
            width: 250px !important; /* Keep it consistent as per requirement */
        }
    }
}

    .ml-4.border-left.pl-4 {
        margin-left: 8px !important; /* Smaller margin */
        padding-left: 12px !important; /* Smaller padding */
        border-left: 1px solid #e2e8f0 !important;
    }

    .btn-danger.btn-sm {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.7rem !important;
        border-radius: 10px !important; /* Modern rounded corners */
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }

    .dashboard-content {
        padding: 15px !important;
    }

    /* Fix Notifications Dropdown on Mobile */
    .dropdown-menu-right {
        right: 0 !important;
        left: auto !important;
    }

    .dropdown-menu[style*="width: 320px"] {
        width: 280px !important; /* Smaller width for mobile */
        max-width: calc(100vw - 40px) !important;
        position: fixed !important;
        top: 60px !important;
        right: 20px !important;
        left: auto !important;
        transform: none !important;
    }

    /* Ensure dropdown stays within viewport */
    .dropdown-menu {
        margin-right: 0 !important;
    }
}

/* Glass Morphism Utility */
.glass-morphism {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* Additional Responsive Utilities */
.gap-2 { gap: 0.5rem !important; }
.opacity-2 { opacity: 0.2 !important; }
.extra-small { font-size: 0.7rem !important; }

/* Ensure data visibility in cards and tables */
.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.table td, .table th {
    vertical-align: middle !important;
    white-space: normal !important;
}

/* Mobile Card Visibility Fixes */
@media (max-width: 768px) {
    .glass-morphism {
        background: white !important; /* Fallback for mobile performance */
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    }
    
    .card-body {
        padding: 1.25rem !important;
    }
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 10px !important;
    }
    .modal-content {
        border-radius: 15px !important;
    }
}

@keyframes fadeInHeader {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Login Page Styles (Premium Glassmorphism) */
.login-page {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)), 
                url('https://images.unsplash.com/photo-1600585154340-be6161a56a0c?ixlib=rb-1.2.1&auto=format&fit=crop&w=1920&q=80') !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
}

.login-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    width: 100%;
    max-width: 440px;
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
    animation: loginFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.login-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
    letter-spacing: -1px;
}

.login-header p {
    color: #4a5568;
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

.input-group-modern {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group-modern input, 
.input-group-modern select {
    background: rgba(255, 255, 255, 0.5) !important;
    border: 1.5px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 12px !important;
    padding: 0.8rem 1rem 0.8rem 3rem !important; /* Slightly reduced padding */
    font-weight: 500;
    color: #1a202c !important;
    width: 100%;
    transition: all 0.3s ease;
}

.input-group-modern i:not(.fa-eye):not(.fa-eye-slash) {
    position: absolute;
    top: 50% !important;
    left: 1.2rem !important;
    transform: translateY(-50%) !important;
    color: #4facfe !important;
    z-index: 5;
    pointer-events: none;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.password-toggle-wrapper {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 10;
    color: #a0aec0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.password-toggle-wrapper:hover {
    color: #4facfe;
}

.password-toggle-wrapper i {
    font-size: 1.1rem;
}

/* Mobile Responsive Login Fixes */
@media (max-width: 576px) {
    .login-card {
        padding: 2rem 1.5rem !important;
        margin: 15px;
        border-radius: 15px;
    }

    .login-header h1 {
        font-size: 1.8rem !important;
    }

    .login-header p {
        font-size: 0.9rem !important;
    }

    .input-group-modern input, 
    .input-group-modern select {
        padding: 0.7rem 1rem 0.7rem 2.8rem !important;
        font-size: 0.9rem !important;
    }

    .password-toggle-wrapper {
        right: 0.8rem !important;
        padding: 5px !important;
    }

    .password-toggle-wrapper i {
        font-size: 0.95rem !important;
    }

    .input-group-modern i:not(.fa-eye):not(.fa-eye-slash) {
        left: 1rem !important;
        font-size: 0.9rem !important;
    }

    .btn-login {
        padding: 0.8rem !important;
        font-size: 1rem !important;
    }

    .login-logo {
        width: 60px !important;
        height: 60px !important;
    }
}

/* Handle Very Small Screens (318px) */
@media (max-width: 350px) {
    .login-card {
        padding: 1.5rem 1rem !important;
        margin: 10px;
    }

    .login-header h1 {
        font-size: 1.5rem !important;
    }

    .login-header p {
        font-size: 0.8rem !important;
    }

    .login-logo {
        width: 50px !important;
        height: 50px !important;
        margin-bottom: 10px !important;
    }

    .input-group-modern {
        margin-bottom: 1.2rem !important;
    }

    .input-group-modern input, 
    .input-group-modern select {
        padding: 0.6rem 0.8rem 0.6rem 2.5rem !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
    }

    .input-group-modern i:not(.fa-eye):not(.fa-eye-slash) {
        left: 0.8rem !important;
        font-size: 0.8rem !important;
    }

    .btn-login {
        padding: 0.7rem !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }
}

.input-group-modern input:focus, 
.input-group-modern select:focus {
    border-color: #4facfe !important;
    background: white !important;
    box-shadow: 0 0 0 4px rgba(79, 172, 254, 0.2) !important;
    transform: translateY(-2px);
}

.btn-login {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
    border-radius: 12px !important;
    padding: 1rem !important;
    font-size: 1.05rem !important;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3) !important;
}

.btn-login:hover {
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 15px 30px rgba(79, 172, 254, 0.4) !important;
}

.forgot-link {
    font-weight: 600;
    color: #4facfe !important;
    transition: all 0.3s ease;
}

.forgot-link:hover {
    color: #00f2fe !important;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Modern Utilities */
.rounded-12 { border-radius: 12px !important; }
.rounded-15 { border-radius: 15px !important; }
.shadow-soft { box-shadow: 0 8px 30px rgba(0,0,0,0.05) !important; }

.badge-soft-primary {
    background-color: rgba(79, 172, 254, 0.15);
    color: #4facfe;
    font-weight: 600;
}

.badge-soft-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-weight: 600;
}

.badge-soft-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-weight: 600;
}

.bg-soft-primary {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.rounded-10 { border-radius: 10px !important; }
.rounded-12 { border-radius: 12px !important; }
.rounded-15 { border-radius: 15px !important; }
.rounded-20 { border-radius: 20px !important; }

.font-weight-500 { font-weight: 500 !important; }
.font-weight-600 { font-weight: 600 !important; }

.transition-all {
    transition: all 0.3s ease !important;
}

.d-none {
    display: none !important;
}

.validation-msg {
    position: absolute;
    bottom: -1.2rem;
    left: 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Edit Button Styling and Animation */
.btn-edit-modern {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white !important;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.2);
    text-decoration: none !important;
}

.btn-edit-modern i {
    margin-right: 8px;
    font-size: 0.9rem;
}

.btn-edit-modern:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.35);
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
}

.btn-edit-modern:active {
    transform: scale(0.95);
}

/* Delete Button Styling */
.btn-delete-modern {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white !important;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(255, 75, 43, 0.2);
    text-decoration: none !important;
    margin-left: 10px;
}

.btn-delete-modern i {
    margin-right: 8px;
    font-size: 0.9rem;
}

.btn-delete-modern:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 75, 43, 0.35);
    background: linear-gradient(135deg, #ff4b2b 0%, #ff416c 100%);
}

.btn-delete-modern:active {
    transform: scale(0.95);
}

/* Page Fade-in Animation */
.fade-in-section {
    animation: fadeInSection 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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


.alert-modern {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.error-alert {
    background: #fff5f5;
    color: #c53030;
    border-color: #feb2b2;
}

.success-alert {
    background: #f0fff4;
    color: #2f855a;
    border-color: #c6f6d5;
}

/* Notification Animations */
.pulse {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.transition-all {
    transition: all 0.3s ease;
}

.dropdown-menu {
    animation: slideDown 0.3s ease-out forwards;
    transform-origin: top;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bg-soft-primary {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.rounded-top-15 {
    border-radius: 15px 15px 0 0 !important;
}

.opacity-2 {
    opacity: 0.2;
}

.border-left-danger {
    border-left: 5px solid #dc3545 !important;
}

.last-child-mb-0:last-child {
    margin-bottom: 0 !important;
}


.btn-reminder-gradient {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 10px rgba(253, 160, 133, 0.3) !important;
}

.btn-reminder-gradient:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 15px rgba(253, 160, 133, 0.4) !important;
    filter: brightness(1.05);
}

.btn-reminder-gradient:active {
    transform: scale(0.95) !important;
}

.btn-reminder-gradient:disabled {
    background: #e2e8f0 !important;
    transform: none !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

/* Toast Notification Styling */
.custom-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    padding: 16px 20px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateX(120%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.custom-toast.active {
    transform: translateX(0);
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.toast-success .toast-icon {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.toast-error .toast-icon {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.toast-content h6 {
    margin: 0;
    font-weight: 700;
    font-size: 0.95rem;
}

.toast-content p {
    margin: 0;
    font-size: 0.85rem;
    color: #718096;
}

.toast-close {
    margin-left: auto;
    cursor: pointer;
    color: #cbd5e0;
    transition: color 0.3s ease;
}

.toast-close:hover {
    color: #718096;
}

.glass-morphism {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07) !important;
}

.rounded-10 {
    border-radius: 10px !important;
}

.rounded-15 {
    border-radius: 15px !important;
}

.shadow-soft {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
}

.animated-input {
    transition: all 0.3s ease !important;
    border: 1px solid #e2e8f0 !important;
}

.animated-input:hover {
    border-color: #cbd5e0 !important;
}

.animated-input:focus {
    border-color: var(--sidebar-active) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    transform: translateY(-1px) scale(1.01);
}

.btn-scale {
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.btn-scale:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

.btn-glass-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

.btn-gradient-cyan {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.btn-gradient-cyan:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 10px 20px rgba(6, 182, 212, 0.3) !important;
}

.staggered-form {
    animation: fadeInSlide 0.8s ease-out forwards;
}

@keyframes fadeInSlide {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Webcam Styles */
.webcam-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 15px auto;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    display: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 3px solid rgba(255,255,255,0.1);
}

.webcam-container.active {
    display: block;
    animation: zoomIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#webcamVideo {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1); /* Default mirror for front cam */
}

/* For back camera, we'll remove mirror via JS if needed, or just keep it simple */
.no-mirror #webcamVideo {
    transform: scaleX(1);
}

.webcam-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

#previewWrapper {
    animation: fadeIn 0.5s ease;
}

#capturedImagePreview {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

.input-icon-group {
    position: relative;
}

.input-icon-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    z-index: 5;
    transition: color 0.3s ease;
}

.input-icon-group .form-control {
    padding-left: 45px !important;
}

.input-icon-group .form-control:focus + i {
    color: var(--sidebar-active);
}


/* Modern Currency Input */
.currency-input-container {
    position: relative;
}

.currency-symbol {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    font-size: 1rem;
    font-weight: 500;
    color: #6c757d;
    pointer-events: none;
}

.currency-input {
    padding-left: 35px !important;
    font-weight: 500;
}

.currency-input::placeholder {
    color: #ced4da;
}

/* ============================================
   COMPREHENSIVE RESPONSIVE FIXES
   ============================================ */

/* Base Responsive Container */
.container-fluid {
    padding-right: 1rem;
}

/* Responsive Typography Scaling */
html {
    font-size: 16px;
}

@media (max-width: 1200px) {
    html { font-size: 15px; }
}

@media (max-width: 992px) {
    html { font-size: 14.5px; }
}

@media (max-width: 768px) {
    html { font-size: 14px; }
}

@media (max-width: 576px) {
    html { font-size: 13.5px; }
}

@media (max-width: 350px) {
    html { font-size: 13px; }
}

/* Sidebar Responsive Behavior */
@media (max-width: 1199.98px) {
    #sidebar-wrapper {
        left: -270px !important;
        box-shadow: 20px 0 60px rgba(0,0,0,0.3);
    }
    #sidebar-wrapper.active {
        left: 0 !important;
    }
    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Sidebar Overlay Mobile */
@media (max-width: 991.98px) {
    .sidebar-overlay {
        display: none;
    }
    .sidebar-overlay.active {
        display: block !important;
    }
}

/* Navbar Responsive */
@media (max-width: 767.98px) {
    .navbar {
        padding: 0.75rem 1rem !important;
    }
    .user-profile .d-none {
        display: none !important;
    }
}

/* Stat Cards Responsive Grid */
.stat-card {
    margin-bottom: 1rem;
}

@media (max-width: 575.98px) {
    .stat-card {
        padding: 1.5rem 1rem;
    }
    .stat-count {
        font-size: 1.75rem;
    }
    .stat-icon-box {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}

/* Dashboard Content Padding */
@media (max-width: 767.98px) {
    .dashboard-content {
        padding: 1rem;
    }
}

/* Table Responsive Fixes */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    min-width: 600px;
}

@media (max-width: 767.98px) {
    .table {
        font-size: 0.875rem;
    }
    .table th, .table td {
        padding: 0.75rem;
        white-space: nowrap;
    }
}

/* Action Cards Responsive */
.action-card {
    margin-bottom: 1rem;
}

@media (max-width: 575.98px) {
    .action-card {
        padding: 2rem 1.25rem;
    }
    .action-card i {
        font-size: 1.8rem;
    }
    .action-card h6 {
        font-size: 1rem;
    }
}

/* Content Cards Responsive */
@media (max-width: 767.98px) {
    .content-card {
        margin-bottom: 1.5rem;
    }
    .content-card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .content-card-body {
        padding: 1rem;
    }
}

/* Form Responsive */
@media (max-width: 767.98px) {
    .form-control, .form-select {
        font-size: 1rem !important; /* Prevents iOS zoom */
    }
    .btn-modern {
        width: 100%;
        justify-content: center;
    }
    .btn-group {
        flex-direction: column;
    }
    .btn-group .btn {
        width: 100%;
        border-radius: 0.5rem !important;
        margin-bottom: 0.5rem;
    }
}

/* Modal Responsive */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 1rem !important;
        max-width: calc(100% - 2rem);
    }
    .modal-content {
        border-radius: 1rem !important;
    }
    .modal-header, .modal-body, .modal-footer {
        padding: 1rem;
    }
}

/* Image Responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Card Image Responsive */
.card-img-top {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Touch Target Improvements */
@media (hover: none) and (pointer: coarse) {
    .btn, .list-group-item, .nav-link, .dropdown-item {
        min-height: 44px;
        min-width: 44px;
    }
    input[type="checkbox"], input[type="radio"] {
        width: 24px;
        height: 24px;
    }
}

/* Prevent Horizontal Scroll */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Grid Responsive Improvements */
.row {
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}
.row > [class*="col-"] {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

@media (max-width: 767.98px) {
    .row {
        margin-right: -0.25rem;
        margin-left: -0.25rem;
    }
    .row > [class*="col-"] {
        padding-right: 0.25rem;
        padding-left: 0.25rem;
    }
}

/* Spacing Utilities Responsive */
.mt-5 { margin-top: 2rem !important; }
.mb-5 { margin-bottom: 2rem !important; }
.py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }

@media (max-width: 767.98px) {
    .mt-5 { margin-top: 1.5rem !important; }
    .mb-5 { margin-bottom: 1.5rem !important; }
    .py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
}

/* Badge Responsive */
@media (max-width: 575.98px) {
    .badge {
        font-size: 0.75em;
        padding: 0.35em 0.65em;
    }
}

/* Alert Responsive */
@media (max-width: 767.98px) {
    .alert-modern {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
}

/* Button Responsive */
.btn {
    transition: all 0.2s ease;
}

/* Input Group Modern */
@media (max-width: 575.98px) {
    .input-group-modern input, .input-group-modern select {
        padding: 0.8rem 1rem 0.8rem 2.8rem !important;
    }
    .input-group-modern i:not(.fa-eye):not(.fa-eye-slash) {
        left: 1rem !important;
        font-size: 1rem;
    }
}

/* Dropdown Menu Responsive */
@media (max-width: 767.98px) {
    .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
        max-width: calc(100% - 2rem) !important;
        margin-top: 0.5rem !important;
    }
}

/* PWA Install Prompt Responsive */
@media (max-width: 575.98px) {
    #pwa-install-container button {
        width: 100%;
    }
}

/* Ensure No Wrap Fix */
.nowrap {
    white-space: nowrap;
}

/* Text Responsive */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}