/* --- Стили для 3D Графопостроителя (Math Theme) --- */
:root {
    --accent-math: #4F46E5; /* Индиго */
    --accent-math-light: #EEF2FF;
    --gradient-math-card: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    --text-math-dark: #312E81;
}

/* =========================================
   КАРКАС КАЛЬКУЛЯТОРА (Сетка и Инпуты)
   ========================================= */
.calc-header { margin-bottom: 32px; }
.subtitle { color: var(--text-secondary); margin-top: 8px; }

/* 2-колоночная сетка */
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1.2fr 0.8fr; } }

.calc-inputs { gap: 16px; }
.input-group { margin-bottom: 16px; }
.input-group label { 
    display: block; font-size: 14px; font-weight: 600; 
    margin-bottom: 8px; color: var(--text-primary); 
}

/* Скрываем стрелки у number */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Инпуты */
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper input, .input-wrapper select {
    width: 100%; padding: 14px 16px; 
    font-size: 16px; font-weight: 500;
    border: 1px solid #E5E7EB; border-radius: 12px;
    outline: none; transition: border 0.2s, box-shadow 0.2s;
    font-family: inherit; background: #fff; appearance: none;
}
.input-wrapper select { cursor: pointer; }
.input-wrapper input { padding-right: 16px; }

.input-wrapper input:focus, .input-wrapper select:focus { 
    border-color: var(--accent-math); 
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); 
}

.row-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.helper-text { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

/* Подсказка */
.info-alert {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--accent-math-light); border: 1px solid #C7D2FE;
    padding: 16px; border-radius: 12px; margin-top: 24px;
    color: var(--text-math-dark); font-size: 13px; line-height: 1.5;
}
.info-alert svg { flex-shrink: 0; color: var(--accent-math); margin-top: -2px; }

/* =========================================
   КАРТОЧКА РЕЗУЛЬТАТА И 3D КОНТЕЙНЕР
   ========================================= */
.card--math { 
    background: var(--gradient-math-card); 
    color: var(--text-math-dark); 
    border: 1px solid #C7D2FE; 
    padding: 0; 
    overflow: hidden;
}
@media (min-width: 900px) { .sticky-card { position: sticky; top: 24px; } }

.plot-header-wrapper {
    display: flex; justify-content: space-between; align-items: center;
    padding: 24px 24px 0;
}

.card--math h2 { color: var(--text-math-dark); margin: 0; font-size: 18px; }

/* Индикатор рендера */
#loading-indicator {
    font-size: 11px; font-weight: 700; color: #fff;
    background: var(--accent-math); padding: 4px 10px;
    border-radius: 99px; transition: opacity 0.2s;
    text-transform: uppercase;
}
.loader-hidden { opacity: 0; pointer-events: none; }

/* КОНТЕЙНЕР ГРАФИКА */
.plot-container-wrapper {
    width: 100%;
    height: 420px; 
    background: transparent;
    margin-top: 16px;
}

#plot-3d { width: 100%; height: 100%; }

/* Убираем лишний отступ у тулбара Plotly */
.js-plotly-plot .plotly .modebar { padding-right: 8px; }

/* Детали графика */
.card--math .summary-divider { 
    height: 1px; background: rgba(49, 46, 129, 0.1); 
    margin: 16px 24px 20px; 
}

.card--math .details-list { 
    display: flex; flex-direction: column; gap: 12px; 
    padding: 0 24px 24px; margin: 0;
}

.card--math .detail-row {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(49, 46, 129, 0.05); 
    padding-bottom: 10px; font-size: 14px;
}

.card--math .detail-row strong { 
    font-size: 16px; font-weight: 700; color: var(--accent-math);
    background: #fff; padding: 4px 12px; border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* =========================================
   SEO ИНФОБЛОКИ (Копия структуры)
   ========================================= */
.info-wrapper { padding: 60px 0; margin-top: 60px; border-top: 1px solid rgba(0,0,0,0.06); margin-bottom: 20px; }
.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; }
.header-icon svg { width: 24px; height: 24px; stroke-width: 2px; }

/* Цвета иконок */
.indigo-icon svg { color: var(--accent-math); }
.blue-icon svg { color: #2563EB; }
.cyan-icon svg { color: #06B6D4; }

.small-heading { margin-top: 40px; margin-bottom: 16px; font-size: 20px; }
.small-heading .header-icon { width: 40px; height: 40px; }
.small-heading .header-icon svg { width: 20px; height: 20px; }

.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: 0 4px 20px rgba(0,0,0,0.03); border-radius: 24px; padding: 24px; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 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; }

.badge-indigo { background: var(--accent-math); color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; }
.badge-cyan { background: #06B6D4; color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; }

.formula-card p { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.5; font-weight: 500; }
.math-expression { background: var(--accent-math-light); border: 1px solid #C7D2FE; padding: 12px 16px; border-radius: 12px; font-weight: 700; color: var(--accent-math); text-align: center; margin-bottom: 16px; font-size: 15px; }

.soft-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, #E5E7EB, transparent); margin: 48px 0; }
.calc-description p { font-size: 16px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 24px; }

.faq-section .faq-item { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; margin-bottom: 12px; overflow: hidden; transition: all 0.2s ease; }
.faq-section .faq-item[open] { border-color: var(--accent-math); box-shadow: 0 4px 20px rgba(79, 70, 229, 0.15); }
summary.faq-question { padding: 16px 20px; cursor: pointer; font-weight: 600; color: var(--text-primary); list-style: none; position: relative; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
summary.faq-question:hover { background-color: #F9FAFB; }
.faq-section .faq-item[open] summary.faq-question { color: var(--accent-math); background: var(--accent-math-light); }
.faq-question::after { content: '+'; font-size: 20px; color: var(--text-secondary); font-weight: 400; line-height: 1; }
.faq-question .icon-plus { display: none; }
.faq-section .faq-item[open] summary.faq-question::after { content: '−'; color: var(--accent-math); }
.faq-answer, .faq-item div[itemprop="text"] { padding: 20px; color: var(--text-secondary); line-height: 1.6; font-size: 15px; }

/* =========================================
   ИДЕАЛЬНАЯ МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================= */
@media (max-width: 900px) {
    .row-2-col { grid-template-columns: 1fr; }
    
    /* Сжимаем график, чтобы не перекрывал весь экран телефона */
    .plot-container-wrapper { height: 320px; }

    .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%; }
}