/* Mobile rotation and scroll fixes */

/* Prevent body scroll when sidebar or notification panel is open */
body.scroll-locked {
    overflow: hidden !important;
}

/* Settings modal scroll fixes - match notification panel behavior */
@media (max-width: 768px) {
    .profile-settings-modal .modal-content {
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .profile-settings-content {
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Ensure proper scrolling for sidebar and notification panel */
@media (max-width: 768px) {
    /* Sidebar scroll fixes */
    .sidebar {
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        /* Prevent scroll issues on rotation */
        max-height: 100vh !important;
        max-height: 100dvh !important; /* Dynamic viewport height */
    }
    
    .sidebar.active {
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Notification panel scroll fixes */
    .notification-dropdown {
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        /* Prevent scroll issues on rotation */
        max-height: 100vh !important;
        max-height: 100dvh !important; /* Dynamic viewport height */
    }
    
    .notification-list {
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        /* Ensure proper height calculation */
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
    }
    
    /* Fix viewport height issues on rotation */
    .dashboard-container {
        min-height: 100vh !important;
        min-height: 100dvh !important;
    }
    
    /* Prevent zoom on input focus */
    /* input, select, textarea {
        font-size: 16px !important;
    } */
}

/* Handle orientation change specifically */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        max-height: 100vh !important;
        max-height: 100dvh !important;
    }
    
    .notification-dropdown {
        max-height: 100vh !important;
        max-height: 100dvh !important;
    }
    
    .notification-list {
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .sidebar,
        .notification-dropdown {
            /* Use -webkit-fill-available for iOS */
            max-height: -webkit-fill-available !important;
        }
        
        .notification-list {
            max-height: calc(-webkit-fill-available - 60px) !important;
        }
    }
}