@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #2b6cb0;
    --primary-hover: #2c5282;
    --sidebar-bg: #1a202c;
    --sidebar-text: #ffffff;
    --sidebar-active: #2b6cb0;
    --border: #e2e8f0;
    --radius: 12px;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    background-color: #f4f7fa;
    color: #2d3748;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6, .page-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

/* Scaled standardized page headers */
h1, .page-title-lg { font-size: clamp(1.25rem, 3.5vw, 1.85rem) !important; font-weight: 800 !important; }
h2, .page-title { font-size: clamp(1.15rem, 3vw, 1.5rem) !important; font-weight: 800 !important; }
h3 { font-size: clamp(1rem, 2.5vw, 1.25rem) !important; font-weight: 700 !important; }

.page-subtitle, p.text-muted.small {
    font-size: 0.725rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em !important;
    color: #64748b !important;
}

.card-header h5, .card-header h6, .card-header .fw-bold {
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em !important;
    color: #0f172a !important;
}

.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
}

.auth-layout main {
    padding-bottom: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    flex: 1;
}

/* Auth Card sizing */
.auth-card {
    width: 100%;
    max-width: 450px;
    margin: 1rem auto;
}

.auth-card-lg {
    width: 100%;
    max-width: 800px;
    margin: 1rem;
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--sidebar-bg);
    background-image: linear-gradient(180deg, #1a202c 0%, #2d3748 100%);
    width: 240px; /* Reduced from 280px to save screen space */
    flex-shrink: 0;
    z-index: 2000; /* Increased to stay on top of everything */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar nav {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.sidebar-header {
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 1rem !important;
}

.sidebar-header i {
    font-size: 2rem !important;
}

.sidebar-header span {
    font-size: 1.1rem !important;
}

.sidebar .nav-link {
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8) !important;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    padding: 0.75rem 1.15rem;
    text-decoration: none;
    margin: 0.2rem 0.75rem;
    font-weight: 600;
    font-size: 0.88rem;
    text-transform: uppercase;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    background-color: var(--sidebar-active) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.3);
}

/* Page Tabs (Pills) styling */
.nav-pills .nav-link {
    color: #4a5568 !important;
    background-color: #ffffff;
    border: 1px solid var(--border) !important;
    margin: 0;
}

.nav-pills .nav-link.active {
    color: #ffffff !important;
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.nav-section-header {
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.4);
    padding: 1.25rem 1rem 0.4rem 1rem;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
}

/* Top Navigation Bar */
.top-row {
    height: 4.5rem;
    background: linear-gradient(to bottom, #e3f2fd 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1040;
    padding: 0 1.5rem;
}

.top-row::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #3182ce, #63b3ed, #4fd1c5, #48bb78);
}

/* Responsive Layout */
@media (min-width: 992px) {
    .page {
        flex-direction: row;
    }
    .sidebar {
        height: 100vh;
        position: sticky;
        top: 0;
    }
    main {
        width: calc(100% - 240px);
    }
}

@media (max-width: 991.98px) {
    html, body {
        font-size: 15px;
    }

    .sidebar {
        position: fixed;
        left: -340px; /* Hidden off-screen state */
        top: 0;
        bottom: 0;
        width: 290px; /* Spacious width for mobile screens */
        max-width: 85vw;
        box-shadow: 12px 0 35px rgba(0, 0, 0, 0.35);
        padding-bottom: 20px;
        z-index: 2050;
        transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Hide mobile bottom nav when sidebar is open */
    #nav-toggle:checked ~ .page .mobile-bottom-nav {
        transform: translateY(100px);
        opacity: 0;
        pointer-events: none;
    }

    .sidebar .nav-link {
        padding: 0.85rem 1.25rem;
        font-size: 0.95rem;
        margin: 0.25rem 0.75rem;
        border-radius: 12px;
    }

    .sidebar .nav-link i {
        font-size: 1.35rem !important;
        margin-right: 0.85rem !important;
    }

    .nav-section-header {
        font-size: 0.72rem;
        padding: 1.1rem 1rem 0.4rem 1rem;
        letter-spacing: 0.08rem;
    }

    #nav-toggle:checked ~ .page .sidebar {
        left: 0;
    }

    .nav-menu-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.65);
        z-index: 2040;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        transition: opacity 0.3s ease;
    }

    #nav-toggle:checked ~ .nav-menu-backdrop {
        display: block;
    }
}

/* Buttons & Components */
.btn {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.card {
    background-color: #ffffff;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #edf2f7 !important;
    padding: 1rem 1.25rem !important;
    position: relative;
}

.card-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #3182ce, #63b3ed, #4fd1c5, #48bb78);
    border-radius: 0 0 3px 3px;
}

/* Modern Mobile Bottom Navigation Redesign */
body.admin-portal .mobile-bottom-nav {
    display: none !important;
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    height: 64px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1050;
    border-radius: 32px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 0 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-bottom-nav .nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 600;
    flex: 1;
    height: 100%;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 6px 0;
    border-radius: 16px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-btn i {
    font-size: 1.25rem;
    margin-bottom: 2px;
    transition: transform 0.25s ease, color 0.25s ease;
}

.mobile-bottom-nav .nav-btn span {
    letter-spacing: 0.3px;
    transition: font-weight 0.2s ease, color 0.2s ease;
}

/* Active Nav State */
.mobile-bottom-nav .nav-btn.active {
    color: #0d6efd;
    font-weight: 700;
}

.mobile-bottom-nav .nav-btn.active i {
    transform: translateY(-2px) scale(1.1);
    color: #0d6efd;
}

/* Active Indicator Line */
.mobile-bottom-nav .nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 16px;
    height: 3.5px;
    background: #0d6efd;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.4);
}

/* Floating Center Action Button (Plus FAB) */
.mobile-bottom-nav .plus-btn {
    margin-top: -32px;
    flex: 0 0 58px;
    height: 58px;
    z-index: 1060;
    padding: 0;
    border-radius: 50%;
}

.mobile-bottom-nav .plus-icon {
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #f8fafc;
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-bottom-nav .plus-icon i {
    font-size: 1.6rem;
    margin-bottom: 0;
    color: #ffffff;
    transition: transform 0.25s ease;
}

.mobile-bottom-nav .plus-btn:active .plus-icon {
    transform: scale(0.92);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.mobile-bottom-nav .nav-btn:active {
    opacity: 0.75;
}

/* Adjust main content padding for floating bar */
@media (max-width: 991.98px) {
    main {
        padding-bottom: 90px !important;
    }
}

/* Table Styling */
.table thead th {
    background-color: #f8fafc !important;
    color: #64748b !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    padding: 1rem !important;
    border-bottom: 2px solid #edf2f7 !important;
}

.table tbody td {
    padding: 1rem !important;
    vertical-align: middle;
}

/* Notification Bell & Badge */
#notificationCount {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-item {
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.notification-item.unread {
    background-color: rgba(43, 108, 176, 0.05);
    border-left-color: var(--primary);
}

.notification-item:hover {
    background-color: #f8fafc;
}

/* Toast Styling */
.toast {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
}

.toast-header {
    border-bottom: none !important;
}

/* Reconnecting Overlay Styling & Keyframe Animations */
.reconnecting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 20000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.reconnecting-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.reconnecting-card {
    background: #ffffff;
    padding: 2.25rem 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transform: scale(0.88);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reconnecting-overlay.active .reconnecting-card {
    transform: scale(1);
}

/* Hero Graphic combining Rotating Spinner + Central Offline Icon */
.reconnecting-hero-graphic {
    position: relative;
    width: 84px;
    height: 84px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reconnecting-spinner {
    position: absolute;
    inset: 0;
    border: 3.5px solid rgba(13, 110, 253, 0.15);
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spinRing 0.85s linear infinite !important;
}

@keyframes spinRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.reconnecting-icon {
    width: 58px;
    height: 58px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: radarPulse 1.8s infinite ease-in-out !important;
}

@keyframes radarPulse {
    0% { transform: scale(0.92); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 14px rgba(220, 53, 69, 0); }
    100% { transform: scale(0.92); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Animated Dots (...) */
.animated-dots::after {
    content: '';
    animation: dotsAnimation 1.5s infinite;
}

@keyframes dotsAnimation {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* PWA Auto-Install Floating Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 85px;
    left: 16px;
    right: 16px;
    max-width: 480px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    z-index: 10000;
    transform: translateY(120px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 992px) {
    .pwa-install-banner {
        bottom: 24px;
        right: 24px;
        left: auto;
    }
}

.pwa-install-banner.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Spinner Spin Animation */
.reconnecting-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border: 0.25em solid #0d6efd;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spinRotation 0.75s linear infinite !important;
}

@keyframes spinRotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Printing Utilities */
@@media print {
    .no-print, .d-print-none {
        display: none !important;
    }
}
