/* Юстихаб Календарь — 390×844, UI по .cursor/rules/UI СТАНДАРТЫ ИНТЕРФЕЙСОВ.mdc */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #000000;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

/* Целевой размер 390×844 (вертикальный формат) */
.app {
    width: 100%;
    max-width: 390px;
    min-height: 100vh;
    min-height: 844px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #000000;
}

/* Шапка — стеклянный эффект, логотип слева, аватар справа */
.header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 12px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10;
}

.header__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header__logo {
    height: 22px;
    width: auto;
    display: block;
}

.header__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.9);
}

.header__avatar-area {
    position: relative;
}

.header__avatar-wrap {
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: block;
}

.header__avatar-wrap:hover {
    background: rgba(255, 255, 255, 0.15);
}

.header__avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.header__avatar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 12px 16px 10px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 20;
}

.header__avatar-menu[hidden] {
    display: none;
}

.header__avatar-menu-name {
    padding: 0 0 12px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.header__logout-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease-out;
}

.header__logout-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Основной контент */
.main {
    flex: 1;
    padding: 20px 20px 24px;
    overflow-y: auto;
}

/* Переключатель вида: Календарь / Список */
.view-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: rgb(16, 16, 21);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.view-toggle__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease-out, color 0.2s ease-out;
}

.view-toggle__btn .view-toggle__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.45);
    transition: color 0.2s ease-out;
}

.view-toggle__btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.view-toggle__btn:hover .view-toggle__icon {
    color: rgba(255, 255, 255, 0.65);
}

.view-toggle__btn--active {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
}

.view-toggle__btn--active .view-toggle__icon {
    color: rgba(255, 255, 255, 0.6);
}

/* Режим списка записей */
.list-view {
    padding: 0;
}

.list-view__title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.list-view__content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.list-view__day {
    background: rgb(16, 16, 21);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
}

.list-view__day-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.list-view__slots {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.list-view__slot {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    font-size: 14px;
    color: #fff;
    background: #0071e3;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease-out;
}

.list-view__slot:hover,
.list-view__slot:focus {
    background: #0077ed;
    outline: none;
}

.list-view__empty {
    margin: 0;
    padding: 24px 16px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    background: rgb(16, 16, 21);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Календарь */
.calendar {
    background: rgb(16, 16, 21);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 18px 16px 20px;
}

.calendar__month {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 16px;
}

.calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 10px;
}

.calendar__weekday {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 6px 0;
}

.calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendar__day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 4px;
    transition: background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out;
}

.calendar__day-num {
    line-height: 1;
}

/* Ряд кружков-слотов под числом: синий = свободный, зелёный = занятый */
.calendar__day-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2px;
    max-width: 100%;
}

.calendar__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    flex-shrink: 0;
}

.calendar__dot--free {
    background: rgba(255, 255, 255, 0.35);
}

.calendar__dot--busy {
    background: #0071e3;
}

/* Выходные — бледно-красные неактивные блоки, слотов не показываем */
.calendar__day--weekend {
    background: rgba(234, 67, 53, 0.06);
    border-color: rgba(234, 67, 53, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

.calendar__day--empty {
    background: transparent;
    border-color: transparent;
    color: transparent;
    pointer-events: none;
}

/* Прошедшие даты — неактивный вид */
.calendar__day--past {
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

/* Текущий день — только обводка фиолетовым, без заливки */
.calendar__day--today {
    background: transparent;
    border: 1px solid #8b5cf6;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* Выбранный активный день (клик) */
.calendar__day--selected {
    background: rgba(0, 113, 227, 0.15);
    border-color: #0071e3;
    font-weight: 600;
}

.calendar__day--selected.calendar__day--today {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
}

/* Активные ячейки — курсор и возможность фокуса */
.calendar__day:not(.calendar__day--empty):not(.calendar__day--past) {
    cursor: pointer;
}

.calendar__day:not(.calendar__day--empty):not(.calendar__day--past):not(.calendar__day--selected):active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

@media (hover: hover) {
    .calendar__day:not(.calendar__day--empty):not(.calendar__day--past):not(.calendar__day--selected):hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* Блок слотов на выбранный день — сетка по часам (8:00–21:00), как в Google Calendar */
.day-slots {
    margin-top: 20px;
    padding: 18px 16px 20px;
    background: rgb(16, 16, 21);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.day-slots__title {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.day-slots__empty {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

/* Сетка дня в одну колонку: время слева у линии начала часа, блок справа. Только горизонтальные линии между часами. */
.day-slots__list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-radius: 12px;
    overflow: hidden;
}

.day-slots__hour {
    display: grid;
    grid-template-columns: 52px 1fr;
    align-items: stretch;
    gap: 0;
    min-height: 44px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.day-slots__hour:first-child {
    border-top: none;
}

.day-slots__time {
    display: flex;
    align-items: flex-start;
    padding: 4px 10px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
}

.day-slots__block {
    min-height: 44px;
    background: transparent;
    border-radius: 10px;
}

.day-slots__block--empty {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
}

.day-slots__add {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: background 0.2s ease-out, color 0.2s ease-out;
}

.day-slots__add:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.day-slots__block--free {
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
}

.day-slots__free-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

.day-slots__delete {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.2s ease-out, color 0.2s ease-out;
}

.day-slots__delete:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.day-slots__block--busy {
    background: #0071e3;
    display: flex;
    align-items: center;
    padding: 0 10px;
    cursor: grab;
    transition: opacity 0.2s ease-out;
}

.day-slots__block--busy:active {
    opacity: 0.9;
}

.day-slots__client {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

/* Перетаскивание занятых слотов: призрак и зона сброса */
body.day-slots-dragging {
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.day-slots__ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    pointer-events: none;
    margin: 0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0.95;
    background: #0071e3;
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
}

.day-slots__hour--drop-target .day-slots__block {
    outline: 2px dashed rgba(0, 113, 227, 0.8);
    outline-offset: 2px;
    background: rgba(0, 113, 227, 0.12);
    border-radius: 10px;
}

body.day-slots-dragging .day-slots__block--busy {
    cursor: grabbing;
}

/* Карточка записи (при клике на занятый слот) */
.booking-card-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.booking-card {
    width: 100%;
    max-width: 360px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 20px 24px 24px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.booking-card__title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.booking-card__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.booking-card__row {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.booking-card__label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
}

.booking-card__value {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
}

.cancel-confirm__text,
.move-booking-modal .booking-card__body > .cancel-confirm__text {
    margin: 0 0 16px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.45;
}

.move-booking-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.move-booking-form__label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.move-booking-form__select {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    color: rgba(255, 255, 255, 0.9);
    background: rgb(26, 26, 35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.move-booking-form__select:hover,
.move-booking-form__select:focus {
    border-color: rgba(255, 255, 255, 0.25);
    outline: none;
}

.booking-card__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.booking-card__btn {
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease-out;
    border: none;
}

.booking-card__btn--secondary {
    background: rgb(16, 16, 21);
    color: rgba(255, 255, 255, 0.9);
}

.booking-card__btn--secondary:hover {
    background: rgb(26, 26, 35);
}

.booking-card__btn--danger {
    background: #ea4335;
    color: #fff;
}

.booking-card__btn--danger:hover {
    background: #f04a3b;
}

.booking-card__btn--primary {
    background: #0071e3;
    color: #fff;
}

.booking-card__btn--primary:hover {
    background: #0077ed;
}
