/* ==========================================================================
   MODAL BACKDROP & CONTAINER (Размытие и глубина)
   ========================================================================== */
.modal-backdrop.show {
    opacity: 0.6;
    background-color: #0f172a; /* Глубокий темный оттенок */
}

/* Размытие фона применяется к самому модальному контейнеру для лучшей производительности */
.auth-modal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-dialog {
    max-width: 440px; /* Оптимальная ширина для читабельности */
}

/* ==========================================================================
   MODAL CONTENT (Воздух и тени)
   ========================================================================== */
.auth-modal__content {
    background: #ffffff;
    border: none;
    border-radius: 24px; /* Мягкие современные углы */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0px 15px rgba(0,0,0,0.05);
    padding: 2.5rem;
    position: relative;
    overflow: visible;
}

/* Кнопка закрытия */
.auth-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.auth-modal__close:hover,
.auth-modal__close:focus {
    background: #e2e8f0;
    color: var(--h1-color, #334155);
    outline: none;
    transform: rotate(90deg);
}

/* ==========================================================================
   HEADER & TYPOGRAPHY
   ========================================================================== */
.auth-modal__header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-modal__icon i {
    font-size: 3rem;
    color: var(--top-bg, #01a0e2);
    margin-bottom: 1rem;
    opacity: 0.9;
}

.auth-modal__avatar img {
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(1, 160, 226, 0.2);
    margin-bottom: 1rem;
}

.auth-modal__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--h1-color, #1e293b);
    margin-bottom: 0.5rem;
}

.auth-modal__subtitle {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

/* ==========================================================================
   FORM ELEMENTS (Inputs)
   ========================================================================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--h1-color, #475569);
    margin: 0;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    color: #334155;
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.auth-input::placeholder {
    color: #94a3b8;
}

/* Состояния Hover и Focus */
.auth-input:hover {
    background-color: #ffffff;
    border-color: #cbd5e1;
}

.auth-input:focus {
    background-color: #ffffff;
    border-color: var(--top-bg, #01a0e2);
    box-shadow: 0 0 0 4px rgba(1, 160, 226, 0.15); /* Мягкое свечение */
    outline: none;
}

/* Вывод ошибки (Доступность) */
.auth-input.is-invalid {
    border-color: #ef4444;
    background-color: #fef2f2;
}
.auth-input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.auth-password-toggle:hover {
    color: var(--top-bg, #01a0e2);
}

/* ==========================================================================
   OPTIONS & CHECKBOX
   ========================================================================== */
.auth-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -0.25rem;
    margin-bottom: 0.5rem;
}

/* Кастомный чекбокс */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.auth-checkbox input {
    display: none; /* Прячем дефолтный */
}

.auth-checkbox-mark {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.auth-checkbox input:checked + .auth-checkbox-mark {
    background-color: var(--top-bg, #01a0e2);
    border-color: var(--top-bg, #01a0e2);
}

.auth-checkbox input:checked + .auth-checkbox-mark::after {
    content: '\2714'; /* Галочка */
    color: white;
    font-size: 12px;
}

.auth-checkbox-text {
    font-size: 0.875rem;
    color: #64748b;
    user-select: none;
}

/* Второстепенные ссылки */
.auth-link-forgot {
    font-size: 0.875rem;
    color: var(--link-color, #007bff);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}
.auth-link-forgot:hover {
    color: var(--link-hover-color, #0056b3);
    text-decoration: underline;
}

/* ==========================================================================
   PRIMARY BUTTON (Акценты)
   ========================================================================== */
.auth-btn-primary {
    width: 100%;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    /* Жестко задаем синий цвет фона и белый текст */
    background-color: #01a0e2 !important; 
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(1, 160, 226, 0.3);
}

.auth-btn-primary:hover {
    background-color: #0286bc !important;
    box-shadow: 0 6px 16px rgba(1, 160, 226, 0.4);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.auth-btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(1, 160, 226, 0.3);
}

/* ==========================================================================
   FOOTER (Регистрация)
   ========================================================================== */
.auth-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

.auth-link-register {
    color: var(--top-bg, #01a0e2);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}

.auth-link-register:hover {
    text-decoration: underline;
}

/* ==========================================================================
   MANAGE PANEL (Для авторизованных)
   ========================================================================== */
.auth-manage__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

.auth-manage__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    color: var(--h1-color, #334155);
    text-decoration: none;
    transition: all 0.3s ease;
}

.auth-manage__card i {
    font-size: 1.5rem;
    color: var(--top-bg, #01a0e2);
}

.auth-manage__card:hover {
    background: #ffffff;
    border-color: var(--top-bg, #01a0e2);
    box-shadow: 0 10px 25px -5px rgba(1, 160, 226, 0.15);
    transform: translateY(-2px);
    color: var(--link-color, #007bff);
}

.auth-btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    color: #ef4444;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.auth-btn-logout:hover {
    background: #ef4444;
    color: #ffffff;
}

/* ==========================================================================
   АДАПТИВНОСТЬ (Mobile)
   ========================================================================== */
@media (max-width: 576px) {
    .auth-modal__content {
        padding: 1.5rem;
        border-radius: 20px;
    }
    .auth-manage__grid {
        grid-template-columns: 1fr;
    }
}