/* =========================================================
    CALENDAR - MERGED SELECTORS (TEMP DRY STEP)
    Goal: keep 1 rule-set even when selectors differ
========================================================= */

/* ---------------------------
    PROGRAMS CALENDAR
--------------------------- */
#v-pills-library-programs .add-workout-to-program-calendar-day-btn-wrapper {
    display: none;
}

#v-pills-library-programs
    .calendar-column:hover
    .add-workout-to-program-calendar-day-btn-wrapper {
    display: flex !important;
}

#v-pills-library-programs .calendar-day-body {
    flex-grow: 1;
    overflow: auto;
}

#v-pills-library-programs .calendar-row {
    display: flex;
    height: 100%;
}

#v-pills-library-programs .calendar-column {
    /* 0.5rem === gap-2 class */
    width: calc((100% - 0.5rem * 6) / 7);
    flex-shrink: 1;
    display: flex;
    flex-direction: column;
}

#v-pills-library-programs .view-programs {
    cursor: pointer;
}

#v-pills-library-programs .arrow-btns {
    font-size: 17px;
}

#v-pills-library-programs .text-whitespace {
    white-space: break-spaces;
}

#v-pills-library-programs .exercise-block {
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #ffffff;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#v-pills-library-programs .modal-edit-workout-body {
    max-height: 70vh; /* responsive height */
    overflow-y: auto;
    padding-right: 15px;
}

#v-pills-library-programs .hoverable-item:hover .hover-label {
    display: none !important;
}

#v-pills-library-programs .hoverable-item:hover .hover-buttons {
    display: block !important;
}

#v-pills-library-programs .hover-buttons {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

#v-pills-library-programs .hoverable-container:hover .hover-label {
    visibility: hidden;
}

#v-pills-library-programs
    .hoverable-container:hover
    .hoverable-container-hover {
    display: block !important;
}

#v-pills-library-programs .arrow-btns:disabled {
    border: 0 !important;
}

#v-pills-library-programs .paste-program-week-container {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    transform: translateY(-50%);
    pointer-events: none;
    gap: 0.625rem;
}

#v-pills-library-programs .btn-paste-program-week,
#v-pills-library-programs .cancel-program-week-copy-mode {
    pointer-events: auto;
    font-weight: 600;
}

/* ---------------------------
    TRAINING CALENDAR (PROFILE) + ASSISTED (COMMON BASE)
    Note: split into base + per-container overrides where needed
--------------------------- */

/* Show menu toggle on hover */
#v-pills-profile-section-training
    .training-calendar-day:hover
    .training-menu-toggle {
    visibility: visible;
}

/* Day base (shared props) */
#v-pills-profile-section-training .training-calendar-day,
#assisted-user-training-calendar .training-calendar-day {
    border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
    padding: 5px;
    --bs-bg-opacity: 1;
    background-color: rgba(
        var(--bs-secondary-bg-rgb),
        var(--bs-bg-opacity)
    ) !important;
    margin: 5px;
    border-radius: 8px;
    position: relative;
    text-align: left;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Day container-specific */
#v-pills-profile-section-training .training-calendar-day {
    height: auto;
    overflow: hidden;
}

#assisted-user-training-calendar .training-calendar-day {
    min-height: 100px;
}

/* Date */
#v-pills-profile-section-training .training-calendar-date,
#assisted-user-training-calendar .training-calendar-date {
    font-weight: 600;
}

/* Day label base */
#v-pills-profile-section-training .training-calendar-day-label,
#assisted-user-training-calendar .training-calendar-day-label {
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    margin: 5px;
}

/* Day label container-specific */
#v-pills-profile-section-training .training-calendar-day-label {
    width: calc((100% - 0.5rem * 6) / 7);
}

/* Today highlight */
#v-pills-profile-section-training
    .training-calendar-today
    .training-calendar-date,
#v-pills-profile-section-training
    .training-calendar-day-box:has(.training-calendar-today)
    .training-calendar-day-label,
#v-pills-profile-section-training
    .training-calendar-day-label-row
    .training-calendar-today,
#assisted-user-training-calendar
    .training-calendar-today
    .training-calendar-date,
#assisted-user-training-calendar
    .training-calendar-day-box:has(.training-calendar-today)
    .training-calendar-day-label {
    color: var(--mangofit-color) !important;
}

/* Day box wrapper */
#v-pills-profile-section-training .training-calendar-day-box-wrapper,
#assisted-user-training-calendar .training-calendar-day-box-wrapper {
    display: flex;
    flex-wrap: nowrap;
}

/* Day box base */
#v-pills-profile-section-training .training-calendar-day-box,
#assisted-user-training-calendar .training-calendar-day-box {
    display: flex;
    flex-direction: column;
    width: calc((100% - 0.5rem * 6) / 7);
}

/* Day box container-specific */
#v-pills-profile-section-training .training-calendar-day-box {
    flex-grow: 1;
}

#assisted-user-training-calendar .training-calendar-day-box {
    flex: 0 0 14.28%;
}

/* Date wrapper */
#v-pills-profile-section-training .training-calendar-date-wrapper,
#assisted-user-training-calendar .training-calendar-date-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Workout content */
#v-pills-profile-section-training .training-calendar-workout-content,
#assisted-user-training-calendar .training-calendar-workout-content {
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    padding-right: 1px;
}

/* Weekdays hidden */
#v-pills-profile-section-training .weekdays,
#assisted-user-training-calendar .weekdays {
    display: none;
}

/* Weekday base */
#v-pills-profile-section-training .trainingcalendarweekday,
#assisted-user-training-calendar .trainingcalendarweekday {
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
}

/* Weekday active */
#v-pills-profile-section-training .trainingcalendarweekday.active,
#assisted-user-training-calendar .trainingcalendarweekday.active {
    color: var(--mangofit-color);
    font-weight: bold;
}

/* Weekday hover */
#v-pills-profile-section-training .trainingcalendarweekday:hover,
#assisted-user-training-calendar .trainingcalendarweekday:hover {
    color: var(--mangofit-color);
}

/* Profile-only menu */
#v-pills-profile-section-training .training-calendar-menu {
    position: absolute;
    top: 30px;
    right: 10px;
    background: white;
    border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
    border-radius: 5px;
    z-index: 100;
    width: 150px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
}

#v-pills-profile-section-training .training-calendar-menu a {
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    display: block;
}

#v-pills-profile-section-training .training-calendar-menu a:hover {
    background-color: #f0f0f0;
}

#v-pills-profile-section-training .training-menu-toggle {
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
}

/* Paste week container */
#v-pills-profile-section-training .paste-week-container {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    transform: translateY(-50%);
    pointer-events: none;
    gap: 0.625rem;
}

#v-pills-profile-section-training .btn-paste-training-assisted-user-week,
#v-pills-profile-section-training .cancel-training-user-week-copy-mode {
    pointer-events: auto;
    font-weight: 600;
}

.remove-training-calendar-menu-toggle-icon::after {
    display: none !important;
}

@media screen and (width > 768px) {
    /* bootstrap md+ */
    #v-pills-profile-section-training .training-menu-toggle {
        visibility: hidden;
    }
}

/* ---------------------------
   COMMON GENERIC CALENDAR STYLES
--------------------------- */
.calendar-workout-cell-container {
    margin-bottom: 1rem;
    box-shadow: var(--bs-box-shadow-sm);
}

.calendar-workout-cell-container:hover {
    border-color: var(--ms-accent-blue) !important;
    /* background-color: rgba(52, 152, 219, 0.05); */
}

.calendar-workout-cell-container,
.calendar-workout-cell-container .calendar-workout-items-list .calendar-cell-item,
.calendar-workout-cell-container .calendar-workout-items-list .calendar-section-item {
    border-width: 1px !important;
    border-style: solid !important;
    border-color: var(--bs-border-color) !important;
    transition: border-color 0.3s;
}

.calendar-workout-cell-container:hover .edit-program-workout-card-label,
.calendar-workout-cell-container:hover .edit-assigned-workout-card-label,
.calendar-workout-cell-container:hover .assigned-workout-card-name {
    text-decoration: underline !important;
    cursor: pointer !important;
    font-weight: 600 !important;
}

.calendar-workout-cell-container .exercise-item {
    border-bottom: 0.1px solid rgba(var(--current-theme-secondary-color-rgb), 0.5);
}
.calendar-workout-cell-container .exercise-item:last-child {
    border-bottom: none;
}

#v-pills-profile-section-training .multi-set-dropdown-menu,
#v-pills-library-programs .multi-set-dropdown-menu,
.multi-set-dropdown-menu {
    max-height: 150px;
    overflow-y: auto;
}

.calendar-workout-items-list:not(.calendar-workout-items-list-no-hoverable) .calendar-cell-item:hover,
.calendar-workout-items-list:not(.calendar-workout-items-list-no-hoverable) .calendar-section-item:hover {
    border-color: rgba(var(--mangofit-color-rgb), 0.3) !important;
    background-color: rgba(52, 152, 219, 0.05);
}

/* Copy mode disabled (shared) */
#v-pills-library-programs .copy-mode-disabled,
#v-pills-profile-section-training .copy-mode-disabled,
#assisted-user-training-calendar .copy-mode-disabled {
    opacity: 0.7;
    pointer-events: none;
    user-select: none;
    filter: blur(0.0563rem);
}

/* ---------------------------
   RESPONSIVE (MAX 1024px)
--------------------------- */
@media (max-width: 1024px) {
    /* Programs calendar */
    #v-pills-library-programs .calendar-row {
        flex-direction: column;
        gap: 1rem;
        height: auto !important;
    }

    #v-pills-library-programs .calendar-column {
        width: 100% !important;
        max-width: 100%;
    }

    #v-pills-library-programs #calendarContainer {
        overflow-x: auto !important;
        overflow-y: visible !important;
    }

    #v-pills-library-programs .program-calendar-flex {
        overflow-x: auto !important;
        overflow-y: visible !important;
    }

    #v-pills-library-programs .calendar-column > .calendar-column-d-flex {
        position: relative;
        padding: 0.5rem;
    }

    #v-pills-library-programs .calendar-column span {
        flex-shrink: 0;
    }

    #v-pills-library-programs .add-workout-to-program-calendar-day-btn-wrapper {
        display: flex !important;
        position: absolute;
        right: 0%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 1;
    }

    #v-pills-library-programs
        .border-top.border-bottom.program-calendar-borders {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: left;
    }

    #v-pills-library-programs
        .border-top.border-bottom.program-calendar-borders
        > h5 {
        width: 100%;
        margin-bottom: 0.5rem;
        padding-left: 0.5rem;
    }

    #v-pills-library-programs
        .border-top.border-bottom.program-calendar-borders
        > div {
        flex-wrap: wrap;
        justify-content: center !important;
        width: 100%;
    }

    /* Training profile + assisted */
    #v-pills-profile-section-training #weekRange,
    #assisted-user-training-calendar #weekRange {
        display: none;
    }

    #v-pills-profile-section-training #calendarDays,
    #assisted-user-training-calendar #calendarDays {
        max-height: 100vh;
        overflow-y: auto;
        scroll-behavior: smooth;
    }

    #v-pills-profile-section-training .training-calendar-day-box-wrapper,
    #assisted-user-training-calendar .training-calendar-day-box-wrapper {
        flex-direction: column;
    }

    /* Profile-only overflow override */
    #v-pills-profile-section-training .training-calendar-day-box-wrapper {
        overflow: auto !important;
    }

    #v-pills-profile-section-training .training-calendar-day-box,
    #assisted-user-training-calendar .training-calendar-day-box {
        width: 100% !important;
        flex: 0 0 auto;
        margin-bottom: 10px;
    }

    #v-pills-profile-section-training .training-calendar-day,
    #assisted-user-training-calendar .training-calendar-day {
        height: auto;
    }

    #v-pills-profile-section-training .training-calendar-date-wrapper,
    #assisted-user-training-calendar .training-calendar-date-wrapper {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 10px;
    }

    #v-pills-profile-section-training .training-calendar-date,
    #assisted-user-training-calendar .training-calendar-date {
        flex-shrink: 0;
        font-weight: bold;
        font-size: 14px;
    }

    #v-pills-profile-section-training .week-controls-wrapper,
    #assisted-user-training-calendar .week-controls-wrapper {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
    }

    #v-pills-profile-section-training .week-controls-wrapper > div,
    #v-pills-profile-section-training .week-controls-wrapper > h4,
    #v-pills-profile-section-training .week-controls-wrapper > input,
    #assisted-user-training-calendar .week-controls-wrapper > div,
    #assisted-user-training-calendar .week-controls-wrapper > h4,
    #assisted-user-training-calendar .week-controls-wrapper > input {
        width: 100%;
        justify-content: center !important;
        text-align: center !important;
        margin-bottom: 0.5rem;
    }

    #v-pills-profile-section-training #trainingWeekdayHeaders,
    #assisted-user-training-calendar #trainingWeekdayHeaders {
        display: flex !important;
    }

    #v-pills-library-programs .week-toggle-group,
    #v-pills-profile-section-training .week-toggle-group,
    #assisted-user-training-calendar .week-toggle-group {
        display: none;
    }

    /* Profile-only */
    #v-pills-profile-section-training .training-menu-toggle {
        margin: 0 auto;
        display: flex !important;
        justify-content: right;
        width: 100%;
    }

    #v-pills-profile-section-training
        .training-calendar-day:hover
        .training-menu-toggle {
        display: flex !important;
    }

    #v-pills-profile-section-training #calendarWrapper {
        overflow-y: scroll;
    }

    #v-pills-profile-section-training .training-calendar-copy-layout {
        display: none !important;
    }
}

/* ---------------------------
    MISC
--------------------------- */
@media (min-width: 768px) {
    .go_back_to_program {
        white-space: nowrap;
    }
}
