:root {
    --main-header-height: 64px;
    --total-header-height: 64px;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--main-header-height);
    background-color: white;
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden; /* Prevent horizontal scroll */
    overflow-y: auto !important; /* Force vertical scrolling */
    scroll-behavior: auto !important; /* Ensure smooth scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Force scrolling to always work */
html {
    overflow-y: auto !important;
    scroll-behavior: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Ensure body can always scroll */
body * {
    scroll-behavior: auto !important;
}

/* Prevent any element from blocking scroll */
.modal, [id*="modal"], [id*="Modal"] {
    overflow: visible !important;
}

/* Force scroll restoration */
body.scroll-restored {
    overflow-y: auto !important;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 0;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--main-header-height);
    z-index: 10;
    background: white;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

/* Mobile Menu Fixes */
@media screen and (max-width: 768px) {
    /* Fix mobile menu overlay */
    .fixed.inset-0.z-50 {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 9999 !important;
    }
    
    /* Fix mobile menu content positioning */
    .fixed.inset-y-0.right-0 {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 100% !important;
        max-width: 320px !important;
    }
}

/* Additional mobile fixes for smaller screens */
@media screen and (max-width: 480px) {
    header {
        height: 52px !important;
        min-height: 52px;
    }
    
    body {
        padding-top: 52px !important;
    }
    
    /* Ensure logo doesn't take too much space */
    header img {
        max-height: 28px !important;
        max-width: 100px !important;
    }
    
    /* Fix container padding on very small screens */
    .container.mx-auto.px-4 {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    /* Fix mobile menu positioning */
    .lg\:hidden.fixed.inset-0 {
        z-index: 9999 !important;
    }
    
    /* Ensure text doesn't overlap */
    .flex.items-center.justify-between {
        flex-wrap: nowrap !important;
    }
}

/* Remove underlines from all links */
a {
    text-decoration: none;
}

/* Modern Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

/* Custom scrollbar for overflow containers - show on hover */
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.5);
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overflow-y-auto:hover::-webkit-scrollbar-thumb {
    opacity: 1;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.8);
}

/* Firefox scrollbar for overflow containers */
.overflow-y-auto {
    scrollbar-width: thin;
    scrollbar-color: rgba(203, 213, 225, 0.5) transparent;
}

/* Additional Mobile Fixes */
@media screen and (max-width: 768px) {
    /* Fix backdrop blur issues on older browsers */
    .backdrop-blur-sm {
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
    }
    
    /* Fix text overflow and wrapping */
    .text-sm, .text-xs {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    /* Fix grid layout issues on mobile */
    .grid.grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Fix dropdown positioning */
    .absolute.top-full.right-0 {
        position: absolute !important;
        top: 100% !important;
        right: 0 !important;
        left: auto !important;
        transform: translateX(0) !important;
    }
}

/* Specific fixes for very small screens */
@media screen and (max-width: 360px) {
    header {
        height: 48px !important;
        min-height: 48px !important;
    }
    
    body {
        padding-top: 48px !important;
    }
    
    /* Make logo even smaller */
    header img {
        max-height: 24px !important;
        max-width: 80px !important;
    }
    
    /* Reduce padding */
    .container.mx-auto.px-4 {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
    
    /* Fix mobile menu width */
    .fixed.inset-y-0.right-0 {
        max-width: 280px !important;
    }
    
    /* Ensure text is readable */
    .text-sm {
        font-size: 13px !important;
    }
    
    .text-xs {
        font-size: 11px !important;
    }
}

/* Minimal styles for truly legacy browsers only (Android 4.x, iOS 9 and below) */
body.legacy-browser {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
