/* Стили для страницы Расписание */
.schedule-container {
    padding: 20px;
    overflow-x: auto;
}

.schedule-table {
    display: grid;
    grid-template-columns: 80px repeat(auto-fit, minmax(120px, 1fr));
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.schedule-row {
    display: contents;
}

.schedule-header {
    background-color: #f8f9fa;
    font-weight: bold;
}

.schedule-time {
    grid-column: 1;
    padding: 10px;
    text-align: center;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9em;
    color: #333;
    background-color: #f8f9fa;
    position: sticky;
    left: 0;
    z-index: 1;
}

.schedule-cell {
    position: relative;
    padding: 2px;
    min-height: 40px;
    display: grid;
    align-content: start;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.schedule-class {
    background-color: #e9ecef;
    border-radius: 4px;
    padding: 8px;
    margin: 2px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    overflow: hidden;
    text-align: center;
    min-height: calc(40px - 4px);
}

.schedule-class small {
    font-size: 0.7em;
    color: #555;
}

.schedule-class:hover {
    background-color: #dee2e6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.schedule-group {
    background-color: #d4edda;
}

.schedule-individual {
    background-color: #d1ecf1;
}

.schedule-special {
    background-color: #fff3cd;
}

.schedule-view-btn,
.schedule-add-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin: 0 5px;
}

.schedule-view-btn:hover,
.schedule-add-btn:hover {
    background-color: #0056b3;
}

.schedule-view-btn.active {
    background-color: #0056b3;
    font-weight: bold;
}

.schedule-date-input,
.filter-select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    margin-right: 10px;
}

.schedule-modal,
.attendance-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.schedule-modal-content,
.attendance-modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.schedule-modal-content h2,
.attendance-modal-content h2 {
    margin: 10px 0 15px;
    font-size: 1.5em;
    color: #333;
}

.schedule-modal-content p,
.attendance-modal-content p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #666;
}

.schedule-modal-content input,
.schedule-modal-content select,
.attendance-modal-content input,
.attendance-modal-content select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

.schedule-modal-content select[multiple] {
    height: 80px;
}

.attendance-modal-content .attendance-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.attendance-modal-content .attendance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.attendance-modal-content .attendance-item span {
    font-size: 0.9em;
    color: #333;
}

.attendance-modal-content .attendance-select {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    background-color: #fff;
    cursor: pointer;
}

.attendance-modal-content .attendance-select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.schedule-modal-actions,
.attendance-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.schedule-modal-actions button,
.attendance-modal-actions button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.schedule-modal-actions button[id="schedule-save-btn"],
.attendance-modal-actions button[id="attendance-save-btn"] {
    background-color: #007bff;
    color: white;
}

.schedule-modal-actions button[id="schedule-save-btn"]:hover,
.attendance-modal-actions button[id="attendance-save-btn"]:hover {
    background-color: #0056b3;
}

.schedule-modal-actions button[id="schedule-delete-btn"] {
    background-color: #dc3545;
    color: white;
}

.schedule-modal-actions button[id="schedule-delete-btn"]:hover {
    background-color: #b02a37;
}

.schedule-modal-actions button[id="schedule-cancel-btn"],
.schedule-modal-actions button[id="schedule-close-btn"],
.attendance-modal-actions button[id="attendance-cancel-btn"] {
    background-color: #6c757d;
    color: white;
}

.schedule-modal-actions button[id="schedule-cancel-btn"]:hover,
.schedule-modal-actions button[id="schedule-close-btn"]:hover,
.attendance-modal-actions button[id="attendance-cancel-btn"]:hover {
    background-color: #5a6268;
}

.days-of-week {
    margin-bottom: 15px;
}

.days-of-week label {
    font-size: 0.9em;
    margin-bottom: 5px;
    display: block;
    color: #333;
}

.days-of-week-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.day-button {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-size: 0.85em;
}

.day-button.selected {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.day-button:hover {
    background: #e0e0e0;
}

.day-button.selected:hover {
    background: #0056b3;
}

/* Новые стили для журнала */
.journal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.journal-modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    text-align: left;
    max-height: 90vh;
    overflow-y: auto;
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.journal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #333;
}

#journal-back-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    color: #007bff;
    cursor: pointer;
    transition: color 0.2s;
}

#journal-back-btn:hover {
    color: #0056b3;
}

.journal-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.journal-controls input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

.journal-controls button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.journal-controls button:hover {
    background-color: #0056b3;
}

.journal-table {
    width: 100%;
    border-collapse: collapse;
}

.journal-table th,
.journal-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

.journal-table th {
    color: #333;
    font-weight: 600;
    text-align: left;
}

.journal-table td {
    color: #666;
}

.journal-table select {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    background-color: #fff;
    cursor: pointer;
}

.journal-table select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.journal-modal-content .journal-actions {
    margin-top: 15px;
    text-align: right;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#journal-save-btn,
#journal-close-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

#journal-save-btn {
    background-color: #007bff;
    color: white;
}

#journal-save-btn:hover {
    background-color: #0056b3;
}

#journal-close-btn {
    background-color: #6c757d;
    color: white;
}

#journal-close-btn:hover {
    background-color: #5a6268;
}

/* Стили для клиент-пикера */
.client-picker,
.inline-client-picker {
    margin-bottom: 15px;
}

.client-picker label,
.inline-client-picker label {
    font-size: 0.9em;
    color: #333;
    display: block;
    margin-bottom: 5px;
}

.client-search-container {
    position: relative;
}

.client-picker input,
.inline-client-picker input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

.client-results,
.picker-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 300px;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    z-index: 10;
}

.client-results.visible,
.picker-results.visible {
    display: block;
}

.client-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.client-checkbox-item:last-child {
    border-bottom: none;
}

.client-checkbox-item:hover {
    background-color: #f8f9fa;
}

.client-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.client-checkbox-item input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.client-checkbox-item .client-phone {
    font-size: 0.8em;
    color: #666;
}

.client-selected,
.picker-selected {
    margin-top: 10px;
}

.client-selected label,
.picker-selected label {
    font-size: 0.9em;
    color: #333;
}

.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 34px;
}

.client-chip {
    padding: 4px 8px;
    border-radius: 12px;
    background: #e7f0ff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
}

.client-remove-btn,
.picker-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
}

.client-remove-btn:hover,
.picker-remove:hover {
    color: #b02a37;
}

@media (max-width: 768px) {
    .schedule-table {
        grid-template-columns: 50px repeat(auto-fit, minmax(80px, 1fr));
        font-size: 0.9em;
    }

    .schedule-container {
        background: linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent 30px, transparent calc(100% - 30px), rgba(0, 0, 0, 0.1));
    }

    .schedule-time {
        position: static;
        background-color: #f8f9fa;
        z-index: 0;
        min-width: 50px;
        flex-shrink: 0;
        font-size: 1em;
        padding: 8px;
    }

    .schedule-cell {
        min-height: 40px;
        min-width: 80px;
        flex-shrink: 0;
        padding: 6px;
    }

    .schedule-class {
        min-height: 40px;
        font-size: 0.85em;
        padding: 6px;
    }

    .schedule-class small {
        font-size: 0.75em;
    }

    .filter-select,
    .schedule-date-input {
        width: 100%;
        margin-bottom: 10px;
    }

    .schedule-modal-content,
    .journal-modal-content,
    .attendance-modal-content {
        max-height: 80vh;
        overflow-y: auto;
        padding: 10px;
        width: 95%;
    }

    .journal-table th,
    .journal-table td {
        font-size: 0.85em;
        padding: 6px;
    }

    .journal-controls {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .journal-controls button {
        width: 100%;
        padding: 10px;
        font-size: 1em;
    }

    .client-results,
    .picker-results {
        width: 100%;
        max-height: 120px;
    }

    .schedule-modal-actions,
    .attendance-modal-actions,
    .journal-actions {
        gap: 12px;
    }

    .days-of-week-buttons {
        gap: 8px;
    }

    .day-button {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}