/* Стили для мобильной версии расписания */

/* По умолчанию скрываем мобильную версию на десктопе */
.mobile-only {
    display: none;
}

/* Навигация между расписаниями (только мобильная версия) */
.schedule-nav {
    display: none;
}

/* На мобильных устройствах показываем мобильную версию и скрываем десктопную */
@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
        padding: 5px;
    }

    .schedule-nav {
        display: flex;
        gap: 10px;
        margin-bottom: 15px;
        padding: 0 5px;
        text-decoration: none !important;
    }

    .schedule-nav-btn {
        flex: 1;
        display: block;
        padding: 10px 15px;
        text-align: center;
        background: #28ac23;
        color: white;
        text-decoration: none;
        border-radius: 4px;
        font-weight: bold;
        transition: background 0.3s ease;
    }

    .schedule-nav-btn:hover {
        background: #45a049;
    }
}

/* Плавающая кнопка переключения версии */
.version-toggle-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #28a745;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.2s;
}

.version-toggle-btn:active {
    transform: scale(0.95);
}

.version-toggle-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.version-toggle-btn.desktop-mode {
    background: #28a745;
    width: 70px;
    height: 70px;
    bottom: 30px;
    left: 30px;
}

.version-toggle-btn.desktop-mode svg {
    width: 32px;
    height: 32px;
}

body.is-mobile-device .version-toggle-btn {
    display: flex;
}

/* Адаптация кнопки для ПК версии на мобильных устройствах */
/* Увеличиваем кнопку когда активирована ПК версия */
body.is-mobile-device .version-toggle-btn.desktop-mode {
    /* Увеличиваем кнопку для ПК версии на мобильном viewport */
    width: 220px;
    height: 220px;
    /* Позиционируем кнопку ниже, чтобы она не перекрывала мобильное меню */
    top: auto;
    bottom: 50px;
    left: 50px;
}

body.is-mobile-device .version-toggle-btn.desktop-mode svg {
    width: 120px;
    height: 120px;
}

/* Ограничение позиции кнопки для очень маленьких экранов */
@media (max-height: 500px) {
    body.is-mobile-device .version-toggle-btn.desktop-mode {
        bottom: 10px;
        left: 10px;
        width: 150px;
        height: 150px;
    }

    body.is-mobile-device .version-toggle-btn.desktop-mode svg {
        width: 80px;
        height: 80px;
    }
}

/* Радио-кнопки режима просмотра */
.radio-group {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 14px;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #28a745;
}

.radio-label span {
    white-space: nowrap;
}

/* Стили для заочной формы - режим "По кабинету" */
.mobile-schedule-table .room-header {
    background-color: #80FF80;
    text-align: center;
    font-weight: bold;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #000000;
    border-style: ridge;
}

/* Стили для чекбокса полного просмотра */
.mobile-full-view-controls {
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #28a745;
}

.checkbox-label span {
    white-space: nowrap;
}

/* Блок с полным расписанием в мобильном режиме */
#mobile-full-schedule {
    display: none;
    margin-top: 15px;
}

#mobile-full-schedule.active {
    display: block;
}

#mobile-full-schedule table.excel {
    font-size: 10px;
}

#mobile-full-schedule table.excel td {
    padding: 4px 2px;
}

/* Скрываем обычный контейнер при полном просмотре */
.mobile-controls.disabled {
    opacity: 0.5;
    pointer-events: none;
}

#mobile-schedule-container.disabled {
    display: none;
}

/* Контролы выбора на мобильных */
.mobile-controls {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-width: 100%;
    overflow: visible;
    position: relative;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
}

.control-group label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.control-group select {
    padding: 10px 35px 10px 12px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
    /* Фоновая стрелка */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    /* Перенос длинного текста */
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.control-group select:focus {
    outline: none;
    border-color: #28ac23;
    box-shadow: 0 0 5px rgba(0, 255, 55, 0.3);
}

.control-group select:disabled {
    background-color: #e8e8e8;
    cursor: not-allowed;
    opacity: 0.7;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* Input для поиска кабинета */
.control-group input[type="text"] {
    padding: 10px 12px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.control-group input[type="text"]:focus {
    outline: none;
    border-color: #28ac23;
    box-shadow: 0 0 5px rgba(40, 172, 35, 0.3);
}

.control-group input[type="text"]:disabled {
    background-color: #e8e8e8;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Кастомный select с поиском */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.custom-select-input {
    padding: 10px 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    padding-right: 50px; /* Место для кнопки */
}

.custom-select-input:focus {
    outline: none;
    border-color: #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.custom-select-input:disabled {
    background-color: #e8e8e8;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Кнопка поиска кабинета */
.room-search-btn {
    position: absolute;
    right: 8px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    padding: 0;
}

.room-search-btn:hover {
    background: #f0f0f0;
}

.room-search-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.room-search-btn:disabled:hover {
    background: transparent;
}

.room-search-btn svg {
    width: 24px;
    height: 24px;
    fill: #000000;
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    max-height: 250px;
    overflow-y: auto;
}

.custom-select-options.open {
    display: block;
}

.custom-select-list {
    width: 100%;
}

.custom-select-option {
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-option:hover {
    background: #f0f0f0;
}

.custom-select-option.selected {
    background: #e0e0e0;
    color: #333;
}

.custom-select-option.hidden {
    display: none;
}

/* Опции в select */
.control-group select option {
    font-size: 14px;
    padding: 8px;
    max-width: 100%;
    /* Для мобильных браузеров */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Контейнер для длинных названий в шапке таблицы */
.mobile-schedule-table .department-header,
.mobile-schedule-table .group-header {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.no-schedule {
    padding: 40px 20px;
    text-align: center;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
    border: 1px solid #ddd;
    margin: 10px 0;
}

/* Стили для мобильной таблицы расписания - как в десктоп версии */
.mobile-schedule-table {
    width: 100%;
    border-collapse: collapse !important;
    font-family: 'Times New Roman', sans-serif;
    font-size: 14px;
    border-style: ridge;
    border-width: 1px;
    border-radius: 0;
    margin-bottom: 5px;
}

.mobile-schedule-table td {
    border: 1px solid #000000;
    padding: 8px 5px;
    vertical-align: middle;
    border-style: ridge;
}

.mobile-schedule-table .time-header {
    background-color: #FFFF00;
    font-weight: bold;
    text-align: center;
    font-size: 13px;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .time-header:nth-child(1) {
    width: 5%;
}
.mobile-schedule-table .time-header:nth-child(2) {
    width: 15%;
}
.mobile-schedule-table .time-header:nth-child(3) {
    width: 60%;
}
.mobile-schedule-table .time-header:nth-child(4) {
    width: 20%;
}

.mobile-schedule-table .lesson-number {
    font-weight: bold;
    background-color: #f0f0f0;
    width: 5%;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .lesson-number p{
    text-align: center !important;
}

.mobile-schedule-table .lesson-time {
    border: 1px solid #000000;
    border-style: ridge;
    background-color: #FFFF00;
    text-align: center;
    width: 15%;
}

.mobile-schedule-table .subject-cell {
    border: 1px solid #000000;
    border-style: ridge;
    text-align: center;
    padding-left: 10px;
      width: 60%;
}

.mobile-schedule-table .room-cell {
    border: 1px solid #000000;
    border-style: ridge;
    text-align: center;
     width: 20%;
}

.mobile-schedule-table .lunch-cell {
    background-color: #FFCC00;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .department-header {
    background-color: #00CCFF;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .group-header {
    background-color: #FF8080;
    text-align: center;
    font-weight: bold;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .room-header {
    background-color: #80FF80;
    text-align: center;
    font-weight: bold;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .department-header-small {
    background-color: #00CCFF;
    text-align: center;
    font-weight: bold;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .separator-cell {
    background-color: #f0f0f0;
    padding: 3px;
    border: 1px solid #000000;
    border-style: ridge;
    height: 5px;
}

.mobile-schedule-table .date-header {
    background-color: #CCFFCC;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    font-size: 18px;
    border: 1px solid #000000;
    border-style: ridge;
}

.mobile-schedule-table .footer-note {
    background-color: #f0f0f0;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    border: 1px solid #000000;
    border-style: ridge;
}

/* === Стили для таблицы курсов (пропорции: 10% 20% 30% 30%) === */
.mobile-schedule-table.courses-table .lesson-number-header {
    background-color: #00CCFF;
    font-weight: bold;
    text-align: center;
    font-size: 14px;
    width: 10%;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 6px 4px;
}

.mobile-schedule-table.courses-table .time-header {
    background-color: #00CCFF;
    font-weight: bold;
    text-align: center;
    font-size: 13px;
    width: 20%;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 6px 4px;
}

.mobile-schedule-table.courses-table .subject-header {
    background-color: #00CCFF;
    font-weight: bold;
    text-align: center;
    font-size: 14px;
    width: 35%;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 6px 4px;
}

.mobile-schedule-table.courses-table .room-header {
    background-color: #00CCFF;
    font-weight: bold;
    text-align: center;
    font-size: 13px;
    width: 35%;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 6px 4px;
}

.mobile-schedule-table.courses-table .lesson-number {
    font-weight: bold;
    background-color: #f0f0f0;
    width: 10%;
    text-align: center;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 6px 4px;
}

.mobile-schedule-table.courses-table .lesson-number p {
    text-align: center !important;
    margin: 0;
}

.mobile-schedule-table.courses-table .lesson-time {
    background-color: #FFFF00;
    width: 20%;
    text-align: center;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 6px 4px;
    font-size: 12px;
}

.mobile-schedule-table.courses-table .subject-cell {
    width: 35%;
    text-align: left;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 8px 6px;
    font-size: 14px;
}

.mobile-schedule-table.courses-table .room-cell {
    width: 35%;
    text-align: center;
    border: 1px solid #000000;
    border-style: ridge;
    padding: 6px 4px;
    font-size: 13px;
}

.mobile-schedule-table.courses-table .date-header {
    background-color: #FFCC00;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    font-size: 15px;
    border: 1px solid #000000;
    border-style: ridge;
}

/* Анимация загрузки */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading-spinner::after {
    content: '⏳';
    font-size: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .mobile-controls {
        padding: 10px;
    }

    .control-group {
        gap: 5px;
    }

    .control-group label {
        font-size: 13px;
    }

    .control-group select {
        padding: 9px 32px 9px 10px;
        font-size: 13px;
        background-position: right 6px center;
        background-size: 18px;
        color: #000000;
    }

    .control-group select option {
        font-size: 13px;
        padding: 6px;
    }

    .mobile-schedule-table {
        font-size: 11px;
    }

    .mobile-schedule-table td {
        padding: 5px 3px;
    }

    .mobile-schedule-table .department-header {
        font-size: 13px;
    }

    .mobile-schedule-table .group-header {
        font-size: 13px;
    }

    .scheduleWrapper {
      border: none;
    }
}

