/* 1. ШРИФТЫ И БАЗА */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #ffffff;
    min-height: 100vh;
    padding-bottom: 80px;
    overflow-x: hidden; /* Чтобы не было горизонтальной прокрутки */
}

/* 2. ПЛАШКА ЗАГРУЗКИ */
.server-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(255, 140, 0, 0.15); border: 1px solid rgba(255, 140, 0, 0.5);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: #ffd700; padding: 10px 20px; border-radius: 50px;
    display: flex; align-items: center; gap: 15px; z-index: 9999;
    width: 90%; max-width: 450px; font-size: 0.85rem; font-weight: 600;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); transition: all 0.5s ease;
}
.server-toast.hidden { top: -100px; opacity: 0; }
.spinner-small {
    width: 18px; height: 18px; border: 2px solid rgba(255, 215, 0, 0.3);
    border-top: 2px solid #ffd700; border-radius: 50%; animation: spin 1s linear infinite; flex-shrink: 0;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 3. ШАПКА И КАЛЕНДАРЬ */
header { text-align: center; padding: 30px 20px; }
header h1 { font-size: 1.8rem; text-shadow: 0 0 10px rgba(0, 210, 255, 0.5); margin-bottom: 15px; }

/* Календарь */
.date-controls {
    display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 10px;
}
#date-picker {
    background: rgba(255,255,255,0.1); border: 1px solid #555; color: white;
    padding: 8px 15px; border-radius: 8px; font-family: 'Montserrat', sans-serif;
    font-size: 1rem; color-scheme: dark; cursor: pointer;
}
.date-controls button {
    width: 35px; height: 35px; border-radius: 50%; background: rgba(255,255,255,0.1);
    color: #fff; border: 1px solid #444; cursor: pointer; transition: 0.3s;
    display: flex; justify-content: center; align-items: center;
}
.date-controls button:hover { background: #00d2ff; color: #000; }

.current-date { color: #a8a8b3; font-size: 0.9rem; margin-bottom: 20px; }

/* Кнопка добавления пары */
.btn-add-pair {
    display: block; margin: 0 auto; background: linear-gradient(45deg, #11998e, #38ef7d);
    color: white; border: none; padding: 10px 20px; border-radius: 25px;
    font-weight: bold; cursor: pointer; box-shadow: 0 5px 15px rgba(56, 239, 125, 0.3);
    transition: transform 0.2s;
}
.btn-add-pair:hover { transform: scale(1.05); }
.hidden { display: none !important; }

/* 4. ОСНОВНОЙ СПИСОК */
.table-container { max-width: 800px; margin: 0 auto; padding: 0 15px; }

/* Карточка пары (Стекло) */
.schedule-row {
    position: relative;
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 15px;
    padding: 20px; margin-bottom: 15px;
    display: flex; flex-direction: column; gap: 15px; transition: transform 0.2s;
}
.schedule-row:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.3); }

/* Крестик удаления */
.delete-pair-btn {
    position: absolute; top: 10px; right: 10px;
    background: rgba(220, 53, 69, 0.2); color: #ff6b6b;
    width: 25px; height: 25px; border-radius: 50%; border: none;
    cursor: pointer; font-size: 1.2rem; line-height: 1;
    display: flex; justify-content: center; align-items: center; transition: 0.3s;
}
.delete-pair-btn:hover { background: #dc3545; color: white; }

/* Внутренности карточки */
.time-col .pair-time { font-size: 1.2rem; font-weight: bold; color: #00d2ff; }
.subject-col strong { font-size: 1.1rem; display: block; margin-bottom: 5px; }
.subject-col .teacher { font-size: 0.85rem; color: #bbb; font-style: italic; }

/* Кнопки действий */
.actions-col { display: flex; gap: 10px; }
button.btn-hw, button.btn-le {
    flex: 1; padding: 12px; border: none; border-radius: 8px;
    font-family: 'Montserrat', sans-serif; font-weight: 600; color: white; cursor: pointer;
}
.btn-hw { background: linear-gradient(45deg, #da22ff, #9733ee); }
.btn-le { background: linear-gradient(45deg, #00d2ff, #3a7bd5); }
button:hover { filter: brightness(1.2); }
button:active { transform: scale(0.95); }

/* 5. МОДАЛЬНЫЕ ОКНА */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; transition: opacity 0.3s;
}
.modal-content {
    background: #1f1c2c; width: 90%; max-width: 500px;
    padding: 25px; border-radius: 20px; border: 1px solid #444;
    position: relative; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.close-btn {
    position: absolute; top: 15px; right: 20px; font-size: 2rem;
    cursor: pointer; color: #aaa;
}

/* Галерея */
.gallery-view {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-top: 15px;
}
#gallery-img {
    max-height: 50vh; max-width: 100%; object-fit: contain;
    border-radius: 8px; border: 1px solid #333;
}
.nav-btn {
    background: rgba(255,255,255,0.1); width: 40px; height: 40px;
    border-radius: 50%; color: white; border: none; cursor: pointer; flex-shrink: 0;
}
.nav-btn:hover { background: #00d2ff; color: #000; }
.gallery-counter { text-align: center; color: #777; margin-top: 10px; font-size: 0.8rem; }

/* Форма добавления */
.input-group { margin-bottom: 15px; }
.input-group label { display: block; margin-bottom: 5px; color: #aaa; font-size: 0.9rem; }
.input-group input {
    width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #444;
    background: #2a2a40; color: #fff; font-family: 'Montserrat', sans-serif;
}

/* 6. КНОПКА АДМИНА (ШЕСТЕРЕНКА) */
.admin-floating-btn {
    position: fixed; bottom: 20px; right: 20px;
    width: 50px; height: 50px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff; font-size: 1.5rem; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    transition: 0.3s; z-index: 999;
}
.admin-floating-btn:hover { opacity: 1; background: #dc3545; transform: rotate(90deg); }

/* АДАПТИВ (ДЛЯ ПК) */
@media (min-width: 600px) {
    .schedule-row { flex-direction: row; align-items: center; }
    .time-col, .subject-col, .actions-col { flex: 1; }
    .actions-col { justify-content: flex-end; }
    button.btn-hw, button.btn-le { flex: none; width: 100px; }
    .delete-pair-btn { right: -12px; top: -12px; background: #dc3545; color: white; }
}