
/* =========================================================
   Elevare LMS - Calendar responsive styling
   Scoped to Moodle Calendar page.
   ========================================================= */

/* Page scope */
body#page-calendar-view,
body.path-calendar {
    overflow-x: hidden !important;
}

body#page-calendar-view #page,
body#page-calendar-view #page-content,
body#page-calendar-view #region-main-box,
body#page-calendar-view #region-main,
body#page-calendar-view [role="main"] {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Main content */
body#page-calendar-view #region-main {
    width: 100% !important;
}

/* Calendar layout container */
body#page-calendar-view .heightcontainer,
body#page-calendar-view .maincalendar,
body#page-calendar-view .calendarwrapper,
body#page-calendar-view .calendar {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* =========================================================
   Tablet and below
   ========================================================= */

@media (max-width: 991.98px) {

    body#page-calendar-view #page,
    body#page-calendar-view #page-content,
    body#page-calendar-view #region-main-box,
    body#page-calendar-view #region-main,
    body#page-calendar-view [role="main"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body#page-calendar-view #region-main {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Calendar */
    body#page-calendar-view .heightcontainer,
    body#page-calendar-view .maincalendar,
    body#page-calendar-view .calendarwrapper,
    body#page-calendar-view .calendar {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
    }

    /* Sidebar open arrow */
    #mobile-sidebar-open {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: fixed !important;
        left: 0 !important;
        bottom: 90px !important;
        width: 34px !important;
        height: 44px !important;
        border: 0 !important;
        border-radius: 0 10px 10px 0 !important;
        background: #3f51b5 !important;
        color: #fff !important;
        font-size: 26px !important;
        line-height: 1 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .25) !important;
        z-index: 1030 !important;
    }

    body:has(#theme_boost-drawers-primary.show) #mobile-sidebar-open {
        display: none !important;
    }

    /* Responsive sidebar drawer */
    body#page-calendar-view #theme_boost-drawers-primary {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 285px !important;
        max-width: 85vw !important;
        z-index: 1050 !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, .3);
    }

    body#page-calendar-view #theme_boost-drawers-primary:not(.show) {
        transform: translateX(-100%) !important;
        visibility: hidden !important;
    }

    body#page-calendar-view #theme_boost-drawers-primary.show {
        transform: none !important;
        left: 0 !important;
        visibility: visible !important;
        width: 285px !important;
        max-width: 85vw !important;
        z-index: 1050 !important;
    }

    /* Footer */
    body#page-calendar-view #page-footer {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        position: static !important;
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box !important;
    }

    body#page-calendar-view #page-footer * {
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        flex-wrap: wrap !important;
        white-space: normal !important;
        justify-content: center !important;
        text-align: center !important;
    }
}

/* =========================================================
   Phones
   ========================================================= */

@media (max-width: 767.98px) {

    body#page-calendar-view {
        overflow-x: hidden !important;
    }

    body#page-calendar-view #region-main {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Calendar layout */
    body#page-calendar-view .heightcontainer,
    body#page-calendar-view .maincalendar,
    body#page-calendar-view .calendarwrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Calendar navigation and controls */
    body#page-calendar-view .calendar-controls,
    body#page-calendar-view .maincalendar .calendar-controls,
    body#page-calendar-view .header {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    body#page-calendar-view .maincalendar {
        overflow-x: auto !important;
    }

    /* Calendar table */
    body#page-calendar-view .maincalendar table {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body#page-calendar-view .maincalendar table th,
    body#page-calendar-view .maincalendar table td {
        padding: 4px !important;
        overflow-wrap: anywhere !important;
    }

    /* Form and filter controls */
    body#page-calendar-view select,
    body#page-calendar-view input,
    body#page-calendar-view textarea {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Footer */
    body#page-calendar-view #page-footer {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* =========================================================
   Small phones
   ========================================================= */

@media (max-width: 479.98px) {

    body#page-calendar-view #region-main {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    body#page-calendar-view .maincalendar table th,
    body#page-calendar-view .maincalendar table td {
        padding: 2px !important;
    }

    body#page-calendar-view #page-footer {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }
}
