/* ── PP24 Calculator v3 ──────────────────────────────────────────────────── */

.pp24-calc {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: transparent;
    border-radius: 16px;
    max-width: 1100px;
    margin: 0 auto;
    box-sizing: border-box;
}

*, *::before, *::after { box-sizing: inherit; }

/* ── Переключатель ───────────────────────────────────────────────────────── */

.pp24-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 14px 20px;
    border-bottom: none;   /* полоска управляется классом has-stripe */
    flex-wrap: wrap;
}

/* Полоска — это нижняя граница блока вкладок, включается из Elementor */
.pp24-calc.has-stripe .pp24-tabs {
    border-bottom: 1px solid #dde6f5;
}

.pp24-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border: 1.5px solid #d1dbe8;
    border-radius: 8px;
    background: transparent;
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color .18s, background .18s, border-color .18s, box-shadow .18s;
    white-space: nowrap;
    line-height: 1;
}

.pp24-tab:hover {
    color: #1a5cb4;
    border-color: #1a5cb4;
    background: #f0f6ff;
}

.pp24-tab.is-active {
    background-color: #1a5cb4;
    border-color: #1a5cb4;
    color: #fff;
    box-shadow: 0 3px 10px rgba(26,92,180,.25);
}

.pp24-tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.pp24-layout {
    display: grid;
    overflow: hidden;
    /* border-radius НЕ наследуем — иначе скругление виджета проникает в холст */
}

.pp24-layout--with-img {
    grid-template-columns: 1fr 1fr;
}

.pp24-layout--no-img {
    grid-template-columns: 1fr;
}

/* ── Картинка ────────────────────────────────────────────────────────────── */

.pp24-img-wrap {
    background: #dce8f8;
    position: relative;     /* нужно для абсолютного позиционирования img при cover/fill */
    min-height: 300px;
    overflow: hidden;
    border-radius: 0;       /* по умолчанию 0; контрол img_wrap_radius переопределит */
}

/* Изображение по умолчанию: contain, центрировано, с паддингом */
.pp24-img {
    display: block;
    max-width: calc(100% - 48px);
    max-height: 260px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center center;
    margin: 28px auto;
    transition: opacity .25s;
}

/* contain с выравниванием — управляется через margin + display flex на wrap */
.pp24-img-wrap.pp24-align-left   { justify-content: flex-start; }
.pp24-img-wrap.pp24-align-center { justify-content: center; }
.pp24-img-wrap.pp24-align-right  { justify-content: flex-end; }

.pp24-img-wrap.pp24-align-left   .pp24-img,
.pp24-img-wrap.pp24-align-center .pp24-img,
.pp24-img-wrap.pp24-align-right  .pp24-img {
    margin-left: 0;
    margin-right: 0;
}

/* Когда задан кастомный размер — margin auto не нужен, выравнивание через wrap */
.pp24-img-wrap.pp24-has-size {
    display: flex;
    align-items: center;
    padding: 24px;
}

.pp24-img-wrap.pp24-has-size .pp24-img {
    max-width: none;
    max-height: none;
    margin: 0;
    flex-shrink: 0;
}

/* cover — заполняет весь холст без паддинга */
.pp24-img.pp24-fit-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    object-fit: cover;
}

/* fill — растягивает без сохранения пропорций */
.pp24-img.pp24-fit-fill {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    object-fit: fill;
}

/* scale-down — как contain, но не увеличивает */
.pp24-img.pp24-fit-scale-down {
    object-fit: scale-down;
}

/* none — натуральный размер, без масштабирования */
.pp24-img.pp24-fit-none {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    object-fit: none;
}

/* ── Форма ───────────────────────────────────────────────────────────────── */

.pp24-form-wrap {
    background: #fff;
    padding: 26px 28px 22px;
    display: flex;
    flex-direction: column;
}

.pp24-form-title {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a2e4a;
    line-height: 1.3;
}

.pp24-divider {
    height: 2px;
    background: #1a5cb4;
    margin-bottom: 18px;
    border-radius: 2px;
}

/* ── Поля ────────────────────────────────────────────────────────────────── */

.pp24-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pp24-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pp24-row--full {
    grid-template-columns: 1fr;
}

.pp24-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pp24-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #4a5568;
}

.pp24-field input[type="number"],
.pp24-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d1dbe8;
    border-radius: 6px;
    font-size: 0.92rem;
    color: #1a2e4a;
    background: #f8fafd;
    transition: border-color .18s, box-shadow .18s;
    -moz-appearance: textfield;
    appearance: auto;
}

.pp24-field input::-webkit-outer-spin-button,
.pp24-field input::-webkit-inner-spin-button { -webkit-appearance: none; }

.pp24-field input:focus,
.pp24-field select:focus {
    outline: none;
    border-color: #1a5cb4;
    box-shadow: 0 0 0 3px rgba(26,92,180,.1);
    background: #fff;
}

/* ── Кнопка ──────────────────────────────────────────────────────────────── */

.pp24-calc__btn {
    width: 100%;
    margin-top: 16px;
    padding: 13px 20px;
    background: #f5a623;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s, box-shadow .18s, transform .1s;
    box-shadow: 0 4px 14px rgba(245,166,35,.3);
    letter-spacing: .01em;
}

.pp24-calc__btn:hover {
    background: #e09615;
    box-shadow: 0 6px 18px rgba(245,166,35,.4);
    transform: translateY(-1px);
}

.pp24-calc__btn:active { transform: translateY(0); }

/* ── Предупреждение ──────────────────────────────────────────────────────── */

.pp24-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 13px;
    background: #fff8ec;
    border-radius: 6px;
    border-left: 3px solid #f5a623;
}

.pp24-warning__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.pp24-warning__text {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.5;
}

/* ── Результаты ──────────────────────────────────────────────────────────── */

.pp24-calc__result {
    background: #f0f6ff;
    border-top: 2px solid #d1e2f7;
    padding: 24px 28px 28px;
}

.pp24-calc__result-title {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #1a2e4a;
}

.pp24-calc__result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.pp24-calc__result-group {
    background: #fff;
    border-radius: 10px;
    padding: 13px 15px;
    border: 1px solid #dce9f8;
}

.pp24-calc__result-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #1a5cb4;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e8f0fc;
}

.pp24-r-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.83rem;
    color: #334155;
    gap: 8px;
}

.pp24-r-row span:first-child { flex: 1; }

.pp24-v {
    font-weight: 600;
    color: #1a2e4a;
    text-align: right;
    white-space: nowrap;
}

.pp24-calc__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1a5cb4 0%, #1a2e4a 100%);
    color: #fff;
    border-radius: 10px;
    padding: 15px 22px;
    margin-bottom: 12px;
    gap: 16px;
}

.pp24-calc__total-label {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: .9;
}

.pp24-calc__total-value {
    font-size: 1.55rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
}

.pp24-price-notice {
    margin: 8px 0 0;
    font-size: .78rem;
    color: #92400e;
    background: #fef3c7;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #f59e0b;
}

/* ── Анимация ────────────────────────────────────────────────────────────── */

.pp24-calc__result.pp24-fade-in {
    animation: pp24Fade .3s ease;
}

@keyframes pp24Fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Адаптив ─────────────────────────────────────────────────────────────── */

@media (max-width: 820px) {
    .pp24-layout--with-img {
        grid-template-columns: 1fr;
    }
    .pp24-img-wrap {
        min-height: 180px;
        padding: 16px;
    }
    .pp24-form-wrap,
    .pp24-calc__result {
        padding-left: 18px;
        padding-right: 18px;
    }
    .pp24-calc__result-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .pp24-row { grid-template-columns: 1fr; }
    .pp24-tabs { padding: 10px 12px; gap: 6px; }
    .pp24-tab { padding: 8px 12px; font-size: .82rem; }
    .pp24-calc__total { flex-direction: column; align-items: flex-start; gap: 4px; }
    .pp24-calc__total-value { font-size: 1.3rem; }
}