/* calc/assets/css/calculators/circle-area-calculator.css */

:root {
    --circle-primary: #4338CA; /* Индиго */
    --circle-bg: #EEF2FF;      /* Светлый индиго */
    --circle-dark: #1E1B4B;    /* Темно-синий */
    --circle-accent: #6366F1;  /* Яркий индиго */
    
    --drawing-line: #1E1B4B;
    --drawing-measure: #EF4444; /* Красные размерные линии */
}

/* --- ВЕРХНЯЯ ЧАСТЬ --- */
.calc-header { margin-bottom: 40px; }
.subtitle { color: var(--text-secondary); margin-top: 12px; font-size: 16px; line-height: 1.5; }

.calc-grid { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: start; }
@media (min-width: 992px) { .calc-grid { grid-template-columns: 1fr 1.1fr; gap: 48px; } }

.form-divider { border: none; height: 1px; background: #C7D2FE; margin: 24px 0; opacity: 0.7; }

/* Сегмент контрол (Выбор 2D/3D) */
.group-label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 12px; color: #1F2937; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.5px; }
.segment-control { display: flex; gap: 8px; background: #F3F4F6; padding: 5px; border-radius: 12px; }
.segment-item { flex: 1; position: relative; }
.segment-item input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.segment-box {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 8px; border-radius: 9px; font-size: 14px; font-weight: 600;
    color: #6B7280; transition: all 0.2s; cursor: pointer; text-align: center; border: 1px solid transparent; user-select: none;
}
.segment-item input:checked + .segment-box { background: #fff; color: var(--circle-primary); border-color: #D1D5DB; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }

/* Радио-селектор известных параметров */
.group-title-small { font-size: 14px; font-weight: 700; color: var(--circle-primary); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 16px 0; border-left: 3px solid var(--circle-primary); padding-left: 8px; }

.known-param-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 24px; }
.kp-item { position: relative; cursor: pointer; }
.kp-item input { position: absolute; opacity: 0; }
.kp-box {
    padding: 12px; text-align: center; font-size: 13px; font-weight: 600; color: #4B5563;
    background: #fff; border: 1px solid #D1D5DB; border-radius: 10px; transition: all 0.2s;
}
.kp-item:hover .kp-box { border-color: var(--circle-accent); }
.kp-item input:checked + .kp-box {
    background: var(--circle-bg); color: var(--circle-primary); border-color: var(--circle-primary); font-weight: 700;
}

/* Главный Инпут */
.label-with-icon { display: flex; align-items: center; gap: 8px; color: var(--circle-primary) !important; font-size: 15px !important; font-weight: 700 !important; margin-bottom: 12px;}
.highlight-group { background: var(--circle-bg); padding: 20px; border-radius: 16px; border: 1px dashed var(--circle-primary); }

.input-wrapper { position: relative; display: flex; align-items: stretch; }
.input-wrapper input {
    width: 100%; padding: 14px 16px;
    font-size: 18px; font-weight: 700; font-family: inherit;
    border: 1px solid #D1D5DB; border-top-left-radius: 12px; border-bottom-left-radius: 12px;
    border-top-right-radius: 0; border-bottom-right-radius: 0;
    transition: all 0.2s; outline: none; background: #fff; color: #1F2937;
}
.input-wrapper input:focus { border-color: var(--circle-primary); box-shadow: 0 0 0 4px rgba(67, 56, 202, 0.15); z-index: 2; }
.input-wrapper select {
    border: 1px solid #D1D5DB; border-top-right-radius: 12px; border-bottom-right-radius: 12px;
    background: #F3F4F6; color: #4B5563; font-weight: 700; outline: none; cursor: pointer;
}

.m-0 { margin-bottom: 0 !important; }
.mt-3 { margin-top: 16px !important; }


/* --- ПРАВАЯ ЧАСТЬ: РЕЗУЛЬТАТ (KILLER FEATURE) --- */
@media (min-width: 992px) { .sticky-card { position: sticky; top: 24px; transition: top 0.3s; } }

.circle-result-card {
    background: #fff; border: 2px solid var(--circle-bg); padding: 32px;
    border-top: 6px solid var(--circle-primary); border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(67, 56, 202, 0.08);
}

.result-header { text-align: center; margin-bottom: 24px; }
.result-header h2 { font-size: 16px; font-weight: 800; color: #9CA3AF; margin: 0; text-transform: uppercase; letter-spacing: 1px; }

/* Интерактивный чертеж */
.drawing-board {
    background: #F9FAFB; border: 1px solid #E5E7EB; border-radius: 16px;
    height: 260px; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden; margin-bottom: 24px;
    /* Текстура миллиметровки */
    background-image: linear-gradient(#E5E7EB 1px, transparent 1px), linear-gradient(90deg, #E5E7EB 1px, transparent 1px);
    background-size: 20px 20px; background-position: center;
}

/* 2D Круг */
.shape-2d { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.s2-circle {
    width: 180px; height: 180px; border-radius: 50%;
    border: 3px solid var(--drawing-line); background: rgba(99, 102, 241, 0.1);
    position: relative; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.s2-center {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 6px; height: 6px; background: var(--drawing-line); border-radius: 50%; z-index: 5;
}

/* Линии разметки */
.s2-radius-line {
    position: absolute; top: 50%; left: 50%; height: 2px; background: var(--drawing-measure);
    transform-origin: left center; width: 50%; /* Радиус = 50% ширины круга */
    /* Анимация вращения, как стрелка радара */
    animation: sweep 10s infinite linear; z-index: 4;
}
.s2-radius-line::after {
    content: ''; position: absolute; right: -4px; top: -3px;
    border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid var(--drawing-measure);
}

.s2-radius-label {
    position: absolute; font-size: 12px; font-weight: 800; color: var(--drawing-measure);
    background: #fff; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--drawing-measure);
    /* JS будет двигать лейбл вместе с линией */
    top: 50%; left: 75%; transform: translate(-50%, -50%); z-index: 6;
}

/* Линия диаметра (Горизонтальная, прозрачная, появляется по требованию JS) */
.s2-diameter-line {
    position: absolute; top: 50%; left: 0; width: 100%; height: 2px;
    background: var(--drawing-measure); transform: translateY(-50%);
    opacity: 0; transition: opacity 0.3s; z-index: 3;
}
.s2-diameter-label {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 12px; font-weight: 800; color: var(--drawing-measure);
    background: #fff; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--drawing-measure);
    opacity: 0; transition: opacity 0.3s; z-index: 6;
}

@keyframes sweep {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 3D Сфера */
.shape-3d { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.s3-sphere {
    width: 180px; height: 180px; border-radius: 50%;
    /* Имитация объема градиентом */
    background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.2), rgba(30, 27, 75, 0.4));
    border: 2px solid var(--drawing-line); position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
/* Экваторы для 3D вида */
.s3-equator-h {
    position: absolute; top: 50%; left: 0; width: 100%; height: 40px;
    border: 1px dashed rgba(30, 27, 75, 0.6); border-radius: 50%;
    transform: translateY(-50%);
}
.s3-equator-v {
    position: absolute; top: 0; left: 50%; width: 40px; height: 100%;
    border: 1px dashed rgba(30, 27, 75, 0.6); border-radius: 50%;
    transform: translateX(-50%);
}

/* Итоги / Сетка результатов */
.summary-divider { height: 2px; background: repeating-linear-gradient(90deg, #D1D5DB 0, #D1D5DB 6px, transparent 6px, transparent 12px); margin: 24px 0; opacity: 0.6; }

.results-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }

.rg-item { display: flex; align-items: center; gap: 16px; background: #F9FAFB; border: 1px solid #E5E7EB; padding: 16px; border-radius: 12px; transition: all 0.3s; }
.rg-icon { width: 40px; height: 40px; border-radius: 8px; background: #E5E7EB; color: #4B5563; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rg-data { display: flex; flex-direction: column; flex-grow: 1; }
.rg-label { font-size: 12px; font-weight: 700; color: #6B7280; text-transform: uppercase; margin-bottom: 4px; }
.rg-val { font-size: 20px; font-weight: 800; color: var(--circle-dark); font-family: monospace; }
.res-u, .res-u2, .res-u3 { font-size: 14px; color: #9CA3AF; font-family: var(--font-main); }

/* Выделение главного результата (Площадь/Объем) */
.highlight-res { background: var(--circle-bg); border-color: #C7D2FE; }
.bg-primary { background: var(--circle-primary); color: #fff; box-shadow: 0 4px 10px rgba(67, 56, 202, 0.3); }
.text-primary { color: var(--circle-primary); font-size: 26px; }

/* Формула-хинт */
.formula-hint { margin-top: 16px; text-align: center; font-size: 12px; color: #6B7280; }
.formula-hint code { display: block; margin-top: 8px; background: #F3F4F6; padding: 8px; border-radius: 6px; font-family: 'Courier New', Courier, monospace; font-size: 14px; font-weight: 700; color: var(--circle-dark); border: 1px dashed #D1D5DB; }

/* --- НИЖНЯЯ ЧАСТЬ (SEO, INFO) --- */
.info-wrapper { padding: 80px 0; margin-top: 60px; border-top: 1px solid #E5E7EB; }

.author-badge { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 40px; padding: 20px; background: #F8FAFC; border-radius: 16px; border: 1px solid #E2E8F0; }
.author-avatar { width: 48px; height: 48px; background: var(--circle-primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.author-info { display: flex; flex-direction: column; min-width: 0; }
.author-name { font-size: 15px; font-weight: 700; color: #111827; line-height: 1.4; margin-bottom: 4px; }
.author-date { font-size: 13px; color: #6B7280; }

.icon-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 32px; font-size: 26px; font-weight: 800; color: #111827; line-height: 1.25; letter-spacing: -0.02em; }
.header-icon { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 14px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.06); flex-shrink: 0; margin-top: -6px; font-size: 26px; }

.blue-icon { color: var(--circle-primary); }
.dark-icon { color: var(--circle-dark); }

.formulas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 56px; }
.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: 32px; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); display: flex; flex-direction: column; }
.formula-card:hover { transform: translateY(-6px); box-shadow: 0 12px 32px rgba(67, 56, 202, 0.1); border-color: rgba(67, 56, 202, 0.1); }
.formula-header { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.formula-card h3 { margin: 0; font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }

.badge-blue { background: var(--circle-primary); color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block; }
.badge-dark { background: var(--circle-dark); color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block; }

.formula-card p { font-size: 15px; color: var(--text-secondary); margin: 0; line-height: 1.6; font-weight: 500; }
.math-expression { background: var(--circle-bg); border: 1px dashed var(--circle-primary); padding: 18px; border-radius: 14px; font-weight: 700; color: var(--circle-dark); text-align: center; margin-bottom: 20px; font-size: 17px; font-family: 'Courier New', Courier, monospace; letter-spacing: 0.5px; }

.soft-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, #E5E7EB, transparent); margin: 56px 0; opacity: 0.7; }
.intro-text { font-size: 16px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 40px; }
.calc-description p { font-size: 17px; line-height: 1.7; color: #4B5563; margin-bottom: 24px; }
.calc-description strong { color: #1F2937; font-weight: 700; }

/* Перелинковка */
.internal-links-box { margin-top: 32px; background: #F3F4F6; padding: 24px; border-radius: 16px; border-left: 4px solid var(--circle-primary); }
.internal-links-box h4 { margin: 0 0 12px 0; font-size: 17px; color: #111827; }
.internal-links-box ul { margin: 0; padding-left: 20px; color: #4B5563; }
.internal-links-box li { margin-bottom: 8px; font-size: 15px; }
.internal-links-box a { color: var(--circle-primary); text-decoration: underline; font-weight: 600; }

.howto-section { margin-top: 48px; }
.howto-step { display: flex; gap: 20px; margin-bottom: 32px; background: #fff; padding: 24px; border-radius: 20px; border: 1px solid #E5E7EB; transition: box-shadow 0.2s, transform 0.2s; }
.howto-step:hover { box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); transform: translateY(-2px); }
.step-num { width: 36px; height: 36px; background: var(--circle-bg); color: var(--circle-primary); font-weight: 800; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; border: 1px solid rgba(67, 56, 202, 0.2); }
.step-content h4 { margin: 0 0 10px 0; font-size: 18px; color: #111827; font-weight: 700; }
.step-content p { margin: 0; font-size: 16px; color: #6B7280; line-height: 1.6; }

.faq-section .faq-item { background: #fff; border: 1px solid #E5E7EB; border-radius: 16px; margin-bottom: 16px; overflow: hidden; transition: all 0.2s ease; }
.faq-section .faq-item:hover { border-color: #D1D5DB; }
.faq-section .faq-item[open] { border-color: var(--circle-primary); box-shadow: 0 8px 20px rgba(67, 56, 202, 0.08); }
summary.faq-question { padding: 22px 28px; cursor: pointer; font-weight: 700; color: var(--text-primary); font-size: 17px; list-style: none; position: relative; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.faq-section .faq-item[open] summary.faq-question { color: var(--circle-primary); background: var(--circle-bg); border-bottom: 1px solid #C7D2FE; }
.faq-question::after { content: '+'; font-size: 26px; color: #9CA3AF; font-weight: 400; line-height: 1; transition: transform 0.3s; }
.faq-section .faq-item[open] summary.faq-question::after { content: '−'; color: var(--circle-primary); }
.faq-answer, .faq-item div[itemprop="text"] { padding: 28px; color: var(--text-secondary); line-height: 1.7; font-size: 16px; background: #fff; }
.faq-answer p { margin: 0; }

@media (max-width: 900px) {
    .calc-header { margin-bottom: 32px; }
    .formulas-grid { grid-template-columns: 1fr; gap: 20px; }
    .icon-heading { font-size: 22px; gap: 12px; }
    .header-icon { width: 44px; height: 44px; font-size: 22px; }
    .formula-card { padding: 24px; }
    summary.faq-question { padding: 18px 20px; font-size: 16px; }
    .faq-answer, .faq-item div[itemprop="text"] { padding: 20px; font-size: 15px; }
    .howto-step { padding: 20px; gap: 16px; flex-direction: column; }
    .step-num { margin-bottom: -8px; }
}

@media (max-width: 480px) {
    .author-badge { padding: 16px; gap: 12px; align-items: flex-start; flex-direction: row; }
    .author-avatar { width: 40px; height: 40px; font-size: 18px; }
    .known-param-selector { grid-template-columns: 1fr; }
    
    .drawing-board { height: 220px; }
    .s2-circle, .s3-sphere { width: 140px; height: 140px; }
}