/* ============================================================
   ОБЩИЕ СТИЛИ
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   СТРАНИЦА ВХОДА
   ============================================================ */
body.login-page {
    background: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px 35px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.3s;
}

.login-card:hover {
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.35);
}

.login-header {
    text-align: center;
    margin-bottom: 25px;
}

.login-icon {
    font-size: 48px;
    color: #2c3e50;
    background: #ecf0f1;
    padding: 15px;
    border-radius: 50%;
    margin-bottom: 10px;
    display: inline-block;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    color: #2c3e50;
    letter-spacing: 1px;
}

.login-header .subtitle {
    color: #7f8c8d;
    font-size: 14px;
    margin-top: 5px;
}

.login-card h2 {
    text-align: center;
    font-weight: 400;
    color: #34495e;
    margin-bottom: 25px;
    font-size: 20px;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 15px;
}

.error-msg {
    background: #fde8e8;
    color: #c0392b;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 5px solid #e74c3c;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #2c3e50;
    font-size: 14px;
}

.form-group label i {
    width: 20px;
    color: #7f8c8d;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dce1e8;
    border-radius: 10px;
    font-size: 15px;
    transition: border 0.3s, box-shadow 0.3s;
    background: #fafbfc;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
    background: #fff;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #1a252f, #2c3e50);
}

.btn-login:active {
    transform: scale(0.97);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    color: #95a5a6;
    font-size: 13px;
    border-top: 1px solid #ecf0f1;
    padding-top: 20px;
}

/* ============================================================
   ШАПКА
   ============================================================ */
header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #fff;
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.user-info {
    font-size: 13px;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

#datetime {
    font-size: 14px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
}

#datetime span {
    margin: 0 4px;
}

.btn-admin,
.btn-logout {
    color: #fff;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    transition: 0.2s;
}

.btn-admin {
    background: #3498db;
}
.btn-admin:hover {
    background: #2980b9;
}

.btn-logout {
    background: #e74c3c;
}
.btn-logout:hover {
    background: #c0392b;
}

/* ============================================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================================ */
main {
    flex: 1;
    padding: 15px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.message {
    background: #d4edda;
    color: #155724;
    padding: 8px 16px;
    border-radius: 5px;
    margin-bottom: 15px;
    border-left: 5px solid #28a745;
    font-size: 14px;
}

/* Навигация по неделям */
.week-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.nav-btn {
    display: inline-block;
    background: #ecf0f1;
    color: #2c3e50;
    padding: 5px 14px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
    border: 1px solid #d0d7de;
    font-size: 14px;
}
.nav-btn:hover {
    background: #d5dbdb;
}

.today-btn {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}
.today-btn:hover {
    background: #2980b9;
}

.week-label {
    font-size: 16px;
    font-weight: 500;
}

/* ===== ТАБЛИЦА ПЛАНЕРА – увеличенная высота и шрифт ===== */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    background: #fff;
}

.planner {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    table-layout: fixed;
}

.planner th,
.planner td {
    padding: 4px 4px; /* увеличенные отступы */
    text-align: center;
    vertical-align: middle;
    border: 1px solid #e9ecef;
}

.planner th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 11px;
}
.planner th .day-date {
    font-weight: 400;
    font-size: 9px;
    color: #6c757d;
}

.time-header {
    width: 38px;
    background: #f8f9fa;
    font-size: 9px;
}
.time-cell {
    font-size: 9px;
    color: #6c757d;
    background: #fafbfc;
    width: 38px;
    padding: 4px 0;
}

/* Основные ячейки – увеличенная высота */
.planner td {
    height: 42px; /* увеличено с 28px до 42px */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell {
    background: #fff;
    transition: 0.1s;
}

.cell.occupied {
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    cursor: pointer;
}
.cell.clickable:hover {
    opacity: 0.85;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    max-height: 40px; /* увеличено, чтобы вместить несколько событий */
    overflow: hidden;
}

.event-item {
    font-size: 15px; /* увеличен шрифт в ячейке до 15px */
    line-height: 1.2;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #ccc;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Кнопка добавления */
.btn-add {
    background: #2ecc71;
    color: #fff;
    border: none;
    padding: 8px 22px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 3px 8px rgba(46, 204, 113, 0.3);
    margin-top: 5px;
}
.btn-add:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

/* ============================================================
   МОДАЛЬНЫЕ ОКНА
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 26px;
    cursor: pointer;
    color: #999;
    transition: 0.2s;
}
.close-modal:hover {
    color: #333;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 18px;
    color: #2c3e50;
    font-size: 20px;
}

.modal-content .form-group {
    margin-bottom: 12px;
}

.modal-content label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    color: #555;
    font-size: 13px;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    transition: 0.2s;
}
.modal-content input:focus,
.modal-content textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.btn-primary,
.btn-edit,
.btn-delete,
.btn-save,
.btn-secondary {
    padding: 6px 16px;
    border: none;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    margin-right: 6px;
}
.btn-primary {
    background: #3498db;
    color: #fff;
}
.btn-primary:hover {
    background: #2980b9;
}
.btn-edit {
    background: #f39c12;
    color: #fff;
}
.btn-edit:hover {
    background: #e67e22;
}
.btn-delete {
    background: #e74c3c;
    color: #fff;
}
.btn-delete:hover {
    background: #c0392b;
}
.btn-save {
    background: #2ecc71;
    color: #fff;
}
.btn-save:hover {
    background: #27ae60;
}
.btn-secondary {
    background: #95a5a6;
    color: #fff;
}
.btn-secondary:hover {
    background: #7f8c8d;
}

#modal-actions {
    margin-top: 15px;
}

/* ============================================================
   ПОДВАЛ
   ============================================================ */
footer {
    background: #2c3e50;
    color: #b0bec5;
    padding: 15px 25px;
    text-align: center;
    font-size: 12px;
    margin-top: 15px;
}
footer .footer-note {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 3px;
}

/* ============================================================
   АДМИНКА
   ============================================================ */
.users-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-top: 15px;
}

.users-table th {
    background: #f8f9fa;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 13px;
}

.users-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
    font-size: 13px;
}

.users-table input,
.users-table select {
    padding: 4px 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 100%;
    max-width: 130px;
    font-size: 12px;
}
.users-table input[type="color"] {
    padding: 2px;
    width: 36px;
    height: 26px;
}

.inline-form {
    display: contents;
}

.action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.add-user-form {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.form-row .form-group {
    flex: 1;
    min-width: 130px;
}
.form-row .form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 3px;
    font-size: 13px;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 15px;
    }
    .header-left,
    .header-right {
        justify-content: center;
    }
    .header-right {
        flex-wrap: wrap;
    }
    .week-nav {
        gap: 8px;
    }
    .planner th,
    .planner td {
        padding: 2px 2px;
        font-size: 9px;
    }
    .time-header,
    .time-cell {
        width: 28px;
        font-size: 8px;
    }
    .planner td {
        height: 34px; /* на мобильных высота чуть меньше */
    }
    .event-item {
        font-size: 12px; /* на мобильных шрифт меньше */
        line-height: 1.1;
    }
    .event-list {
        max-height: 32px;
    }
    .login-card {
        padding: 25px 18px;
    }
}