/* === Статичный фон === */

body {
    margin: 0;
    font-family: var(--font-family-base);
    background: var(--firm-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

@media (min-width: 769px) {
    body {
        align-items: center;
    }
}

/* Контейнер */
.login-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 850px;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 10px;
    overflow: visible;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Левая часть */
.login-illustration {
    background: linear-gradient(135deg, var(--linear-color1), var(--linear-color2));
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px;
}
.illustration-image {
    max-width: 160px;
    margin-bottom: 6px;
}
.login-illustration h3 {
    font-size: 20px;
    margin-bottom: 6px;
}
.login-illustration p {
    font-size: 14px;
    opacity: 0.9;
}

/* Правая часть */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}
.login-card {
    width: 100%;
    max-width: 320px;
}
.logo-container {
    text-align: center;
    margin-bottom: 10px;
}
.logo-image {
    max-width: 150px;
    height: auto;
}
h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 16px;
}
h3 {
    text-align: center;
}

/* Плавающие лейблы */
.float-label {
    position: relative;
    margin-bottom: 10px;
    width: 100%;
    display: block;
    box-sizing: border-box;
}
.float-label label {
    position: absolute;
    top: 12px;
    left: 14px;
    color: #7f8c8d;
    font-size: 15px;
    pointer-events: none;
    transition: 0.2s ease all;
    background: #fff;
    padding: 0 4px;
}

/* Инпуты PrimeFaces */
.float-label .ui-inputtext,
.float-label .ui-password,
.float-label .ui-inputsecret,
.float-label .ui-inputtextarea {
    width: 100% !important;
    display: block !important;
    padding: 8px 8px 6px 8px !important;
    border: 2px solid #dcdcdc !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    transition: border-color 0.3s ease !important;
    box-sizing: border-box !important;
}

.float-label input[type="text"],
.float-label input[type="password"],
.float-label .ui-password input,
.float-label .ui-inputtextarea input {
    width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

/* Поднимаем лейбл */
.float-label input:focus + label,
.float-label input:not(:placeholder-shown) + label,
.float-label .ui-inputtext.ui-state-filled + label,
.float-label .ui-inputsecret.ui-state-filled + label {
    top: -8px;
    left: 10px;
    font-size: 12px;
    color: #0077ff;
}

/* Фокус */
.float-label input:focus,
.float-label .ui-inputtext:focus,
.float-label .ui-password input:focus {
    border-color: var(--linear-color1) !important;
    box-shadow: 0 0 0 2px rgba(0, 119, 255, 0.1);
}

/* Поднимаем лейбл для textarea */
.float-label textarea:focus + label,
.float-label textarea:not(:placeholder-shown) + label,
.float-label .ui-inputtextarea.ui-state-filled + label {
    top: -8px;
    left: 10px;
    font-size: 12px;
    color: #0077ff;
}

/* Фокус textarea */
.float-label textarea:focus,
.float-label .ui-inputtextarea:focus {
    border-color: var(--linear-color1) !important;
    box-shadow: 0 0 0 2px rgba(0, 119, 255, 0.1);
}

/* Checkbox + Кнопка */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    color: #7f8c8d;
}
.ui-button.login-btn  {
    width: 100%;
    padding: 14px;
    background-color: var(--button-color) !important;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.ui-button.login-btn:hover {
    background-color: var(--button-color-hover) !important;
}

.emergency-btn {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 5px 5px !important;
    background-color: #fff59d !important; /* жёлтый */
    border: 2px solid blue !important; /* голубая рамка */
    border-radius: 20px !important;

    color: red !important;
    font-size: 24px !important;
    font-weight: 900 !important;
    text-align: center;
}


/* hover */
.emergency-btn:hover {
    background-color: red !important;
    color: yellow !important;
}

.emergency-btn:hover::before {
    filter: brightness(1.1);
}

@keyframes sos-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* картинка SOS */
.emergency-btn::before {
    content: "";
    width: 64px;
    height: 64px;
    margin-bottom: 5px;

    background-image: url("/person/jakarta.faces.resource/img/sos.png.xhtml");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;

    animation: sos-pulse 1.3s infinite ease-in-out;
}



@keyframes btn-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 0, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

.emergency-btn {
    animation: btn-pulse 2s infinite;
}


/* Ссылки */
.links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    font-size: 14px;
}
.links a {
    color: var(--linear-color1);
    text-decoration: none;
}
.links a:hover {
    text-decoration: underline;
}

/* Правка для p:button внутри .links */
.links .ui-button {
    width: 100%;
}

/* Анимации */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}
.animate-in {
    animation-name: fadeInUp;
    animation-duration: 0.8s;
    animation-timing-function: ease;
    animation-fill-mode: forwards;
    opacity: 0;
}
@keyframes fadeInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Адаптация */
@media (max-width: 768px) {
    .login-wrapper {
        grid-template-columns: 1fr;
        max-width: 400px;
        width: 90%;
        margin: 0 auto;
    }
    .login-illustration {
        display: none;
    }
    .login-card {
        max-width: 100%;
    }
}
@media (max-height: 850px) {
    body {
        overflow-y: auto;
    }
}

/* ВСЕГДА 3 в ряд */
.messenger-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
}

/* Общий контейнер */
.messenger-group {
    margin: 4px 0;
}

.messenger-fieldset {
    border: 2px solid #dcdcdc;
    padding: 8px 12px 10px 12px;
    border-radius: 8px;
    background: #fff;
}

.messenger-fieldset legend {
    padding: 0 2px;
    font-size: 15px;
    color: #2c3e50;
    font-weight: 600;
}

/* Контейнер одного чекбокса */
.messenger-checkbox {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 14px;
    color: #444;
    margin: 0;
    padding: 0;
}

/* === PrimeFaces checkbox === */
.messenger-checkbox .ui-chkbox {
    display: flex;
    align-items: center;
}

.messenger-checkbox .ui-chkbox-box {
    width: 16px !important;
    height: 18px !important;
    border-radius: 4px !important;
    border: 2px solid #dcdcdc !important;
    transition: all 0.25s ease;
}

.messenger-checkbox .ui-chkbox-box.ui-state-hover {
    border-color: var(--linear-color1) !important;
}

.messenger-checkbox .ui-chkbox-box.ui-state-active {
    background: var(--linear-color1) !important;
    border-color: var(--linear-color1) !important;
}


/* Контейнер телефона */
.phone-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Иконка */
.phone-icon {
    position: absolute;
    top: 14px;
    left: 14px;
    color: #7f8c8d;
    font-size: 18px;
    z-index: 2;
    pointer-events: none;
}

/* Сдвигаем поле */
.phone-wrapper .ui-inputtext {
    padding-left: 42px !important;
}

/* Сдвиг label */
.phone-wrapper label {
    left: 42px !important;
}

/* Фокус */
.phone-wrapper .ui-inputtext:focus {
    border-color: var(--linear-color1) !important;
    box-shadow: 0 0 0 2px rgba(0,119,255,0.1);
}

/* Сроки полиса */
.policy-fieldset {
    border: 2px solid #dcdcdc;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    margin-bottom: 10px;
}
.policy-fieldset legend {
    padding: 0 6px;
    font-size: 15px;
    font-weight: 600;
}

.policy-row {
    display:flex;
    gap:10px;
}

.policy-item.policy-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.policy-inline-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 34px;
    font-size: 14px;
    color: #2c3e50;
    background: transparent;
    border-radius: 6px;
    padding: 0 4px;
}

.policy-item input.ui-inputfield,
.policy-item input.ui-datepicker-input,
.policy-item input[id$="_input"] {
    height: 34px !important;
    padding: 6px 10px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
    width: 100%;
    box-sizing: border-box;
}

.policy-item.compact input.ui-inputfield,
.policy-item.compact input[id$="_input"] {
    height: 30px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
}

/* === FILEUPLOAD === */
.float-fileupload {
    position: relative;
    margin-bottom: 18px;
}

.float-fileupload > label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #7f8c8d;
}

.p-fileupload.styled-fileupload {
    border: 2px solid #dcdcdc !important;
    border-radius: 8px !important;
    padding: 12px !important;
    background: #fff !important;
    box-sizing: border-box;
}

.ui-fileupload-buttonbar {
    display: flex !important;
    align-items: center;
    gap: 10px !important;
    padding: 0 !important;
    margin: 0 0 6px 0 !important;
    border: none !important;
    background: transparent !important;
}

.ui-fileupload-buttonbar .ui-button {
    border-radius: 8px !important;
    padding: 8px 14px !important;
    background-color:  steelblue !important;
    border: none !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease;
    width: 100% !important;
}
.ui-fileupload-buttonbar .ui-button:hover {
    background-color: dodgerblue !important;
}

.ui-fileupload-content {
    padding: 4px 0 0 0 !important;
    max-height: 120px;
    overflow-y: auto;
}

.ui-fileupload-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 !important;
}

.ui-fileupload-row > div {
    padding: 4px !important;
    font-size: 13px;
}

.ui-fileupload-preview,
.ui-fileupload-progress {
    display: none !important;
}

.ui-fileupload-filename {
    flex: 1 1 auto !important;
    font-size: 13px;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px;
    max-width: 210px !important;
    min-width: 150px !important;
}

.ui-fileupload-cancel {
    border-radius: 6px !important;
    background: #e74c3c !important;
}
.ui-fileupload-cancel:hover {
    background: #c0392b !important;
}


/* === PrimeFaces SelectOneMenu: фиксация переполнения === */
.ui-selectonemenu {
    width: 100% !important;
    box-sizing: border-box !important;
}
.ui-selectonemenu-label {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Защита от горизонтального переполнения */
.login-card,
.float-label,
.phone-wrapper {
    max-width: 100%;
    box-sizing: border-box;
}


/*  --------------------   */
/* Компактный календарь специально для формы регистрации */
.compact-datepicker .ui-inputtext {
    padding: 8px !important; /* Уменьшаем внутренние отступы поля */
}

/* Стили для самого всплывающего окна календаря */
body .ui-datepicker.ui-widget {
    z-index: 9999 !important; /* Гарантируем отображение поверх всех элементов */
    width: 280px !important;  /* Фиксируем ширину, чтобы не мерцал при расчете */
    font-size: 14px;
}

/* Уменьшаем ячейки календаря для компактности */
body .ui-datepicker table td {
    padding: 2px !important;
}

body .ui-datepicker table td > a,
body .ui-datepicker table td > span {
    padding: 4px !important;
    height: 30px !important;
    width: 30px !important;
    line-height: 30px !important;
    text-align: center;
}

/* Убираем конфликты с анимацией контейнера */
.login-card.animate-in {
    backface-visibility: hidden; /* Помогает при мерцании в Webkit (Safari/Chrome Mobile) */
}

/* Фикс для предотвращения закрытия из-за ресайза */
.ui-datepicker-touch-ui {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* Если при открытии календаря дергается фон */
body.ui-overflow-hidden {
    position: fixed;
    width: 100%;
}

/* Надпись на кнопке загрузить файлы что бы не пропадала пропадает */
.links {
    margin-bottom: calc(12px + env(safe-area-inset-bottom));
}


/* FIX: не скрывать текст кнопки fileUpload на мобильных */
@media (max-width: 640px) {
    .ui-fileupload-buttonbar .ui-button-text {
        display: inline !important;
    }
}

/* Гарантируем, что модальное окно всегда выше маски */
.ui-dialog {
    z-index: 1100 !important;
}
.ui-widget-overlay {
    z-index: 1050 !important;
    opacity: 0.5 !important;
    background: #000 !important;
}
/* Добавьте в конец login.css */
.ui-dialog.ui-widget-content {
    z-index: 1500 !important;
}
.ui-widget-overlay {
    z-index: 1499 !important;
}
