/* calc/assets/css/calculators/prime_factorization.css */

:root {
    --bg-edu-card: #FFFFFF; /* Чистый белый */
    --text-edu-main: #0F172A; /* Темно-синий/грифельный */
    --text-edu-muted: #64748B;
    --accent-edu-mint: #10B981; /* Изумрудный */
    --accent-edu-peach: #F43F5E; /* Розовый/Персиковый */
    --edu-border: #E2E8F0;
    --tree-bg: #F8FAFC;
}

/* =========================================
   ОСНОВНАЯ СЕТКА И КАРКАС
   ========================================= */
.calc-header { margin-bottom: 32px; }
.subtitle { color: var(--text-secondary); margin-top: 8px; }

.calc-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1fr 1.2fr; } } /* Правая карточка чуть шире для дерева */

.calc-inputs { gap: 16px; }
.group-title { font-size: 15px; font-weight: 800; color: #1E293B; margin: 0 0 16px 0; text-transform: uppercase; letter-spacing: 0.05em;}

.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }

.input-wrapper { position: relative; display: flex; align-items: center; }
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 input {
    width: 100%; padding: 14px 16px; font-size: 18px; font-weight: 700;
    border: 2px solid var(--edu-border); border-radius: 12px;
    outline: none; transition: border 0.2s, box-shadow 0.2s;
    font-family: inherit; background: #fff; color: #0F172A;
}
.input-wrapper input:focus { border-color: var(--accent-edu-mint); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15); }
.helper-text { font-size: 12px; color: var(--text-secondary); margin-top: 8px; font-weight: 500;}

.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.info-alert {
    display: flex; align-items: flex-start; gap: 12px;
    background: #F0FDF4; border: 1px solid #BBF7D0;
    padding: 16px; border-radius: 12px;
    color: #166534; font-size: 13px; line-height: 1.5; font-weight: 500;
}
.info-alert svg { flex-shrink: 0; color: #10B981; margin-top: -2px; }

/* Мини-теория */
.mini-theory {
    background: #FFF1F2; border: 1px solid #FECDD3; padding: 16px; border-radius: 12px;
}
.mini-theory h4 { margin: 0 0 8px 0; color: #BE123C; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px;}
.mini-theory p { margin: 0; font-size: 13px; color: #9F1239; line-height: 1.5;}

/* =========================================
   ПРАВАЯ КАРТОЧКА (EdTech Theme / Light & Modern)
   ========================================= */
.card--edu { 
    background: var(--bg-edu-card); 
    color: var(--text-edu-main); 
    border: 1px solid var(--edu-border); border-radius: 20px;
    /* Мягкая, дружелюбная тень */
    box-shadow: 0 15px 35px -10px rgba(15, 23, 42, 0.08);
    overflow: hidden; padding: 24px 0 0 0; 
}
@media (min-width: 900px) { .sticky-card { position: sticky; top: 24px; } }

.edu-title { 
    color: var(--text-edu-muted); margin: 0 24px 20px; 
    font-size: 14px; text-align: center; 
    font-weight: 800; letter-spacing: 0.1em;
}

/* КОНТЕЙНЕР ДЕРЕВА (D3.js) */
.tree-container-wrapper {
    width: 100%; height: 360px; 
    background: var(--tree-bg);
    position: relative;
    border-top: 1px solid var(--edu-border); border-bottom: 1px solid var(--edu-border);
    overflow: hidden; /* SVG будет внутри */
}
.tree-container-wrapper svg { width: 100%; height: 100%; cursor: grab; }
.tree-container-wrapper svg:active { cursor: grabbing; }

/* D3.js CSS Classes (Генерируются скриптом) */
.link { fill: none; stroke: #CBD5E1; stroke-width: 2px; }
.node text { font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none;}
.node--prime circle { fill: #D1FAE5; stroke: #10B981; stroke-width: 2px; }
.node--prime text { fill: #047857; }
.node--composite circle { fill: #FFFFFF; stroke: #94A3B8; stroke-width: 2px; }
.node--composite text { fill: #334155; }

.edu-divider { height: 1px; background: var(--edu-border); margin: 0 24px; }

/* Результаты */
.edu-result-main { text-align: center; margin: 24px 0; padding: 0 24px; min-height: 80px; display: flex; flex-direction: column; justify-content: center;}
.rec-label { font-size: 13px; color: var(--text-edu-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 12px; }
.rec-value { 
    font-size: 24px; font-weight: 800; color: var(--text-edu-main); 
}

/* Алерт если число простое */
.prime-alert {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: #FEF08A; color: #A16207; padding: 8px 16px; border-radius: 99px;
    font-size: 14px; font-weight: 700; margin: 12px auto 0; width: fit-content;
}
.hidden { display: none !important; }

/* Детали карточки */
.details-list { display: flex; flex-direction: column; background: #F8FAFC; margin: 0;}
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; font-size: 14px; border-top: 1px solid var(--edu-border); color: #475569;}
.detail-row strong { font-size: 15px; font-weight: 700; color: #0F172A; }

/* =========================================
   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; }

.mint-icon svg { color: var(--accent-edu-mint); }
.slate-icon svg { color: #475569; }
.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; 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-mint { background: var(--accent-edu-mint); color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-peach { background: var(--accent-edu-peach); color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.formula-card p { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.5; font-weight: 500; }

/* SEO-ТАБЛИЦА */
.seo-table-container { background: #fff; border: 1px solid #E5E7EB; border-radius: 16px; padding: 24px; margin-bottom: 40px; box-shadow: 0 4px 15px rgba(0,0,0,0.02); }
.seo-table-container h3 { margin-top: 0; margin-bottom: 20px; color: #1E293B; font-size: 18px; }
.seo-table { width: 100%; border-collapse: collapse; text-align: left; }
.seo-table th { background: #F8FAFC; padding: 12px 16px; font-weight: 700; color: #475569; border-bottom: 2px solid #E2E8F0; }
.seo-table td { padding: 16px; border-bottom: 1px solid #E2E8F0; color: #1E293B; font-weight: 500; line-height: 1.5;}
.seo-table tr:last-child td { border-bottom: none; }

.soft-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, #E5E7EB, transparent); margin: 48px 0; }

/* FAQ */
.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-edu-mint); box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15); }
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; transition: background 0.2s; }
summary.faq-question:hover { background-color: #F0FDF4; }
.faq-section .faq-item[open] summary.faq-question { color: #047857; background: #F0FDF4; }
.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: #047857; }
.faq-answer, .faq-item div[itemprop="text"] { padding: 20px; color: var(--text-secondary); line-height: 1.6; font-size: 15px; }

/* МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 900px) {
    .calc-grid { grid-template-columns: 1fr; }
    .tree-container-wrapper { height: 300px; }
    .formulas-grid { grid-template-columns: 1fr; gap: 16px; margin-bottom: 32px; }
    .seo-table-container { padding: 16px; overflow-x: auto; }
    .seo-table th, .seo-table td { padding: 12px 10px; font-size: 14px; }
}