/* Стили для модального окна входа */

.modal {
    display: none; /* По умолчанию скрыто, JavaScript изменит на flex */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    overflow-x: hidden; /* Предотвращаем горизонтальный скролл */
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease;
    /* Центрирование модального окна */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#loginForm{
    width: 100%;
    max-width: 370px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.modal-content {
    background-color: var(--color-bg-white, #ffffff);
    margin: 0; /* Убираем margin, так как центрирование через flexbox */
    padding: 16px;
    padding-top: 60px; /* Отступ сверху для картинки */
    border: none;
    border-radius: 24px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    position: relative;
    box-sizing: border-box;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 24px;
    color: var(--color-text-black, #1f2330);
    text-align: center;
    font-size: 40px;
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

.modal-content label {
    display: block;
    margin-bottom: 8px;
    font-weight: 400;
    color: var(--color-text-secondary, #6F7286);
    font-size: 16px;
    line-height: 120%;
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.modal-content input[type="text"],
.modal-content input[type="password"] {
    width: 100%;
    height: 40px;
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    line-height: 120%;
    font-weight: 400;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* Стили как в generator_data */
    background: var(--color-bg-field, #E1E5EF);
    color: var(--color-text-primary, #202020);
}

.modal-content input[type="text"]::placeholder,
.modal-content input[type="password"]::placeholder {
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: 0%;
    color: var(--color-text-secondary, #6F7286);
    opacity: 1; /* Убеждаемся, что цвет применяется полностью */
}

.modal-content input[type="text"]:focus,
.modal-content input[type="password"]:focus {
    outline: none;
    background: var(--color-bg-field-hover, #d1d7e5);
}

.modal-content .login-btn {
    width: 100%;
    height: 40px;
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 14px;
    align-items: center;
    justify-content: center;
    background: var(--color-primary, #132431);
    color: var(--color-bg-white, #ffffff);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-top: 32px;
    margin-bottom: 24px;;
}

.modal-content .login-btn:hover {
    background-color: var(--color-primary-dark, #1f2937);
}

.modal-content .login-btn p{
    font-family: Source Sans 3;
    font-weight: 400;
    font-style: Regular;
    font-size: 16px;
    leading-trim: NONE;
    line-height: 120%;
    letter-spacing: 0%;
    margin: 0;
    padding: 0;
}

.close {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
    width: 40px;
    height: 40px;
    z-index: 2; /* Чтобы кнопка закрытия была поверх картинки */
}

.close img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease;
}

.close-icon-default {
    opacity: 1;
    z-index: 1;
}

.close-icon-hover {
    opacity: 0;
    z-index: 2;
}

.close:hover .close-icon-default,
.close:focus .close-icon-default {
    opacity: 0;
}

.close:hover .close-icon-hover,
.close:focus .close-icon-hover {
    opacity: 1;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
    text-align: center;
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: none;
}

.auth-text {
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 40px;
    line-height: 120%;
    letter-spacing: -0.01em; /* -1% */
    text-align: center;
    text-transform: uppercase;
    margin-top: 20px; /* Отступ сверху после картинки */
    margin-bottom: 25px;
    color: var(--color-text-black, #1f2330);
}

.auth-img {
    display: block;
    position: absolute;
    top: -65px; /* Половина высоты картинки, чтобы она выступала сверху */
    left: 50%;
    transform: translateX(-50%); /* Центрирование по горизонтали */
    width: 120px; /* Размер картинки */
    height: 120px;
    z-index: 1; /* Чтобы картинка была поверх границы модального окна */
}

/* Адаптивность для планшетов */
@media (max-width: 1024px) {
    .modal {
        padding: 20px;
    }
    
    .modal-content {
        padding: 20px;
        padding-top: 55px;
        max-width: 400px;
    }
    
    .modal-content h2 {
        font-size: 36px;
        margin-bottom: 20px;
    }
    
    .auth-img {
        width: 100px;
        height: 100px;
        top: -50px;
    }
    
    #loginForm {
        max-width: 100%;
    }
}

/* Адаптивность для мобильных устройств (768px — 320px) */
@media (max-width: 768px) {
    .modal {
        padding: 12px;
        align-items: center;
        justify-content: center;
    }

    .modal-content {
        padding: 20px 16px;
        padding-top: 50px;
        width: 100%;
        max-width: 100%;
        border-radius: 20px;
        margin: auto;
    }

    .modal-content h2,
    .auth-text {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .modal-content .form-group {
        margin-bottom: 16px;
    }
    
    .modal-content label {
        font-size: 15px;
        margin-bottom: 6px;
    }
    
    .modal-content input[type="text"],
    .modal-content input[type="password"] {
        height: 44px;
        font-size: 16px;
        padding: 10px 16px;
        min-height: 44px;
    }
    
    .modal-content .login-btn {
        height: 44px;
        min-height: 44px;
        margin-top: 24px;
        margin-bottom: 20px;
    }
    
    .auth-img {
        width: 80px;
        height: 80px;
        top: -40px;
    }
    
    .close {
        right: 16px;
        top: 16px;
        width: 36px;
        height: 36px;
    }
    
    #loginForm {
        max-width: 100%;
    }
    
    .error-message {
        padding: 10px 12px;
        font-size: 14px;
        margin-bottom: 14px;
    }
}

/* Адаптивность для маленьких мобильных (480px и меньше) */
@media (max-width: 480px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        padding: 16px 14px;
        padding-top: 45px;
        border-radius: 16px;
    }
    
    .modal-content h2,
    .auth-text {
        font-size: 24px;
        margin-bottom: 16px;
    }
    
    .modal-content .form-group {
        margin-bottom: 14px;
    }
    
    .modal-content label {
        font-size: 14px;
    }
    
    .modal-content input[type="text"],
    .modal-content input[type="password"] {
        height: 42px;
        min-height: 42px;
        font-size: 16px;
        padding: 8px 14px;
    }
    
    .modal-content .login-btn {
        height: 42px;
        min-height: 42px;
        padding: 12px;
        margin-top: 20px;
        margin-bottom: 16px;
        font-size: 15px;
    }
    
    .modal-content .login-btn p {
        font-size: 15px;
    }
    
    .auth-img {
        width: 70px;
        height: 70px;
        top: -35px;
    }
    
    .close {
        right: 12px;
        top: 12px;
        width: 32px;
        height: 32px;
    }
    
    .error-message {
        padding: 10px;
        font-size: 13px;
        margin-bottom: 12px;
    }
}

/* Адаптивность для очень маленьких экранов (320px) */
@media (max-width: 360px) {
    .modal {
        padding: 8px;
    }
    
    .modal-content {
        padding: 14px 12px;
        padding-top: 42px;
        border-radius: 14px;
    }
    
    .modal-content h2,
    .auth-text {
        font-size: 20px;
        margin-bottom: 14px;
    }
    
    .modal-content .form-group {
        margin-bottom: 12px;
    }
    
    .modal-content label {
        font-size: 13px;
    }
    
    .modal-content input[type="text"],
    .modal-content input[type="password"] {
        height: 40px;
        min-height: 40px;
        font-size: 16px;
        padding: 8px 12px;
    }
    
    .modal-content .login-btn {
        height: 40px;
        min-height: 40px;
        padding: 10px;
        margin-top: 18px;
        margin-bottom: 14px;
        font-size: 14px;
    }
    
    .modal-content .login-btn p {
        font-size: 14px;
    }
    
    .auth-img {
        width: 60px;
        height: 60px;
        top: -30px;
    }
    
    .close {
        right: 10px;
        top: 10px;
        width: 28px;
        height: 28px;
    }
    
    .error-message {
        padding: 8px 10px;
        font-size: 12px;
        margin-bottom: 10px;
    }
}
