/* ===========================
   Base Improvements
=========================== */

.mbms-calendar-wrapper {
    max-width: 100%;
    overflow-x: hidden;
}

.mbms-calendar-grid {
    width: 100%;
}

.mbms-day-cell {
    min-height: 100px;
}

.mbms-day-classes {
    margin-top: 6px;
}

/* ===========================
   Mobile Layout
=========================== */

@media (max-width: 768px) {

    /* Reset table behavior completely */
    .mbms-calendar-grid {
        display: block;
        width: 100%;
    }

    .mbms-calendar-grid thead {
        display: none;
    }

    .mbms-calendar-grid tbody {
        display: block;
        width: 100%;
    }

    .mbms-calendar-grid tr {
        display: contents; /* KEY FIX */
    }

    .mbms-calendar-grid td {
        display: block;
        width: 100%;
        box-sizing: border-box;

        margin-bottom: 16px;

        border: 1px solid #ddd;
        border-radius: 8px;
        background: #fff;

        padding: 12px !important;

        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    /* Hide empty days */
    .mbms-day-empty,
    .mbms-day-cell:empty {
        display: none !important;
    }

    /* Day header */
    .mbms-day-header {
        margin-bottom: 6px;
        font-weight: bold;
        font-size: 16px;
        text-align: left;
    }

    .mbms-day-header-circle {
        background: #222;
        color: #000;
        padding: 4px 8px;
        border-radius: 20px;
        font-size: 14px;
    }

    /* Class list */
    .mbms-class-item {
        padding: 6px 0;
        border-bottom: 1px solid #eee;
    }

    .mbms-class-item:last-child {
        border-bottom: none;
    }

    /* Navigation */
    .mbms-calendar-nav {
        flex-direction: column;
        gap: 6px;
    }

    .mbms-calendar-title {
        font-size: 18px;
        text-align: center;
    }

    .mbms-day-classes {
        display: block !important;
        width: 100%;
        position: relative !important;
    }

    .mbms-class-item {
        display: block !important;
        width: 100% !important;

        float: none !important;
        position: relative !important;

        clear: both;

        margin: 0 0 8px 0 !important;
        padding: 6px 0 !important;

        height: auto !important;
        min-height: auto !important;

        box-sizing: border-box;
        overflow: hidden;
        white-space: normal;
    }

    .mbms-class-time,
    .mbms-class-name,
    .mbms-class-instructor {
        display: block !important;
        width: auto !important;

        float: none !important;
        position: static !important;

        margin: 2px 0;
        line-height: 1.4;
    }

    /* Let days grow naturally */
    .mbms-day-cell,
    .mbms-calendar-grid td {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;

        overflow: visible !important;
    }

    .mbms-day-classes {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .mbms-day-cell:hover {
        transform: none;
    }

    .mbms-day-cell {
        transition: all 0.3s ease;
    }

    /* Hide class list when collapsed */
    .mbms-day-cell.is-collapsed .mbms-day-classes {
        display: none !important;
    }

    /* Make headers tappable */
    .mbms-day-header {
        cursor: pointer;
/*        user-select: none; */
    }

    /* Highlight today */
    .mbms-day-cell.is-today {
        border: 2px solid #0073aa;
        background: #f7fbff;
    }

    /* Header layout */
    .mbms-day-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        cursor: pointer;
    }

    .mbms-day-header-left {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Chevron */
    .mbms-chevron {
        font-size: 14px;
        transition: transform 0.2s ease;
    }

    .mbms-day-cell:not(.is-collapsed) .mbms-chevron {
        transform: rotate(90deg);
    }

    /* Day label */
    .mbms-day-label {
        font-size: 13px;
        color: #666;
    }

    /* No events text */
    .mbms-no-events {
        font-style: italic;
        color: #777;
        padding: 6px 0;
    }

    /* Today button */
    .mbms-today-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 9999;

        background: #0073aa;
        color: #fff;
        border: none;
        border-radius: 30px;

        padding: 10px 16px;
        font-size: 14px;

        box-shadow: 0 2px 6px rgba(0,0,0,0.2);

        cursor: pointer;
    }

    .mbms-today-btn:hover {
        opacity: 0.9;
    }

    /* Toggle buttons */
    .mbms-view-toggle {
        display: flex;
        justify-content: center;
        gap: 10px;
        margin: 10px 0 15px;
    }

    .mbms-view-toggle button {
        padding: 6px 14px;
        border-radius: 20px;
        border: 1px solid #ccc;
        background: #fff;
        font-size: 14px;
        cursor: pointer;
    }

    .mbms-view-toggle button.active {
        background: #0073aa;
        color: #fff;
        border-color: #0073aa;
    }

    /* Weekly agenda */
    .mbms-week-view {
        display: none;
        padding: 0 5px 20px;
    }

    .mbms-week-view.active {
        display: block;
    }

    .mbms-week-day {
        margin-bottom: 16px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }

    .mbms-week-day:last-child {
        border-bottom: none;
    }

    .mbms-week-date {
        font-weight: bold;
        font-size: 15px;
        margin-bottom: 6px;
    }

    .mbms-week-date.today {
        color: #0073aa;
    }

    .mbms-week-event {
        padding: 4px 0;
        font-size: 14px;
    }

    .mbms-week-no-events {
        font-style: italic;
        color: #777;
        font-size: 13px;
    }

    /* Weekly event formatting */

    .mbms-week-event {
        padding: 6px 0;
        border-bottom: 1px dotted #eee;
        margin-bottom: 6px;
    }

    .mbms-week-event:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .mbms-week-title {
        font-weight: bold;
        display: block;
        font-size: 14px;
    }

    .mbms-week-time {
        display: block;
        font-size: 13px;
        margin-top: 1px;
    }

    .mbms-week-style {
        display: block;
        font-size: 12px;
        font-style: italic;
        color: #666;
        margin-top: 1px;
    }

    .mbms-collapsed .mbms-day-classes{
        display:none;
    }

}


}


