/* Переключатель видов */
.view-switcher {
    display: inline-flex;
    gap: 0.25rem;
    background: #F0F0F0;
    padding: 5px;
}
.view-switch-btn {
    background: transparent;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
}
.view-switch-btn:hover {
    background: #E0E0E0;
    color: #333;
}
.view-switch-btn.active {
    background: white;
    color: #60a5fa;
}

/* Календарь */
.schedule-view--calendar {
    background: white;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}
.calendar-container {
    max-width: 100%;
    overflow-x: auto;
    user-select: none;
}
.calendar-year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 1.5rem;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 1200px) {
    .calendar-year-grid {
        max-width: 100%;
    }
}

/* Блок управления количеством колонок */
.calendar-columns-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
/* Селектор количества колонок */
.calendar-columns-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: 10px
}
.calendar-columns-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.calendar-columns-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #777;
    user-select: none;
    box-sizing: border-box;
    position: relative;
}
.calendar-columns-label:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}
.calendar-columns-radio:checked + .calendar-columns-label {
    background: transparent;
    border: 2px solid #4b5563;
}
.calendar-columns-radio:focus + .calendar-columns-label {
    outline: none;
}
.calendar-month-wrapper {
    background: #FFF;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    content-visibility: auto;
    contain-intrinsic-size: auto 280px;
}
.calendar-month-title {
    font-size: 1rem;
    font-weight: 600;
    color: #777;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #CCC;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    padding-right: 1px;
}
.calendar-month-title:hover{
    color: #000;
}
.calendar-month-title-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Кнопки переключения месяца (модалка выбора дат и др.) */
.calendar-month-nav-prev,
.calendar-month-nav-next {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: #374151;
}
.calendar-month-nav-prev:hover,
.calendar-month-nav-next:hover {
    background: #e8e8e8;
    border-color: #ccc;
}
.calendar-month-price {
    position: relative;
    font-size: 14px;
    font-weight: 600;
    color: #000;
    height: 30px;
    line-height: 30px;
    vertical-align: middle;
    white-space: nowrap;
    background: transparent;
    padding: 0 10px 0 25px;
    border: 1px dashed #CCC;
    box-sizing: border-box;
    flex: 0 1 auto;
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 1px;
}
.calendar-month-price::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    background: transparent;
    border: #CCC solid 1px;
    border-radius: 50%;
}
.calendar-month-price-btn {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px 0 25px;
    border: 1px solid #e0e0e0;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.calendar-month-price-btn::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    background: transparent;
    border: #CCC solid 1px;
    border-radius: 50%;
}
.calendar-month-price-btn:hover {
    /*background: #f0f0f0;*/
    border-color: #888;
    color: #555;
}
.calendar-month-price-btn.has-price {
    background: transparent;
    font-weight: 600;
    border: 1px dashed #CCC;
    position: relative;
    font-size: 14px;
    color: #000;
}
.calendar-month-price-btn.has-price:hover {
    border: 1px dashed #444;
}

/* Popover для ввода цены */
.calendar-price-popover {
    position: absolute;
    z-index: 10000;
    background: #FFF;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    padding: 14px 16px;
    min-width: 220px;
    box-sizing: border-box;
}
.calendar-price-popover-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}
.calendar-price-popover-input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    font-size: 15px;
    font-weight: 500;
    text-align: right;
    box-sizing: border-box;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}
.calendar-price-popover-input::-webkit-outer-spin-button,
.calendar-price-popover-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ─── Schedule modal: scroll on black screen, not inside white card ─────────── */
#schedule-modal.schedule-modal {
    overflow: hidden;
}

#schedule-modal .schedule-modal-overlay {
    overflow-y: auto;
    padding: 2rem 0;
}

#schedule-modal .schedule-modal-content {
    max-height: none;
    overflow: visible;
    margin: 0 auto;
}

/* Datepicker dropdown should be above schedule modal content */
#schedule-modal .date-picker-dropdown {
    z-index: 100200;
}

/* Одна строка с двумя датами — равная ширина полей */
#schedule-modal .schedule-modal-body .schedule-modal-dates-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 1rem;
}

#schedule-modal .schedule-modal-body .schedule-modal-dates-row label {
    width: 100%;
    min-width: 0;
}

#schedule-modal .schedule-modal-body .schedule-modal-dates-row .date-calendar-input-wrapper,
#schedule-modal .schedule-modal-body .schedule-modal-dates-row input {
    width: 100%;
}
.calendar-price-popover-input:focus {
    outline: none;
    border-color: #4A90E2;
}
.calendar-price-popover-input::placeholder {
    color: #aaa;
    font-weight: 400;
    font-size: 13px;
}
.calendar-price-popover-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.calendar-price-popover-save {
    flex: 1;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #4A90E2;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.calendar-price-popover-save:hover {
    background: #357abd;
}
.calendar-price-popover-clear {
    height: 32px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #777;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.calendar-price-popover-clear:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-columns-control {
        margin-left: 0;
        margin-top: 0.5rem;
        justify-content: flex-start;
    }
}
.calendar-filters {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    padding-top: 4px;
}
.calendar-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.calendar-filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}
.calendar-filter-select {
    height: 40px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    font-size: 0.875rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}
#calendar-year-selector {
    height: 35px;
    padding: 0 10px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
    max-width: 100%;
    overflow: hidden;
}
.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.65rem;
    color: #777;
    padding: 0.2rem;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.calendar-day {
    aspect-ratio: 1;
    padding: 0.15rem;
    cursor: pointer;
    position: relative;
    background: #F0F0F0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 32px;
    opacity: 0.6;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    contain: layout style paint;
}
.calendar-day:hover:not(.other-month):not(.past) {
    border-color: #4b5563;
    z-index: 1;
    opacity: 1;
}
.calendar-day.selecting:not(.other-month) .calendar-day-number {
    color: #6b7280;
    font-weight: 700;
}
.calendar-day.selecting:not(.other-month) {
    background: #e0e7ff !important;
    border-color: #6b7280 !important;
    opacity: 1 !important;
}
.calendar-day.selected:not(.other-month) .calendar-day-number {
    color: #6366f1;
    font-weight: 700;
}
.calendar-day.selected:not(.other-month) {
    background: #c7d2fe !important;
    opacity: 1 !important;
}

/* Панель подсказок на странице расписания всегда видна */
#category-reference-panel.category-reference-panel--open {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.calendar-day.filtered-out {
    background: white !important;
    border-color: #e9ecef !important;
    opacity: 0.3 !important;
}
.calendar-day.filtered-out .calendar-day-number {
    color: #ccc !important;
}
.calendar-day.filtered-out .calendar-day-info {
    display: none;
}
/* Контекстное меню календаря использует общие стили .context-menu из account/details.css */
.calendar-day.today:not(.other-month) {
    border: #000 dashed 1px;
}
.calendar-day.today:not(.other-month) > .calendar-day-number {
    color: #000 !important;
}
.calendar-day.today .calendar-day-number {
    color: #6b7280;
    font-weight: 700;
}
.calendar-day.free:not(.selected) {
    background: #bfe3ca;
}
.calendar-day.occupied {
    background: #ffbdbd;
}
/* Забронировано — подтверждённое бронирование */
.calendar-day.reserved {
    background: #faecb6;
    cursor: not-allowed !important;
}
.calendar-day.past-day {
    opacity: 0.4;
    cursor: default !important;
}
.calendar-day.disabled-boundary {
    color: #b0b0b0 !important;
    background: #f0f0f0 !important;
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
    user-select: none;
}
.calendar-day.booking {
    background: #faecb6;
}
.calendar-day.auction:not(.other-month) {
    background: #dbeafe;
    border-color: #60a5fa;
}
.calendar-day.maintenance:not(.other-month) {
    background: #ccd0d5;
}
/* Резерв — зарезервировано, но ещё не подтверждено */
.calendar-day.reserve:not(.other-month) {
    background: #e9d5ff;
    border-color: #c084fc;
}
.calendar-day.other-month {
    color: #989898 !important;
    background: #DDD !important;
    opacity: 0.5 !important;
}
/* Прошедшие дни (модалка выбора дат и др.) */
.calendar-day.past {
    color: #999 !important;
    background: #eee !important;
    cursor: default;
    opacity: 0.7;
}
/* Выбор диапазона дат (модалка корзины) */
.calendar-day.range-start:not(.other-month),
.calendar-day.range-end:not(.other-month),
.calendar-day.range-between:not(.other-month) {
    background: #c7d2fe !important;
    color: #3730a3 !important;
    opacity: 1 !important;
}
.calendar-day.range-start .calendar-day-number,
.calendar-day.range-end .calendar-day-number,
.calendar-day.range-between .calendar-day-number {
    color: #3730a3 !important;
    font-weight: 600;
}
.calendar-day-number {
    font-size: 0.7rem;
    margin-bottom: 1px;
    font-weight: 600;
    line-height: 1.1;
}
.calendar-day-info {
    font-size: 0.55rem;
    color: #777;
    line-height: 1.1;
    margin-top: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calendar-day-info .side {
    font-weight: 600;
    display: block;
}
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}
.calendar-legend--filters {
    padding-top: 0;
    border-top: none;
    gap: 10px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #777;
}

.legend-filter-item {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.legend-filter-item:hover {
    background: #f3f4f6;
}

/* Кастомные стили для чекбоксов фильтров */
.calendar-legend--filters .legend-checkbox-wrapper {
    background: transparent;
    border: #CCC solid 1px;
    transition: background 0.25s ease-in-out, border 0.25s ease-in-out;
}

/* Free - зеленый */
.calendar-legend--filters .legend-checkbox-free {
    background: #f0fdf4;
    border-color: #86efac;
}
.calendar-legend--filters .form_group.checkbox > input[type=checkbox]:checked ~ .legend-checkbox-free {
    background: #f0fdf4;
    border-color: #22c55e;
}

/* Occupied - красный */
.calendar-legend--filters .legend-checkbox-occupied {
    background: #fee2e2;
    border-color: #fca5a5;
}
.calendar-legend--filters .form_group.checkbox > input[type=checkbox]:checked ~ .legend-checkbox-occupied {
    background: #fee2e2;
    border-color: #ef4444;
}

/* Booking - желтый */
.calendar-legend--filters .legend-checkbox-booking {
    background: #fef3c7;
    border-color: #fcd34d;
}
.calendar-legend--filters .form_group.checkbox > input[type=checkbox]:checked ~ .legend-checkbox-booking {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* Auction - голубой */
.calendar-legend--filters .legend-checkbox-auction {
    background: #dbeafe;
    border-color: #60a5fa;
}
.calendar-legend--filters .form_group.checkbox > input[type=checkbox]:checked ~ .legend-checkbox-auction {
    background: #dbeafe;
    border-color: #3b82f6;
}

/* Maintenance - серый */
.calendar-legend--filters .legend-checkbox-maintenance {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.calendar-legend--filters .form_group.checkbox > input[type=checkbox]:checked ~ .legend-checkbox-maintenance {
    background: #f3f4f6;
    border-color: #6b7280;
}

/* Стили для панели подсказок на странице расписания */
#category-reference-panel.category-reference-panel--open:not(.category-reference-panel--has-active) .category-hint {
    display: block;
}
#category-reference-panel.category-reference-panel--open .category-reference-item {
    display: block;
}

/* Отключенные стороны в фильтре */
.calendar-filter-group .side-label--disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.calendar-filter-group .side-checkbox:disabled + .side-label {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Исправляем обрезку outline при фокусе */
.calendar-filter-group .side-checkbox:focus + .side-label {
    outline: none !important;
    box-shadow: 0 0 0 2px var(--text), 0 0 0 4px transparent;
    animation: focusBoxShadowFade 0.5s ease-out forwards;
}

@keyframes focusBoxShadowFade {
    0% {
        box-shadow: 0 0 0 2px var(--text), 0 0 0 4px transparent;
    }
    100% {
        box-shadow: none;
    }
}

/* Кнопка "Добавить расписание" */
.add-schedule {
    background: transparent;
    border: #CCC dashed 1px;
    color: #777;
}
.add-schedule:hover {
    border: #000 dashed 1px;
    color: #000;
}
.add-schedule.has-selection {
    background: #ff6c37;
    border: #ff6c37 solid 1px;
    color: white !important;
}
.add-schedule.has-selection:hover {
    opacity: 0.9;
}

/* Легенда цветов в панели подсказок */
.calendar-color-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.calendar-color-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.calendar-color-legend-color {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 2px;
}
.calendar-color-legend-label {
    flex: 1;
    line-height: 1.5;
    font-size: 0.8rem;
    color: var(--text-light);
}
.calendar-color-legend-label strong {
    color: #111;
    font-size: 12px;
}
.category-reference-panel{
    max-height: none;
}
