.theme-light {      
    --color-primary: #f8f8f8;
    --color-secondary: #eeeeee;
    --color-accent: #e3e3e3;
    --color-menu-hover: #d1d1d1;
    --font-color: #000000;
    --font-color-secondary: #616161;
    }

    .theme-dark {
    --color-primary: #181818;
    --color-secondary: #1c1c1c;  
    --color-accent: #272727;
    --color-menu-hover: #2c2c2c;
    --font-color: #f1f1f1;
    --font-color-secondary: #aaa;
    }

    body, html {
        font-family: 'Roboto', sans-serif;
        background-color: var(--color-primary);
        color: var(--font-color);
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        height: 100vh;
        -webkit-tap-highlight-color: transparent; /* Убирает стандартное выделение на мобильных устройствах */
    }

    .page-content {
        opacity: 0;
        /* transition: opacity 0.05s ease; */
    }

    .page-content.visible {
        opacity: 1;
    }

    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
    }

    .header-text {
        font-size: 1.2em;
        font-weight: bold;
        padding-left: 10px;
    }

    .add-group-btn {
        background: none;
        border: none;
        color: var(--font-color);
        font-size: 1.5em;
        cursor: pointer;
    }


    /* Список групп */
    .group-list {
        flex: 1;
        overflow-y: auto;
        padding: 10px;
        background-color: var(--color-secondary);
        border-radius: 8px;
        /* box-shadow: 0 0 15px rgba(0, 0, 0, 0.5); */
    }

    .group-item {
        padding: 12px 20px;
        border-bottom: 1px solid #333;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        transition: background-color 0.3s ease, transform 0.2s ease;
        border-radius: 8px;
        margin-bottom: 8px;
    }

    .group-item:hover {
        background-color: var(--color-menu-hover);
        transform: translateY(-2px);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }

    .group-item.selected {
        background-color: var(--color-menu-hover);
        color: #fff;
        border: 1px solid #444;
        box-shadow: 0 0 10px rgba(69, 69, 69, 0.2);
    }

    .group-name {
        font-size: 1.2em;
        font-weight: 500;
        color: var(--font-color);
    }

    .group-settings {
        color: var(--font-color);
        font-size: 1.5em;
        cursor: pointer;
        transition: color 0.3s ease;
    }

    .group-settings:hover {
        color: var(--font-color);
    }

    .group-item i {
        font-size: 1.5em;
    }



    /* Модальное окно */
    .add-group-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.8);
        display: none; /* Скрыто по умолчанию */
        justify-content: center;
        align-items: flex-start;
        z-index: 1000;
        padding-top: 20px;
    }

    .add-group-container {
        width: 100%;
        background-color: var(--color-primary);
        padding: 15px;
    }

    .add-group-header {
        display: flex;
        align-items: center;
    }

    #group-input {
        flex-grow: 1;
        font-size: 1.1em;
        padding: 10px;
        background-color: var(--color-accent);
        color: var(--font-color);
        border: none;
        border-radius: 5px;
        margin-left: 10px;
    }

    .back-btn {
        background: none;
        border: none;
        color: var(--font-color);
        font-size: 1.5em;
    }

    .group-suggestions {
        margin-top: 20px;
        max-height: 300px;
        overflow-y: auto;
    }

    .group-suggestions div {
        padding: 10px;
        background-color: var(--color-accent);
        margin-bottom: 5px;
        border-radius: 5px;
        cursor: pointer;
    }

    .group-suggestions div:hover {
        background-color: var(--color-secondary);
    }


    .action-modal {
        display: none; /* Скрываем модальное окно по умолчанию */
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        overflow: auto;
        background-color: rgba(0, 0, 0, 0.4);
        justify-content: center;
        align-items: center;
    }

    .action-modal-content {
        background-color: var(--color-secondary);
        padding: 20px;
        width: 80%;
        max-width: 400px;
        color: var(--font-color);
        border-radius: 15px;
        box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.3);
    }

    .action-modal button {
        background: none; /* Убираем фон */
        border: none; /* Убираем границы */
        color: var(--font-color);
        text-align: left; /* Выравниваем текст по левому краю */
        padding: 15px 0;
        width: 100%;
        cursor: pointer;
        font-size: 1em;
        transition: color 0.3s ease;
        display: block;
    }

    .action-modal button:hover {
        color: #bbb; /* Легкая подсветка текста при наведении */
    }

    /* Горизонтальный разграничитель между кнопками */
    .action-modal .divider {
        height: 1px;
        background-color: #444; /* Цвет разделительной линии */
        margin: 10px 0;
    }

    /* Стиль заголовка модального окна */
    .modal-header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        position: relative;
        padding-bottom: 15px;
        border-bottom: 1px solid #444; /* Разделитель в заголовке */
    }

    #modal-group-name {
        flex-grow: 1;
        text-align: left;
        font-weight: 600;
        font-size: 1.2em;
    }

    .modal-header i {
        font-size: 1.5em;
        cursor: pointer;
        color: var(--font-color-secondary);
        transition: color 0.2s ease;
    }

    .modal-header i:hover {
        color: var(--font-color) !important;
    }



    .nav-bar {
        display: flex;
        justify-content: space-around;
        align-items: center;
        background-color: var(--color-primary);;
        padding: 4px 0 10px 0;
        position: sticky;
        bottom: 0;
    }

    .nav-item, a {
        text-align: center;
        font-size: 0.9em;
        display: flex;
        flex-direction: column;
        align-items: center;
        cursor: pointer;
    }

    .nav-item i {
        font-size: 1.3em;
        margin-bottom: 5px;
    }

    .nav-bar {
        padding-bottom: var(--tg-safe-area-inset-bottom);
    }

    .nav-item:hover {
        color: #999;
    }

    .nav-item.active {
        color: var(--font-color);
    }
    
    .nav-item.active span {
        position: relative;
        display: inline-block;
        padding-bottom: 4px;
    }

    .nav-item.active span::after {
        content: '';
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        bottom: 0;
        width: 120%;
        height: 2px;
        background-color: var(--font-color);
        border-radius: px;
    }

    a {
        text-decoration: none; /* Убирает подчеркивание */
        color: inherit; /* Наследует цвет от родительского элемента */
    }

    /* модальное окно для настройки предметов */
    #subjects-modal {
        display: none;
        position: fixed;
        z-index: 1000;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.8);
        justify-content: center;
        align-items: center;
        overflow-y: auto;
    }

    #subjects-modal .action-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        color: var(--font-color);
        border-radius: 0;
        padding: 20px;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }

    #modal-subjects-group-name {
        font-size: 1.2em;
        font-weight: bold;
    }

    .subject-list {
        flex-grow: 1;
        overflow-y: auto;
        margin-top: 20px;
    }

    .subject-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        background-color: var(--color-menu-hover);
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .subject-info {
        flex-grow: 1;
        text-align: left;
    }

    .subject-name {
        font-size: 1.2em;
        font-weight: bold;
    }

    .subject-details {
        font-size: 0.9em;
        color: var(--font-color-secondary);
        margin-right: 5px; /* Добавляем отступ, чтобы текст не "упирался" в иконки */
    }

    .subject-actions {
        display: flex;
        align-items: center;
    }

    .subject-actions i {
        font-size: 1.5em;
        margin-right: 10px;
        cursor: pointer;
        color: #bbb;
    }

    .subject-actions i:hover {
        color: var(--font-color);
    }

    /* Стили для стандартных чекбоксов */
    .subject-checkbox {
        width: 20px;
        height: 20px;
        margin-left: 10px;
        appearance: none;
        background-color: #444;
        border: 2px solid #bbb;
        border-radius: 5px;
        cursor: pointer;
        position: relative;
    }

    .subject-checkbox:checked {
        background-color: #2c2c2c;
        border: 2px solid #fff;
    }

    .subject-checkbox:checked::after {
        content: '\f00c'; /* FontAwesome код галочки */
        font-family: 'FontAwesome';
        color: #fff;
        font-size: 14px;
        position: absolute;
        top: 2px;
        left: 1px;
    }


    /* Стили для модального окна настройки посиланий */
    #links-modal .action-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        padding: 20px;
        box-sizing: border-box;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    #modal-links-group-name {
        font-size: 1.1em;
        font-weight: bold;
    }

    /* Контейнер для списка предметов с ссылками */
    .subjects-links-list {
        flex-grow: 1;
        overflow-y: auto;
        margin-top: 10px;
    }

    /* Стиль для элемента предмета с ссылками */
    .subject-link-item {
        padding: 10px;
        background-color: var(--color-secondary);
        border-radius: 5px;
        margin-bottom: 10px;
    }

    .subject-link-item label {
        font-weight: 500;
        /* color: var(--font-color-secondary); */
        display: block;
        margin-bottom: 5px;
    }

    .link-input {
        width: 90%;
        padding: 8px;
        margin-top: 5px;
        margin-bottom: 10px;
        border: none;
        border-radius: 5px;
        background-color: var(--color-accent);
        color: var(--font-color-secondary);
        outline: none;
        resize: none; /* Запрещаем пользователю изменять размер вручную */
        overflow-y: hidden; /* Скрываем вертикальную прокрутку */
        max-height: 100px; /* Ограничиваем максимальную высоту */
    }

    .link-input-group {
        margin-bottom: 15px; /* Добавим отступ между полями */
    }

    .save-btn {
        width: 100% !important;
        padding: 12px !important;
        background-color: var(--color-accent) !important;
        color: var(--font-color) !important;
        border: none !important;
        border-radius: 8px !important;
        font-size: 1em !important;
        font-weight: bold !important;
        cursor: pointer !important;
        text-align: center !important;
        transition: background-color 0.3s ease !important;
        margin-top: 4px;
        opacity: 0;
        max-height: 0;
        transition: opacity 0.3s ease, max-height 0.3s ease !important;
    }

    .save-btn:hover {
        background-color: var(--color-menu-hover) !important;
    }

    .save-btn:active {
        background-color: var(--font-color-secondary) !important;
        transform: scale(0.98) !important; /* Легкое уменьшение при нажатии */
    }

    .save-btn.show {
        opacity: 1;
        max-height: 40px; /* Задаем высоту под кнопку */
    }

    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000; 
    }

    .error-box {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        max-width: 80%;
        padding: 20px;
        background-color: var(--color-secondary); /* Используем основной темный цвет сайта */
        color: var(--font-color); /* Основной цвет текста сайта */
        border-radius: 8px;
        font-size: 14px;
        line-height: 1.5;
        box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 1000;
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: center;
        animation: fadeIn 0.3s ease;
    }

    .error-message {
        margin-bottom: 15px;
        text-align: left;
        font-weight: normal;
    }

    .error-close-btn {
        padding: 8px 16px;
        background-color: var(--font-color); /* Цвет фона кнопки */
        color: var(--color-primary); /* Цвет текста кнопки */
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 14px;
        font-weight: bold;
        transition: background-color 0.3s ease;
    }

    .error-close-btn:hover {
        background-color: var(--font-color-secondary); /* Цвет кнопки при наведении */
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Стили для модального окна предупреждения */
    #access-warning-modal .action-modal-content {
        width: 80%;
        max-width: 400px;
        padding: 20px;
        background-color: var(--color-secondary);
        color: var(--font-color);
        border-radius: 8px;
        box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.3);
    }

    #modal-acsess-warning-header {
        font-size: 1.1em;
    }

    .warning-message {
        margin-top: 10px;
        font-size: 1em;
        color: var(--font-color-secondary);
    }

    .modal-buttons {
        display: flex;
        justify-content: space-around;
        gap: 20px;
        margin-top: 20px;
    }

    .modal-buttons button {
        padding: 8px 16px;
        font-weight: bold;
        cursor: pointer;
        border: none;
        border-radius: 5px;
        transition: background-color 0.3s ease;
    }

    #request-access-btn {
        background-color: var(--font-color);
        color: var(--color-primary);
        text-align: center;
    }

    #request-access-btn:hover {
        background-color: var(--font-color-secondary);
    }

    #cancel-access-btn {
        background-color: var(--color-accent);
        color: var(--font-color);
        text-align: center;
    }

    #cancel-access-btn:hover {
        background-color: var(--color-menu-hover);
    }

    /* Стиль для модального окна запроса доступа */

    .request-message {
        margin-top: 10px;
    }

    #modal-access-request-header {
        font-size: 1.1em;
    }

    .request-message textarea {
        height: 150px;
        width: 93%;
        background-color: var(--color-primary);
        color: var(--font-color-secondary);
        border: none;
        border-radius: 5px;
        padding: 10px;
        resize: none;
        font-size: 1.1em;
    }

    .modal-buttons {
        display: flex;
        justify-content: flex-end;
        margin-top: 15px;
    }

    #send-request-btn {
        display: flex;
        padding: 8px 16px;
        background-color: var(--font-color);
        color: var(--color-primary);
        font-weight: bold;
        cursor: pointer;
        border: none;
        border-radius: 5px;
        width: auto;
        transition: background-color 0.3s ease;
    }

    #send-request-btn svg {
        margin-left: 5px;
        height: 15px;
        width: auto;
    }

    #send-request-btn:hover {
        background-color: var(--font-color-secondary);
    }

    /* Стили для элемента предмета с ссылками */
    #view-links-modal .action-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        padding: 20px;
        box-sizing: border-box;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    #modal-view-links-group-name {
        font-weight: bold;
        font-size: 1.1em;
    }

    #subjects-view-links-list {
        flex-grow: 1;
        overflow-y: auto;
        margin-top: 10px;
    }

    /* Элементы ссылки для предмета */
    #view-links-modal .subject-link-item {
        padding: 10px;
        border-radius: 5px;
        margin-bottom: 15px; /* Отступ между предметами */
    }

    .subject-link-item .subject-name {
        font-weight: bold;
        margin-bottom: 8px;
        padding-bottom: 4px;
    }

    /* Отделение ссылок Meet/Zoom и DL */
    .subject-link-item .link-type {
        background-color: var(--color-accent);
        margin-bottom: 5px;
        padding: 10px;
        border-radius: 5px;
    }


    /* Ссылка с текстом и подчёркиванием */
    .subject-link-item a {
        color: var(--font-color-secondary);
        text-decoration: underline;
        display: block; 
        font-family: monospace;
        font-size: 14px;
        overflow-wrap: break-word;
        text-align: left;
        margin-top: 5px;
    }

    .subject-link-item a:hover {
        color: var(--font-color);
    }