/* Фон и центрирование */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    height: 100vh;
    background: radial-gradient(
        circle at center,
        #ffffff,
        #6ee6fc,
        #ffffff
    );
    background-size: 150% 150%;
    background-position: center center;
    animation: gradient 10s ease-in-out infinite alternate;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes gradient {
    from {
        background-size: 120% 120%;
        background-position: center center;
    }
    to {
        background-size: 220% 220%;
        background-position: center center;
    }
}

/* Контейнер формы */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Блок формы */
.login-box {
    background: #fff;
    padding: 40px 50px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo img {
    height: 60px;
    width: auto;
}

/* Поля формы */
#login-form input[type="email"],
#login-form input[type="password"] {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid rgba(30,188,206,0.1);
    box-sizing: border-box;
    font-size: 14px;
}

/* Кнопка */
.btn-accent {
    background: #1EBCCE;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
}
.btn-accent:hover {
    background: #169EAD;
}
.btn-accent.full {
    width: 100%;
    display: block;
    margin-top: 16px;
}

/* Remember me */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #303030;
    margin: 10px 0;
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    border: 2px solid #1EBCCE;
    border-radius: 4px;
    background: white;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

/* Галочка через псевдоэлемент */
.remember-me input[type="checkbox"]::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 9px;
    border: solid #1EBCCE;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    top: -1px;
    left: 3px;
    transition: transform 0.15s ease;
}

.remember-me input[type="checkbox"]:checked::after {
    transform: rotate(45deg) scale(1);
}

/* Переключалка форм */
.form-toggle {
    text-align: center;
    margin-bottom: 20px;
}
.btn-toggle {
    background: #E0F7FA;
    border: 1px solid #1EBCCE;
    color: #1EBCCE;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin: 0 5px;
    transition: 0.2s;
}
.btn-toggle:hover {
    background: #c8f0f4;
    border-color: #18a3b3;
    color: #169ead;
}
.btn-toggle.active {
    background: #1EBCCE;
    color: white;
}

/* Поля демо-формы — стиль такой же, как у login-form */
#demo-form {
    display: none;
}

#demo-form input[type="text"],
#demo-form input[type="password"],
#demo-form input[type="tel"] {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid rgba(30,188,206,0.1);
    box-sizing: border-box;
    font-size: 14px;
}

#login-form input[type="email"]:focus,
#login-form input[type="password"]:focus,
#demo-form input[type="text"]:focus,
#demo-form input[type="password"]:focus,
#demo-form input[type="tel"]:focus,
#login-form input[type="email"]:focus-visible,
#login-form input[type="password"]:focus-visible,
#demo-form input[type="text"]:focus-visible,
#demo-form input[type="password"]:focus-visible,
#demo-form input[type="tel"]:focus-visible {
    outline: none !important;
    border-color: #1ebcce !important;
    outline-offset: 0 !important;
    box-shadow: 0 0 0 2px rgba(30, 188, 206, 0.25) !important;
}

.field-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

.field-required-popup {
    position: fixed;
    z-index: 11000;
    max-width: 250px;
    padding: 8px 10px;
    border: 1px solid #f8c7cc;
    border-radius: 8px;
    background: #fff;
    color: #c0392b;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    font-size: 13px;
    line-height: 1.3;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(4px);
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease, visibility 0s linear 0.14s;
}

.field-required-popup.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

/* Галочка согласия для демо */
.demo-consent-container {
    position: relative;
    margin: 10px 0;
    font-size: 14px;
}

.demo-consent-warning {
    position: absolute;
    right: 0;
    top: -8px;
    transform: translateY(-100%);
    max-width: 280px;
    padding: 8px 10px;
    border: 1px solid #f8c7cc;
    border-radius: 8px;
    background: #fff6f7;
    color: #c0392b;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
}

.demo-consent-warning.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(calc(-100% - 2px));
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.demo-agree {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 5px 0;
    cursor: pointer;
}

.demo-agree input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    border: 2px solid #1EBCCE;
    border-radius: 4px;
    background: white;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.demo-agree input[type="checkbox"]::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 9px;
    border: solid #1EBCCE;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    top: -1px;
    left: 3px;
    transition: transform 0.15s ease;
}

.demo-agree input[type="checkbox"]:checked::after {
    transform: rotate(45deg) scale(1);
}

.demo-agree a {
    color: #1EBCCE;
    text-decoration: underline;
}

/* Модалка демо-доступа */
#demo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
.demo-modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    top: 0;
    left: 0;
}
.demo-modal-content {
    position: relative;
    background: #fff;
    padding: 30px 25px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
    z-index: 10001;
    font-size: 16px;
}
.demo-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #1EBCCE;
}

@media (min-width: 768px) and (max-width: 1439px) {
    .login-box {
        max-width: 440px;
        padding: 34px 34px;
    }
}

@media (max-width: 767px) {
    body {
        min-height: 100dvh;
        height: auto;
        align-items: flex-start;
        overflow: auto;
        padding: 14px;
    }

    .login-container {
        align-items: flex-start;
        padding: 8px 0 20px;
    }

    .login-box {
        max-width: 100%;
        padding: 22px 16px;
        border-radius: 14px;
    }

    .form-toggle {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .btn-toggle {
        margin: 0;
    }

    .demo-consent-warning {
        left: 0;
        right: auto;
        max-width: min(100%, 300px);
    }

    .field-required-popup {
        max-width: 220px;
        font-size: 12px;
    }
}
