@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&display=swap');

@font-face {
    font-family: 'Inter';
    font-weight: 400;
    font-style: normal;
    src: url('../fonts/Inter-Regular.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    font-weight: 500;
    font-style: normal;
    src: url('../fonts/Inter-Medium.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    font-weight: 600;
    font-style: normal;
    src: url('../fonts/Inter-SemiBold.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    font-weight: 700;
    font-style: normal;
    src: url('../fonts/Inter-Bold.otf') format('opentype');
    font-display: swap;
}

:root {
    --brand: #704EAC;
    --brand-hover: #563492;
    --brand-2: #7E60B4;
    --brand-light: #F1EDF7;
    --brand-soft: #D4CAE6;
    --brand-dark: #4C3F6A;

    --accent: #FFB016;
    --accent-glow: rgba(237, 197, 53, 0.43);
    --success: #4CC3A6;
    --success-soft: #E8F5E9;

    --text: #0B2027;
    --text-2: #23363D;
    --text-muted: #6D797D;

    --bg: #FCFAFA;
    --surface: #FEFEFE;
    --surface-2: #FFFFFF;
    --border: #E7E9E9;
    --track: #F0F0F0;

    --shadow-card: 0 5px 4px 0 rgba(0, 0, 0, 0.05);
    --shadow-card-lg: 0 8px 8px 0 rgba(0, 0, 0, 0.08);
    --shadow-ring: 0 0 1px 1px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 4px 25px 0 var(--accent-glow);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-pill: 39px;

    --container: 1296px;
    --gutter: 40px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.logo-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1;
    color: var(--brand);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.phone-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.icon {
    display: inline-block;
    background-color: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-mode: alpha;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    flex-shrink: 0;
    vertical-align: middle;
    width: 1em;
    height: 1em;
}

.icon-sign-in { mask-image: url('../assets/icons/sign-in.svg'); -webkit-mask-image: url('../assets/icons/sign-in.svg'); }
.icon-caret-down { mask-image: url('../assets/icons/caret-down.svg'); -webkit-mask-image: url('../assets/icons/caret-down.svg'); }
.icon-plus { mask-image: url('../assets/icons/plus.svg'); -webkit-mask-image: url('../assets/icons/plus.svg'); }
.icon-minus { mask-image: url('../assets/icons/minus.svg'); -webkit-mask-image: url('../assets/icons/minus.svg'); }
.icon-whatsapp { mask-image: url('../assets/icons/whatsapp.svg'); -webkit-mask-image: url('../assets/icons/whatsapp.svg'); }
.icon-envelope { mask-image: url('../assets/icons/envelope.svg'); -webkit-mask-image: url('../assets/icons/envelope.svg'); }

.lang-dropdown {
    position: relative;
}

.lang-dropdown summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    color: var(--text);
    padding: 6px 4px;
}

.lang-dropdown summary::-webkit-details-marker {
    display: none;
}

.lang-dropdown summary:hover {
    color: var(--brand);
}

.lang-dropdown .caret {
    transition: transform 0.2s ease;
}

.lang-dropdown[open] .caret {
    transform: rotate(180deg);
}

.lang-dropdown[open] summary {
    color: var(--brand);
}

.lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card-lg);
    min-width: 90px;
    padding: 6px 0;
    z-index: 50;
}

.lang-menu a {
    display: block;
    padding: 8px 16px;
    font-size: 15px;
    color: var(--text);
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-menu a:hover {
    background: var(--brand-light);
    color: var(--brand);
}

.lang-menu a.is-active {
    color: var(--brand);
    font-weight: 500;
}

.container-x {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 16px;
}

@media (min-width: 768px) {
    .container-x {
        padding-inline: 24px;
    }
}

@media (min-width: 1024px) {
    .container-x {
        padding-inline: var(--gutter);
    }
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--track);
    border-radius: var(--radius-pill);
    outline: none;
}

.range-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(to right, var(--brand) 0%, var(--brand) var(--val, 50%), var(--track) var(--val, 50%), var(--track) 100%);
    border-radius: var(--radius-pill);
}

.range-slider::-moz-range-track {
    height: 6px;
    background: var(--track);
    border-radius: var(--radius-pill);
}

.range-slider::-moz-range-progress {
    height: 6px;
    background: var(--brand);
    border-radius: var(--radius-pill);
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--brand);
    box-shadow: 0 2px 6px rgba(112, 78, 172, 0.4);
    cursor: pointer;
    margin-top: -9px;
    transition: transform 0.15s ease;
}

.range-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--brand);
    box-shadow: 0 2px 6px rgba(112, 78, 172, 0.4);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.range-slider:hover::-webkit-slider-thumb {
    transform: scale(1.1);
}

.range-slider:hover::-moz-range-thumb {
    transform: scale(1.1);
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary .faq-icon {
    transition: transform 0.3s ease;
}

.faq-item[open] summary .faq-icon {
    transform: rotate(45deg);
}

.faq-item[open] summary {
    color: var(--brand);
}

.faq-tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    color: var(--text);
}

.faq-tab:hover {
    background: rgba(112, 78, 172, 0.06);
}

.faq-tab.is-active {
    background: var(--brand-light);
}

.faq-dot {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--brand-soft);
    transition: background 0.2s ease;
}

.faq-tab.is-active .faq-dot {
    background: var(--brand);
}

.faq-tab-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 400;
}

.faq-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.faq-tab.is-active .faq-chevron {
    color: var(--brand);
    transform: translateX(2px);
}

.faq-panel {
    display: none;
}

.faq-panel.is-active {
    display: block;
}

.mobile-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 320px;
    max-width: 85vw;
    background: var(--surface);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.mobile-menu.is-open {
    transform: translateX(0);
}

.mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 32, 39, 0.5);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.menu-open {
    overflow: hidden;
}

/* === Auth block (роль пользователя → видимость ссылок) === */
#auth-block .auth-client,
#auth-block .auth-partner,
#auth-block .auth-admin,
#auth-block .auth-admin-switch {
    display: none !important;
}

body.user-client #auth-block .auth-guest { display: none !important; }
body.user-client #auth-block .auth-client.auth-link { display: inline-flex !important; }
body.user-client #auth-block .auth-client.auth-logout { display: none !important; }
body.user-client.in-borrower #auth-block .auth-client.auth-link { display: none !important; }
body.user-client.in-borrower #auth-block .auth-client.auth-logout { display: inline-flex !important; }

body.user-partner #auth-block .auth-guest { display: none !important; }
body.user-partner #auth-block .auth-partner.auth-link { display: inline-flex !important; }
body.user-partner #auth-block .auth-partner.auth-logout { display: none !important; }
body.user-partner.in-partner #auth-block .auth-partner.auth-link { display: none !important; }
body.user-partner.in-partner #auth-block .auth-partner.auth-logout { display: inline-flex !important; }

body.user-admin #auth-block .auth-guest { display: none !important; }
body.user-admin #auth-block .auth-admin.auth-link { display: inline-flex !important; }
body.user-admin #auth-block .auth-admin.auth-logout { display: inline-flex !important; }

body.user-admin-switch #auth-block .auth-guest { display: none !important; }
body.user-admin-switch #auth-block .auth-admin-switch { display: inline-flex !important; }

body.user-client #login-form-container,
body.user-partner #login-form-container,
body.user-admin #login-form-container,
body.user-admin-switch #login-form-container {
    display: none;
}

/* === Modal (стилизация Bootstrap modal классов под наш дизайн) === */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}
.modal.fade .modal-dialog {
    transform: translateY(-20px);
    transition: transform 0.25s ease-out;
}
.modal.in .modal-dialog {
    transform: translateY(0);
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background-color: #0B2027;
}
.modal-backdrop.fade { opacity: 0; }
.modal-backdrop.in { opacity: 0.5; }
.modal-open { overflow: hidden; }
.modal-open .modal { overflow-x: hidden; overflow-y: auto; }

.modal-dialog {
    position: relative;
    width: auto;
    margin: 40px auto;
    max-width: 420px;
    padding: 0 16px;
}
.modal-content {
    background: var(--surface-2);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    border: none;
}
.modal-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.modal-title {
    flex: 1;
    font-weight: 700;
    font-size: 20px;
    margin: 0;
    color: var(--text);
}
.modal-header .close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    opacity: 1;
    text-shadow: none;
}
.modal-header .close:hover {
    color: var(--text);
}
.modal-body {
    padding: 24px;
}
.modal-body h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.modal-body h4.text-blue {
    color: var(--brand);
    font-size: 13px;
    margin: 16px 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.modal-footer {
    padding: 0 24px 24px;
    border-top: none;
}

/* form controls */
.form-group {
    margin-bottom: 14px;
}
.form-control,
.credit-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--surface-2);
    color: var(--text);
    line-height: 1.4;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}
.form-control:focus,
.credit-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}
.form-control::placeholder,
.credit-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.input-group {
    display: flex;
    align-items: stretch;
    position: relative;
}
.input-group .form-control,
.input-group .credit-input {
    flex: 1;
}
.input-group-addon {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-2);
}
.input-group .form-control:not(:last-child),
.input-group .credit-input:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group-addon a img,
.input-group-addon img {
    width: 18px;
    height: 18px;
    /* Перекрашиваем голубую иконку в брендовый фиолетовый #704EAC */
    filter: brightness(0) saturate(100%) invert(30%) sepia(43%) saturate(1336%) hue-rotate(245deg) brightness(96%) contrast(101%);
    opacity: 0.75;
    transition: opacity 0.2s ease;
}
.input-group-addon a:hover img {
    opacity: 1;
}

.box-line-credit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    font-size: 14px;
}
.box-line-credit a {
    color: var(--brand);
}
.box-line-credit a:hover {
    color: var(--brand-hover);
    text-decoration: underline;
}
.pull-left { /* legacy hint, flex уже разнесёт */ }
.pull-right { /* legacy hint, flex уже разнесёт */ }

/* legacy btn helpers — переопределяем под наш btn-primary */
.btn.btn-flat.btn-fiolet,
.btn-fiolet {
    background: var(--brand);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 15px;
    line-height: 1.4;
    border: none;
    transition: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}
.btn.btn-flat.btn-fiolet:hover,
.btn-fiolet:hover {
    background: var(--brand-hover);
}
.width-100 { width: 100%; }
.text-blue { color: var(--brand); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.input-error {
    display: block;
    color: #d32f2f;
    font-size: 13px;
    margin-top: 6px;
}

/* === Select2 совмещён с .credit-input/.form-control === */
/* #5381: дефолтный Select2 был ниже и тоньше обычных инпутов на форме регистрации/анкеты. */
.select2-container--default .select2-selection--single {
    height: auto;
    min-height: 45px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1.4;
    padding: 11px 36px 11px 14px; /* справа место под стрелку */
    color: var(--text);
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted);
    opacity: 1;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 10px;
    height: 100%;
    width: 20px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
    outline: none;
}
.select2-container--default .select2-dropdown {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--brand);
    color: #fff;
}
/* === Calculator: slider + input + promo === */
/* Перенесено из Public/index.html.twig — общий стиль jQuery UI слайдера и калькулятора. */
.calc-slider.ui-slider {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--track);
    border: none;
    border-radius: var(--radius-pill);
}
.calc-slider.ui-slider .ui-slider-range {
    background: var(--brand);
    height: 6px;
    border-radius: var(--radius-pill);
}
.calc-slider.ui-slider .ui-slider-handle {
    position: absolute;
    display: block;
    top: -9px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--brand);
    box-shadow: 0 2px 6px rgba(112, 78, 172, 0.4);
    margin-left: -12px;
    outline: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.calc-slider.ui-slider .ui-slider-handle:hover,
.calc-slider.ui-slider .ui-slider-handle:focus {
    outline: none;
    transform: scale(1.1);
}
.calc-input {
    width: auto;
    min-width: 60px;
    max-width: 120px;
    padding: 4px 0;
    background: transparent;
    border: none;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    text-align: right;
}
.calc-input:focus {
    outline: none;
}
.promo-status {
    display: none;
    color: #d32f2f;
    font-size: 13px;
    margin-top: 6px;
}
.promo-text {
    display: none;
    color: var(--success);
    font-size: 13px;
    margin-top: 6px;
}
.discount {
    display: none;
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 14px;
    margin-right: 4px;
}

/* === Tables (cabinet lists) === */
.tbl-cabinet {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.tbl-cabinet thead th {
    text-align: left;
    padding: 12px 14px;
    background: var(--brand-light);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
}
.tbl-cabinet thead th:first-child {
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}
.tbl-cabinet thead th:last-child {
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}
.tbl-cabinet tbody td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.tbl-cabinet tbody tr:last-child td {
    border-bottom: none;
}
.tbl-cabinet tbody tr:hover {
    background: var(--bg);
}
.tbl-cabinet .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-cabinet a { color: var(--brand); }
.tbl-cabinet a:hover { color: var(--brand-hover); text-decoration: underline; }

.badge-yes {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--success-soft);
    color: #1b6c3f;
    font-size: 12px;
    font-weight: 500;
}
.badge-no {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: #fee;
    color: #b71c1c;
    font-size: 12px;
    font-weight: 500;
}

/* Sidebar меню кабинета */
.cab-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cab-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    transition: background 0.15s ease, color 0.15s ease;
}
.cab-menu a:hover {
    background: var(--brand-light);
    color: var(--brand);
}
.cab-menu a.is-active {
    background: var(--brand);
    color: #fff;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.5;
    transition: background 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--brand-hover);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-stroke {
    background: transparent;
    color: var(--brand);
    border: 1.5px solid var(--brand);
    padding: 10.5px 22.5px;
    border-radius: var(--radius-sm);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.5;
    transition: background 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-stroke:hover {
    background: var(--brand-light);
}

.link-nav {
    color: var(--text);
    font-size: 15px;
    font-weight: 400;
    transition: color 0.2s ease;
    position: relative;
    white-space: nowrap;
}

@media (min-width: 1280px) {
    .link-nav {
        font-size: 16px;
    }
}

.link-nav:hover {
    color: var(--brand);
}

.link-nav.is-active {
    color: var(--brand);
}

.h1 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.h1-sm {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    line-height: 1.2;
}

.h2 {
    font-size: clamp(24px, 3.5vw, 36px);
    font-weight: 700;
    line-height: 1.6;
}

.h3 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.6;
}

.body-lg {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-muted);
}

.highlight-success {
    background: var(--success-soft);
    padding: 0 0.25em;
    border-radius: 4px;
}

.card {
    background: var(--surface-2);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-lg {
    background: var(--surface-2);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card-lg);
    overflow: hidden;
}
