/* Современные глобальные стили */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

#container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Заголовок */
h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    font-size: 2.5rem;
}

/* Панель администратора */
#adminDiv {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

#adminDiv table {
    width: 100%;
    border-collapse: collapse;
}

#adminDiv td {
    padding: 20px;
    vertical-align: top;
    border: 1px solid #e1e8ed;
}

#adminDiv h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* Списки с прокруткой */
#usersAdminDiv,
#adminListDiv,
#corpAdminDiv,
#groupAdminDiv {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Стили для скроллбара */
#usersAdminDiv::-webkit-scrollbar,
#adminListDiv::-webkit-scrollbar,
#corpAdminDiv::-webkit-scrollbar,
#groupAdminDiv::-webkit-scrollbar {
    width: 6px;
}

#usersAdminDiv::-webkit-scrollbar-track,
#adminListDiv::-webkit-scrollbar-track,
#corpAdminDiv::-webkit-scrollbar-track,
#groupAdminDiv::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#usersAdminDiv::-webkit-scrollbar-thumb,
#adminListDiv::-webkit-scrollbar-thumb,
#corpAdminDiv::-webkit-scrollbar-thumb,
#groupAdminDiv::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#usersAdminDiv::-webkit-scrollbar-thumb:hover,
#adminListDiv::-webkit-scrollbar-thumb:hover,
#corpAdminDiv::-webkit-scrollbar-thumb:hover,
#groupAdminDiv::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Ссылки в списках */
#usersAdminDiv a,
#adminListDiv a,
#corpAdminDiv a,
#groupAdminDiv a {
    display: contents;
    padding: 8px 12px;
    margin: 4px 0;
    text-decoration: none;
    color: #3498db;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

#usersAdminDiv a:hover,
#adminListDiv a:hover,
#corpAdminDiv a:hover,
#groupAdminDiv a:hover {
    background: #f8f9fa;
    border-color: #e1e8ed;
    transform: translateX(5px);
}

/* Поиск */
#search {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

#searchName {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

#searchName:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Фильтры */
#searchGroups,
#searchCorps {
    margin-bottom: 20px;
}

/* Чекбоксы фильтров */
#searchGroups input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

#searchGroups label {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 8px;
    cursor: pointer;
}

/* Кнопка поиска */
.knopka {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.knopka:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* Результаты поиска */
#searchResult {
    margin-top: 30px;
}

#searchResult table {
    width: 100%;
    border-collapse: collapse;
}

#searchResult td {
    padding: 20px;
    text-align: center;
    border: 1px solid #e1e8ed;
    background: white;
}

#searchResult img {
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #f1f1f1;
}

/* Ссылка "Записаться" */
#searchResult a[href^="javascript:zapisModal"] {
    display: inline-block;
    background: #27ae60;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
}

#searchResult a[href^="javascript:zapisModal"]:hover {
    background: #219a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Форма входа */
#footer form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 300px;
    margin-left: auto;
}

#footer input[type="text"],
#footer input[type="password"] {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    transition: all 0.3s ease;
}

#footer input[type="text"]:focus,
#footer input[type="password"]:focus {
    outline: none;
    border-color: #3498db;
}

#footer input[type="submit"] {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#footer input[type="submit"]:hover {
    background: #2980b9;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    #container {
        padding: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    #adminDiv table,
    #adminDiv tr,
    #adminDiv td {
        display: block;
        width: 100%;
    }
    
    #adminDiv td {
        margin-bottom: 20px;
        border: none;
        border-bottom: 1px solid #e1e8ed;
    }
    
    #searchResult table,
    #searchResult tr,
    #searchResult td {
        display: block;
        width: 100%;
    }
    
    #searchResult td {
        margin-bottom: 20px;
        border: none;
        border-bottom: 1px solid #e1e8ed;
    }
    
    #footer form {
        max-width: 100%;
        margin: 20px 0;
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#searchResult table {
    animation: fadeIn 0.5s ease;
}

/* Иконки */
img[src*="edit.png"],
img[src*="del.png"] {
    width: 16px;
    height: 16px;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

img[src*="edit.png"]:hover,
img[src*="del.png"]:hover {
    opacity: 1;
}

/* Стили для фильтров поиска */
#searchGroups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    border: 2px solid #e1e8ed;
}

/* Крупные чекбоксы */
.search-filter-item {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    background: white;
    border-radius: 12px;
    border: 2px solid #e1e8ed;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.search-filter-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(52, 152, 219, 0.1), transparent);
    transition: left 0.6s;
}

.search-filter-item:hover::before {
    left: 100%;
}

.search-filter-item:hover {
    border-color: #3498db;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.15);
}

/* Увеличенные чекбоксы */
.search-filter-item input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin-right: 16px;
    cursor: pointer;
    accent-color: #3498db;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

.search-filter-item input[type="checkbox"]:checked {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.search-filter-item label {
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    flex: 1;
    font-size: 16px;
    letter-spacing: 0.3px;
}

/* Контейнер для выпадающего списка корпусов */
.search-corp-filter {
    margin: 25px 0;
    max-width: 500px;
}

.corp-select-wrapper {
    position: relative;
    background: white;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid #e1e8ed;
    transition: all 0.3s ease;
}

.corp-select-wrapper:focus-within {
    border-color: #3498db;
    box-shadow: 0 8px 30px rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
}

/* Красивый выпадающий список */
#searchCorpsList {
    width: 100%;
    padding: 20px 60px 20px 25px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    background: transparent;
    appearance: none;
    cursor: pointer;
    color: #2c3e50;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='%233498db' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 24px;
}

#searchCorpsList:focus {
    outline: none;
    background-color: rgba(52, 152, 219, 0.05);
}

/* Иконка перед селектом */
.corp-select-wrapper::before {
    content: '🏛️';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    z-index: 2;
    filter: grayscale(0.3);
}

/* Стили для опций */
#searchCorpsList option {
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 500;
    background: white;
    color: #2c3e50;
    border-bottom: 1px solid #f1f1f1;
}

#searchCorpsList option:hover {
    background: #3498db !important;
    color: white;
}

#searchCorpsList option:checked {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-weight: 600;
}

/* Анимация при изменении выбора */
#searchCorpsList {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.2); }
    70% { box-shadow: 0 0 0 10px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    #searchGroups {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 20px 15px;
    }
    
    .search-filter-item {
        padding: 16px 18px;
    }
    
    .search-filter-item input[type="checkbox"] {
        width: 22px;
        height: 22px;
        margin-right: 14px;
    }
    
    .search-filter-item label {
        font-size: 15px;
    }
    
    .corp-select-wrapper {
        max-width: 100%;
    }
    
    #searchCorpsList {
        padding: 18px 55px 18px 22px;
        font-size: 16px;
    }
    
    .corp-select-wrapper::before {
        left: 18px;
        font-size: 20px;
    }
}

/* Стили для состояния загрузки */
.search-filter-loading .search-filter-item {
    opacity: 0.7;
    pointer-events: none;
}

.search-filter-loading .search-filter-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Индикатор выбранных фильтров */
.filter-counter {
    display: inline-block;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    animation: bounce 0.5s;
}

@keyframes bounce {
    0%, 20%, 60%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    80% { transform: translateY(-3px); }
}

/* Стили для фильтров поиска */
#searchGroups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin: 20px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    border: 2px solid #e1e8ed;
}

/* Правильные стили для чекбоксов с лейблами */
.search-group-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    border: 2px solid #e1e8ed;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.search-group-item:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.15);
}

/* Крупные чекбоксы */
.search-group-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 15px;
    cursor: pointer;
    accent-color: #3498db;
    flex-shrink: 0;
}

/* Стили для текста рядом с чекбоксом */
.search-group-item label {
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

/* Стили для обычных чекбоксов (без label) */
#searchGroups input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #3498db;
    vertical-align: middle;
}

#searchGroups br {
    display: none; /* Скрываем переносы строк */
}

/* Контейнер для выпадающего списка корпусов */
.search-corp-filter {
    margin: 25px 0;
    max-width: 500px;
}

.corp-select-wrapper {
    position: relative;
    background: white;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid #e1e8ed;
    transition: all 0.3s ease;
}

.corp-select-wrapper:focus-within {
    border-color: #3498db;
    box-shadow: 0 8px 30px rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
}

/* Красивый выпадающий список */
#searchCorpsList {
    width: 100%;
    padding: 18px 60px 18px 25px;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 600;
    background: transparent;
    appearance: none;
    cursor: pointer;
    color: #2c3e50;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='%233498db' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 24px;
}

#searchCorpsList:focus {
    outline: none;
    background-color: rgba(52, 152, 219, 0.05);
}

/* Иконка перед селектом */
.corp-select-wrapper::before {
    content: '🏛️';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    z-index: 2;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    #searchGroups {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 20px 15px;
    }
    
    .search-group-item {
        padding: 14px 16px;
    }
    
    .search-group-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 12px;
    }
    
    .search-group-item label {
        font-size: 15px;
    }
    
    .corp-select-wrapper {
        max-width: 100%;
    }
    
    #searchCorpsList {
        padding: 16px 55px 16px 22px;
        font-size: 16px;
    }
}

#searchCorps {
    font-weight: 600;
    color: #2c3e50;
    margin: 15px 0;
    font-size: 16px;
}

#searchCorps::before {
    content: "Корпус: ";
    font-weight: 600;
    margin-right: 10px;
}

/* Скрываем чекбокс переключения */
.filter-toggle {
    display: none;
}

/* Заголовок фильтра */
.filter-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.filter-header:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
    transform: translateY(-2px);
}

/* Контент фильтра - скрыт по умолчанию */
.filter-content {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

/* Показываем контент при checked состоянии */
.filter-toggle:checked ~ .filter-content {
    display: grid;
}

/* Поворачиваем стрелку при открытии */
.filter-toggle:checked ~ .filter-header .filter-arrow {
    transform: rotate(180deg);
}

.filter-arrow {
    transition: transform 0.3s ease;
    font-size: 14px;
}

.time-options {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  text-align: center;
}

.time-options label {
  cursor: pointer;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

.time-options label:hover {
  background-color: #f5f5f5;
}