:root {
    --primary-color: #6B7AA1;
    --primary-hover: #5B6A91;
    --text-primary: #19191C;
    --text-secondary: #757575;
    --border-color: #E8E8E8;
    --bg-light: #F8F8F8;
    --bg-gray: #EFEFEF;
    --white: #FFFFFF;
}

.calc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.calc-modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
}

.calc-modal.show {
    opacity: 1;
}

.calc-modal__container {
    position: relative;
    background: var(--white);
    border-radius: 12px;
    max-width: 540px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    margin-bottom: 40px;
}

.calc-modal.show .calc-modal__container {
    transform: translateY(0);
}

.calc-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-light);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.calc-modal__close:hover {
    background: #E0E0E0;
}

.calc-modal__close svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-primary);
    stroke-width: 2;
}

body.calc-modal-open {
    overflow: hidden;
}

.partition-calculator {
    background: var(--white);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    border-radius: 12px;
    overflow: hidden;
}

.calc-tabs {
    display: flex;
    gap: 0;
    padding: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
}

.calc-tab {
    flex: 1;
    padding: 16px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 400;
    text-align: center;
}

.calc-tab:hover {
    color: var(--primary-color);
    background: var(--bg-light);
}

.calc-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

.partition-calculator__content {
    padding: 24px;
}

.calc-tab-content {
    display: none;
}

.calc-tab-content.active {
    display: block;
}

.calc-partition-preview {
    width: 120px;
    height: 280px;
    border: 3px solid #19191C;
    background: var(--white);
    margin: 0 auto 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px;
}

.calc-partition-preview__section {
    flex: 1;
    background: linear-gradient(135deg, rgba(107, 122, 161, 0.08) 0%, rgba(107, 122, 161, 0.03) 100%);
    border: 1px solid #E8E8E8;
}

/* Навигация по стилям */
.calc-style-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}

.calc-style-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
    color: var(--text-primary);
}

.calc-style-nav-btn:hover:not(:disabled) {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.calc-style-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calc-style-label {
    font-size: 14px;
    color: var(--text-primary);
    min-width: 80px;
    text-align: center;
}

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

.calc-form-group:last-child {
    margin-bottom: 0;
}

.calc-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.calc-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.calc-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 122, 161, 0.1);
}

.calc-input::placeholder {
    color: #BDBDBD;
}

.calc-input:disabled,
.calc-input[readonly] {
    background: var(--bg-light);
    color: var(--text-secondary);
}

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

select.calc-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23757575' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ============================================
   ЦВЕТОВЫЕ КРУГИ
   ============================================ */

.calc-color-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.calc-color-option {
    position: relative;
}

.calc-color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.calc-color-circle {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 3px solid transparent;
    box-sizing: border-box;
    position: relative;
}

.calc-color-option input[type="radio"]:checked + .calc-color-circle {
    border-color: var(--primary-color);
}

.calc-color-option input[type="radio"]:checked + .calc-color-circle::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.3);
}

/* Цвета */
.calc-color-circle[data-color="black"] { background: #19191C; }
.calc-color-circle[data-color="white"] { background: #FFFFFF; border: 3px solid #E8E8E8; }
.calc-color-circle[data-color="gray1"] { background: #616161; }
.calc-color-circle[data-color="gray2"] { background: #424242; }
.calc-color-circle[data-color="brown1"] { background: #5D4037; }
.calc-color-circle[data-color="brown2"] { background: #4E342E; }
.calc-color-circle[data-color="gold"] { background: linear-gradient(135deg, #D4AF37 0%, #F9E79F 50%, #D4AF37 100%); }
.calc-color-circle[data-color="silver"] { background: linear-gradient(135deg, #C0C0C0 0%, #E8E8E8 50%, #C0C0C0 100%); }

.calc-stepper {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    background: var(--white);
}

.calc-stepper-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-primary);
    transition: all 0.2s;
    border-radius: 4px;
}

.calc-stepper-btn:hover:not(:disabled) {
    background: var(--bg-light);
}

.calc-stepper-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calc-stepper-value {
    min-width: 30px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}


.calc-info-section {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.calc-info-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.calc-info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.calc-info-row__label {
    color: var(--text-secondary);
}

.calc-info-row__value {
    font-weight: 500;
    color: var(--text-primary);
}


.calc-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
}

.calc-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.calc-checkbox label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}


.calc-price-block {
    background: var(--white);
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

.calc-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calc-price-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.calc-price-amount {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
}

.calc-price-currency {
    font-size: 18px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.calc-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.calc-btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.calc-btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(107, 122, 161, 0.25);
    transform: translateY(-1px);
}

.calc-btn-primary:active {
    transform: translateY(0);
}

.calc-btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.calc-btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.calc-navigation {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.calc-nav-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-color);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.calc-nav-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}


.calc-form-request {
    padding: 24px;
}

.calc-form-request__title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.calc-form-request__subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}


@media (max-width: 600px) {
    .calc-modal {
        padding: 10px;
    }
    
    .calc-modal__container {
        border-radius: 16px;
        max-width: 100%;
    }
    
    .partition-calculator__content {
        padding: 20px 16px;
    }
    
    .calc-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .calc-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 14px 16px;
        font-size: 13px;
    }
    
    .calc-input-row {
        grid-template-columns: 1fr;
    }
    
    .calc-price-amount {
        font-size: 28px;
    }
    
    .calc-partition-preview {
        width: 100px;
        height: 240px;
    }
}

@media (max-width: 400px) {
    .calc-color-picker {
        gap: 8px;
    }
    
    .calc-color-circle {
        width: 38px;
        height: 38px;
    }
    
    .calc-price-block {
        padding: 16px;
    }
}

.calc-partition-preview {
    width: 120px;
    height: 280px;
    margin: 0 auto 20px;
    position: relative;
    background: white;
}

.calc-partition-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}

.partition-frame {
    stroke: #19191C;
    stroke-width: 3;
    fill: none;
}

.partition-line {
    stroke: #19191C;
    stroke-width: 2;
    fill: none;
}

.partition-glass {
    fill: rgba(107, 122, 161, 0.05);
    stroke: none;
}

.partition-handle {
    fill: #19191C;
}

.calc-input--small {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 180px;
}

.calc-element-types {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.calc-element-types .calc-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.calc-input-row--qty {
    grid-template-columns: 1fr 72px;
}

.calc-input--qty {
    text-align: center;
}

.calc-error {
    margin-top: 6px;
    font-size: 12px;
    color: #D14343;
    line-height: 1.3;
}

.calc-glass-preview {
    margin-top: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.calc-glass-preview img {
    display: block;
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.calc-partition-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.calc-price-info {
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.calc-price-row--small {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.calc-price-row--small span:last-child {
    font-weight: 500;
    color: var(--text-primary);
}

.calc-partition-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}
.calc-partition-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.partition-frame { stroke: #19191C; stroke-width: 3; fill: none; }
.partition-line  { stroke: #19191C; stroke-width: 2; fill: none; }
.partition-glass { fill: rgba(107, 122, 161, 0.05); stroke: none; }
.partition-handle { fill: #19191C; }

.calc-element-types {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.1);
}
.calc-element-types .calc-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.calc-input--small {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 180px;
}

.calc-input-row--qty { grid-template-columns: 1fr 72px; }
.calc-input--qty { text-align: center; }

.calc-error {
    margin-top: 6px;
    font-size: 12px;
    color: #D14343;
    line-height: 1.3;
}

.calc-glass-preview {
    margin-top: 16px;
    border: 1px solid #E8E8E8;
    border-radius: 6px;
    overflow: hidden;
    background: #F8F8F8;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}
.calc-glass-preview img {
    display: block;
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.calc-tabs { padding-right: 48px; }

.calc-modal.active {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
}
.calc-modal__container { margin-left: auto; margin-right: auto; }

.calc-partition-preview.calc-preview-noimg::after {
    content: attr(data-label);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    padding: 12px;
    font-size: 13px;
    color: #757575;
    box-sizing: border-box;
}