/* --- Стили Renovation Budget (Amber Theme) --- */

/* Глобальный сброс и box-sizing для всех элементов */
* {
    box-sizing: border-box;
}

:root {
    --accent-amber: #F59E0B;
    --accent-amber-dark: #D97706;
    --accent-amber-light: #FEF3C7;
    --gradient-amber-card: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --radius-lg: 16px;
    --font-main: 'Inter', sans-serif;
}

/* Base Layout */
.calc-header { margin-bottom: 24px; }
.subtitle { color: var(--text-secondary); margin-top: 8px; font-size: 16px; }
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1.2fr 0.8fr; } }

/* Inputs */
.calc-inputs { gap: 20px; }
.input-group { margin-bottom: 16px; }

.input-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.input-wrapper { position: relative; display: flex; align-items: center; }

.input-wrapper input {
    width: 100%; padding: 12px 14px; padding-right: 40px;
    font-size: 16px; font-weight: 500;
    border: 1px solid #E5E7EB; border-radius: 10px;
    outline: none; transition: border 0.2s; background: #fff;
    font-family: var(--font-main);
}
.input-wrapper input:focus { border-color: var(--accent-amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1); }
.currency { position: absolute; right: 14px; color: var(--text-secondary); pointer-events: none; font-size: 14px; }

/* Type Selector */
.type-selector { margin-top: 8px; }
.type-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 768px) { .type-options { grid-template-columns: 1fr; } }

.type-option {
    border: 1px solid #E5E7EB; border-radius: 12px;
    padding: 16px; cursor: pointer; transition: all 0.2s;
    text-align: center; background: #fff;
}
.type-option:hover { border-color: #D1D5DB; background: #F9FAFB; }
.type-option input { display: none; }
.type-option.selected {
    border-color: var(--accent-amber); background: var(--accent-amber-light);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}
.type-icon { font-size: 24px; display: block; margin-bottom: 8px; }
.type-title { display: block; font-weight: 600; color: var(--text-primary); }
.type-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* Range Slider */
.range-slider-wrapper { margin-top: 8px; }
.range-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
#urgency-value { font-weight: 700; color: var(--accent-amber); }
.slider {
    width: 100%; height: 6px;
    border-radius: 3px; background: #E5E7EB;
    outline: none; -webkit-appearance: none;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 22px; height: 22px;
    border-radius: 50%; background: var(--accent-amber);
    border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
}
.slider::-moz-range-thumb {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent-amber); border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2); cursor: pointer;
}
.range-ticks {
    display: flex; justify-content: space-between; margin-top: 8px;
    font-size: 11px; color: var(--text-secondary);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
}
@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
}

.category-checkbox {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}
.category-checkbox:hover {
    border-color: #D1D5DB;
    background: #F9FAFB;
}
.category-checkbox input:checked + .checkmark + .category-label + .category-percent {
    color: var(--accent-amber-dark);
    font-weight: 700;
}
.category-checkbox input:checked ~ .category-label .category-icon {
    transform: scale(1.1);
}
.category-label {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}
.category-icon {
    font-size: 20px;
    transition: transform 0.2s;
}
.category-text {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}
.category-percent {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Checkboxes */
.checkmark {
    width: 20px; height: 20px; border: 2px solid #D1D5DB;
    border-radius: 6px; margin-right: 12px; position: relative;
    transition: all 0.2s; flex-shrink: 0;
}
.category-checkbox input { display: none; }
.category-checkbox input:checked + .checkmark {
    background: var(--accent-amber); border-color: var(--accent-amber);
}
.category-checkbox input:checked + .checkmark::after {
    content: ''; position: absolute; left: 5px; top: 2px;
    width: 6px; height: 10px; border: solid white;
    border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Button Group */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.button-group .btn {
    flex: 1;
}

/* Result Card */
.card--amber { background: var(--gradient-amber-card); color: #fff; border: none; }
.card--amber h2 { color: rgba(255,255,255,0.95); margin-bottom: 24px; text-align: center; font-size: 20px; }
@media (min-width: 900px) { .sticky-card { position: sticky; top: 24px; } }

.price-big {
    font-size: 56px; font-weight: 800; line-height: 1;
    margin-bottom: 24px; display: flex; justify-content: center;
    align-items: baseline; gap: 8px;
    overflow-wrap: break-word;
    word-break: break-word;
}
.price-big .currency { font-size: 32px; font-weight: 600; opacity: 0.9; }

.cost-details {
    background: rgba(255,255,255,0.1); border-radius: 12px;
    padding: 16px; margin-bottom: 24px;
}
.detail-row {
    display: flex; justify-content: space-between;
    margin-bottom: 8px; font-size: 14px;
}
.detail-row:last-child { margin-bottom: 0; }
.detail-row strong { font-size: 16px; }

.summary-divider { height: 1px; background: rgba(255,255,255,0.2); margin: 24px 0; }

/* KILLER FEATURE: Interactive Pie Chart */
.chart-container { 
    margin-top: 24px; 
    max-width: 100%;
}
.chart-container h3 { 
    font-size: 16px; 
    margin-bottom: 16px; 
    text-align: center; 
    color: rgba(255,255,255,0.95);
}
.chart-wrapper {
    position: relative; 
    background: rgba(255,255,255,0.1);
    border-radius: 12px; 
    padding: 20px; 
    margin-bottom: 16px;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
}
.chart-wrapper canvas,
.chart-wrapper svg {
    max-width: 100%;
    height: auto;
}
.chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    width: 100px;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.chart-center span {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.chart-center small {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    margin-top: 4px;
}
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.legend-item:hover {
    background: rgba(255,255,255,0.1);
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}
.chart-note {
    font-size: 12px;
    text-align: center;
    color: rgba(255,255,255,0.8);
    margin-top: 8px;
}

/* Recommendations */
.recommendations {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
}
.recommendations h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: rgba(255,255,255,0.95);
}
#recommendations-list {
    margin: 0;
    padding-left: 20px;
}
#recommendations-list li {
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 8px;
    line-height: 1.5;
}
#recommendations-list li:last-child {
    margin-bottom: 0;
}

.tip-box {
    font-size: 13px; opacity: 0.9; line-height: 1.5;
    padding: 16px; background: rgba(255,255,255,0.1);
    border-radius: 12px; margin-top: 24px;
}

/* Info Wrapper */
.info-wrapper { padding: 60px 0 60px 0; margin-top: 60px; border-top: 1px solid rgba(0,0,0,0.06); margin-bottom: 20px; }
.info-wrapper .container { max-width: 800px; margin: 0 auto; }

.icon-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; font-size: 24px; font-weight: 800; color: var(--text-primary); line-height: 1.3; }
.header-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.04); flex-shrink: 0; margin-top: -4px; }
.amber-icon svg { color: #F59E0B; }
.orange-icon svg { color: #F97316; }
.red-icon svg { color: #EF4444; }

.intro-text { font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.6; }

.formulas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 48px; }
.formula-card { background: #fff; border: 1px solid rgba(0,0,0,0.04); box-shadow: var(--shadow-soft); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; }
.formula-header { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.formula-card h3 { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.formula-card p { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.5; font-weight: 500; }
.badge-amber { background: #F59E0B; color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-green { background: #10B981; color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.math-expression { background: #F9FAFB; border: 1px solid #E5E7EB; padding: 12px 16px; border-radius: 12px; font-weight: 700; color: var(--accent-amber-dark); text-align: center; margin-bottom: 16px; font-size: 15px; }

/* Table */
.table-wrapper { overflow-x: auto; margin-bottom: 24px; border-radius: 12px; border: 1px solid #E5E7EB; }
.comparison-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.comparison-table th { background: #F9FAFB; padding: 12px 16px; text-align: left; font-size: 13px; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; border-bottom: 1px solid #E5E7EB; }
.comparison-table td { padding: 16px; font-size: 14px; color: var(--text-primary); border-bottom: 1px solid #F3F4F6; }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr:hover td { background: var(--accent-amber-light); }

/* Links */
.info-wrapper a {
    color: var(--accent-amber-dark); text-decoration: underline; text-decoration-color: rgba(217, 119, 6, 0.3); font-weight: 600; transition: all 0.2s ease;
}
.info-wrapper a:hover { color: var(--accent-amber); background: rgba(245, 158, 11, 0.05); border-radius: 4px; }

.soft-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, #E5E7EB, transparent); margin: 48px 0; }

/* FAQ */
.faq-fuel-style .faq-item { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; margin-bottom: 12px; overflow: hidden; transition: all 0.2s ease; }
.faq-fuel-style .faq-item[open] { border-color: var(--accent-amber); box-shadow: 0 4px 20px rgba(245, 158, 11, 0.1); }
.faq-fuel-style summary.faq-question { padding: 16px 20px; cursor: pointer; font-weight: 600; color: var(--text-primary); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-fuel-style .faq-item[open] summary.faq-question { color: var(--accent-amber-dark); background: var(--accent-amber-light); }
.faq-question::after { content: '+'; font-size: 20px; color: var(--text-secondary); font-weight: 400; line-height: 1; }
.faq-fuel-style .faq-item[open] summary.faq-question::after { content: '−'; color: var(--accent-amber-dark); }
.faq-answer { padding: 20px; color: var(--text-secondary); line-height: 1.6; font-size: 15px; }

/* Mobile */
@media (max-width: 900px) {
    .formulas-grid { grid-template-columns: 1fr; gap: 16px; margin-bottom: 32px; }
    .icon-heading { font-size: 20px; gap: 12px; margin-bottom: 20px; }
    .header-icon { width: 40px; height: 40px; border-radius: 12px; }
    .header-icon svg { width: 20px; height: 20px; }
    .formula-card { padding: 24px; text-align: center; align-items: center; }
    .formula-header { align-items: center; width: 100%; }
    .math-expression { width: 100%; max-width: 300px; margin-left: auto; margin-right: auto; }
    .info-wrapper { margin-top: 40px; padding-top: 40px; }
    .type-options { grid-template-columns: 1fr; }
    .chart-wrapper { padding: 12px; min-height: 300px; }
    .chart-center { width: 80px; height: 80px; }
    .chart-center span { font-size: 16px; }
    .chart-center small { font-size: 10px; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- СТИЛИ ДЛЯ SIDEBAR (СМОТРИТЕ ТАКЖЕ) --- */
.sidebar-related {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.sidebar-related h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 600px) {
    .related-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.related-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-card:hover {
    border-color: var(--accent-amber);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
    transform: translateY(-2px);
}

.related-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.related-info {
    flex: 1;
    min-width: 0;
}

.related-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.related-info span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ (дополнительные исправления) --- */
@media (max-width: 768px) {
    .calc-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .calc-inputs, .calc-results {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    .card {
        border-radius: 12px;
        margin: 0;
        padding: 16px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .input-wrapper input {
        padding: 12px;
        font-size: 16px;
        box-sizing: border-box;
    }
    
    .price-big {
        font-size: 36px;
    }
    
    .price-big .currency {
        font-size: 22px;
    }
    
    .type-options {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        padding: 12px;
        min-height: 260px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chart-center {
        width: 60px;
        height: 60px;
    }
    
    .chart-center span {
        font-size: 13px;
    }
    
    .chart-center small {
        font-size: 8px;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .calc-header {
        padding: 0 16px;
    }
    
    .calc-header h1 {
        font-size: 22px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .calc-grid {
        padding: 0 16px;
        gap: 12px;
    }
    
    .info-wrapper .container {
        padding: 0 16px;
    }
    
    .formula-card {
        padding: 14px;
    }
    
    .comparison-table {
        min-width: 100%;
        font-size: 12px;
    }
    
    .table-wrapper {
        margin: 0 -16px;
        border-radius: 0;
    }
    
    .price-big {
        font-size: 32px;
    }
    
    .price-big .currency {
        font-size: 20px;
    }
    
    .cost-details {
        padding: 12px;
    }
    
    .detail-row {
        font-size: 13px;
    }
    
    .detail-row strong {
        font-size: 14px;
    }
    
    .type-option {
        padding: 12px;
    }
    
    .category-checkbox {
        padding: 10px;
    }
    
    .chart-wrapper {
        padding: 10px;
        min-height: 240px;
    }
    
    .chart-center {
        width: 50px;
        height: 50px;
    }
    
    .chart-center span {
        font-size: 12px;
    }
}