/* === Расписание === */

/* Навигация по неделям */
.week-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

#weekRange {
    font-weight: 600;
    font-size: 16px;
    min-width: 200px;
    text-align: center;
}

/* Вкладки дней недели */
.weekday-tabs {
    display: flex;
    gap: 5px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.weekday-tab {
    flex: 1;
    min-width: 120px;
    padding: 12px 8px;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.weekday-tab:hover {
    background: #f5f5f5;
}

.weekday-tab.active {
    background: var(--coral);
    color: white;
    border-color: var(--coral);
}

.weekday-tab .tab-name {
    font-weight: 600;
    font-size: 14px;
}

.weekday-tab .tab-date {
    font-size: 12px;
    opacity: 0.8;
}

/* Индикация на вкладках */
.weekday-tab.has-cancel {
    animation: blink-red 1s infinite;
}

.weekday-tab.has-reschedule {
    animation: blink-orange 1s infinite;
}

@keyframes blink-red {
    0%, 100% { background: #ffcdd2; border-color: #f44336; }
    50% { background: #f44336; color: white; border-color: #d32f2f; }
}

@keyframes blink-orange {
    0%, 100% { background: #ffe0b2; border-color: #ff9800; }
    50% { background: #ff9800; color: white; border-color: #f57c00; }
}

/* Таблицы филиалов */
.schedule-wrapper {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.branch-table {
    flex: 1;
    min-width: 450px;
}

.branch-table h3 {
    text-align: center;
    background: var(--coral);
    color: white;
    padding: 12px;
    margin: 0;
    border-radius: 8px 8px 0 0;
    font-size: 16px;
}

.branch-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.branch-table th,
.branch-table td {
    border: 1px solid #ddd;
    padding: 2px;
    text-align: center;
    height: 55px;
    vertical-align: middle;
    position: relative;
}

.branch-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    height: 40px;
}

.branch-table th:first-child,
.branch-table td:first-child {
    width: 55px;
    min-width: 55px;
}

.branch-table .time-cell {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
}

/* Ячейка с занятием */
.session-cell {
    background: #e3f2fd;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.session-cell:hover {
    background: #bbdefb;
    box-shadow: inset 0 0 0 2px var(--coral);
}

/* Содержимое ячейки */
.cell-content {
    display: flex;
    flex-direction: column;
    font-size: 10px;
    line-height: 1.2;
    padding: 2px;
    height: 100%;
}

.cell-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.cell-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    opacity: 0.5;
}

.cell-menu-btn:hover {
    opacity: 1;
}

.cell-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.cell-client {
    font-weight: 600;
    color: #1565c0;
    margin-top: 2px;
}

.cell-employee {
    color: #666;
}

/* Перечеркнутый текст для изменений */
.cell-original {
    text-decoration: line-through;
    color: #999;
    font-size: 9px;
}

.cell-new {
    color: #2e7d32;
    font-weight: 600;
}

/* Метки типа занятия */
.cell-badge {
    font-size: 8px;
    padding: 1px 3px;
    border-radius: 3px;
    margin-top: 2px;
}

.cell-badge.extra { background: #e1bee7; color: #7b1fa2; }
.cell-badge.makeup { background: #fff9c4; color: #f57f17; }
.cell-badge.diagnostic { background: #b2dfdb; color: #00695c; }

/* Цветовая индикация статусов */
.session-cell.cancelled {
    background: #ffcdd2 !important;
}

.session-cell.cancelled .cell-client,
.session-cell.cancelled .cell-employee {
    text-decoration: line-through;
    color: #999;
}

.session-cell.pending-cancel {
    background: #ffcdd2 !important;
    animation: pulse-red 2s infinite;
}

.session-cell.pending-reschedule {
    background: #ffe0b2 !important;
    animation: pulse-orange 2s infinite;
}

@keyframes pulse-red {
    0%, 100% { background: #ffcdd2; }
    50% { background: #ef9a9a; }
}

@keyframes pulse-orange {
    0%, 100% { background: #ffe0b2; }
    50% { background: #ffcc80; }
}

/* Пустая ячейка */
.empty-cell {
    cursor: pointer;
    transition: background 0.15s;
}

.empty-cell:hover {
    background: #e8f5e9;
}

/* Меню ячейки */
.cell-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.cell-menu__content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    min-width: 350px;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.cell-menu__content h4 {
    margin: 0 0 15px;
    color: var(--coral);
    font-size: 18px;
    border-bottom: 2px solid var(--coral);
    padding-bottom: 10px;
}

#cellMenuInfo p {
    margin: 6px 0;
    font-size: 14px;
}

.cell-menu__buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.cell-menu__buttons .btn {
    width: 100%;
    text-align: left;
    padding: 12px 15px;
}

/* Подменю отмены */
.cancel-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.cancel-options .btn-block {
    padding: 20px;
    text-align: center;
}

.cancel-options small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    opacity: 0.8;
}

/* Информация о ячейке */
.session-cell-info {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 13px;
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.autocomplete-item:hover {
    background: #f5f5f5;
}

/* ============================================ */
/* ФИКС: Фиксированная ширина ячеек             */
/* ============================================ */
.schedule-table {
    table-layout: fixed;
    width: 100%;
}

.schedule-table th,
.schedule-table td {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-table .time-cell {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
}

.cell-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #28a745;
}

.session-cell.completed {
    background: #e8f5e9 !important;
    border-left: 4px solid #4caf50;
}
.cell-badge.tomatis { background: #bbdefb; color: #1565c0; }
.cell-badge.intime { background: #c8e6c9; color: #2e7d32; }
.cell-badge.bak { background: #ffe0b2; color: #e65100; }

/* Томатис - ячейка на 2 слота */
.session-cell[rowspan="2"] {
    height: auto;
    min-height: 120px;
    vertical-align: top;
}

.session-cell[rowspan="2"] .cell-content {
    height: 100%;
    min-height: 110px;
}

.session-cell[rowspan="2"] .cell-badge.tomatis {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    font-weight: bold;
}
