/* --- Стили для Дробей (Teal Theme) --- */
:root {
    --accent-teal: #0D9488; /* Teal 600 */
    --accent-teal-light: #CCFBF1;
    --gradient-teal-card: linear-gradient(135deg, #2DD4BF 0%, #0D9488 100%);
}

.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 1fr; } }

/* Inputs Container */
.fractions-equation {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    background: #F9FAFB; padding: 24px 12px; border-radius: 16px; border: 1px solid #E5E7EB;
    flex-wrap: wrap;
}

/* Группа ввода одной дроби */
.fraction-input-group {
    display: flex; align-items: center; gap: 8px;
}

/* Убираем стрелки в инпутах, чтобы текст был по центру */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

/* Целая часть */
.inp-integer {
    width: 60px; /* Увеличено с 50px */
    height: 50px; 
    text-align: center; /* Центрирование */
    font-size: 20px; font-weight: 700;
    border: 1px solid #D1D5DB; border-radius: 8px;
    outline: none; transition: all 0.2s; font-family: var(--font-main);
    padding: 0; /* Убираем паддинги */
}
.inp-integer:focus { border-color: var(--accent-teal); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1); }
.inp-integer:placeholder-shown { border-style: dashed; background: #F3F4F6; }

/* Уменьшаем шрифт плейсхолдера */
.inp-integer::placeholder {
    font-size: 14px; /* Чтобы "Цел" влезло */
    font-weight: 400;
    color: #9CA3AF;
}

/* Дробная часть (вертикально) */
.fraction-box {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.inp-part {
    width: 50px; height: 40px; 
    text-align: center; /* Центрирование */
    font-size: 18px; font-weight: 600;
    border: 1px solid #D1D5DB; border-radius: 8px;
    outline: none; transition: all 0.2s; font-family: var(--font-main);
    padding: 0;
}
.inp-part:focus { border-color: var(--accent-teal); z-index: 2; }

/* Черта дроби */
.frac-line {
    width: 100%; height: 2px; background: #374151; border-radius: 2px;
}

/* Селектор операции */
.op-selector select {
    font-size: 24px; font-weight: 700; padding: 4px 8px;
    border: 1px solid #E5E7EB; border-radius: 8px;
    background: #fff; cursor: pointer; outline: none;
    color: var(--accent-teal);
    text-align: center;
}

/* --- Результаты (Teal Card) --- */
.card--teal { background: var(--gradient-teal-card); color: #fff; border: none; }
.card--teal h2 { color: rgba(255,255,255,0.95); margin-bottom: 24px; }
@media (min-width: 900px) { .sticky-card { position: sticky; top: 24px; } }

.result-display-row {
    display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 32px;
}

/* Большая дробь результата */
.fraction-big {
    display: flex; align-items: center; gap: 8px;
    font-family: 'Courier New', monospace;
}
.f-int { font-size: 40px; font-weight: 700; line-height: 1; }
.f-group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.f-num, .f-den { font-size: 28px; font-weight: 700; line-height: 1; }
.f-line { width: 100%; height: 3px; background: #fff; border-radius: 2px; }

.decimal-val {
    font-size: 16px; opacity: 0.8; background: rgba(0,0,0,0.2); padding: 4px 8px; border-radius: 6px;
}

/* Пироги */
.pie-visuals {
    display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px;
    flex-wrap: wrap;
}
.pie-wrapper { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pie-wrapper span { font-size: 12px; opacity: 0.9; }

.pie {
    width: 50px; height: 50px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    position: relative;
    border: 1px solid rgba(255,255,255,0.4);
}
.op-sign { font-size: 24px; font-weight: 700; opacity: 0.8; }

.summary-divider { height: 1px; background: rgba(255,255,255,0.2); margin: 24px 0; }

.steps-box {
    background: rgba(255,255,255,0.15); padding: 16px; border-radius: 12px;
    backdrop-filter: blur(4px); font-size: 14px;
}
.steps-title { text-transform: uppercase; font-size: 11px; opacity: 0.8; margin-bottom: 8px; display: block; }
#steps-list { list-style: none; padding: 0; margin: 0; }
#steps-list li { margin-bottom: 6px; font-family: monospace; }


/* --- НОВЫЕ ИНФОРМАЦИОННЫЕ БЛОКИ (Teal Theme) --- */

.info-wrapper {
    padding: 60px 0 60px 0;
    margin-top: 60px;
    border-top: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

/* Центрирование контента */
.formulas-section,
.calc-description,
.faq-section {
    max-width: 800px;
    width: 100%;
    margin-left: auto;
    margin-right: 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;
}

.header-icon svg { width: 24px; height: 24px; stroke-width: 2px; }

/* Цвета иконок */
.blue-icon svg { color: #2563EB; }
.orange-icon svg { color: #F59E0B; }
.green-icon svg { color: #10B981; }
.red-icon svg { color: #E11D48; }
.purple-icon svg { color: #9333EA; }

/* Маленькие подзаголовки */
.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: var(--shadow-soft);
    border-radius: var(--radius-lg); 
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}
.formula-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

/* Вертикальный хедер (бейдж сверху) */
.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-blue {
    background: #2563EB; 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-green {
    background: #10B981; 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: #F9FAFB;
    border: 1px solid #E5E7EB;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
    color: var(--accent-teal); /* Бирюзовый акцент */
    
    /* NEW: Flexbox для формул */
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: 'Times New Roman', serif; font-style: italic;
    
    margin-bottom: 16px;
    font-size: 15px;
}

/* Стили для отрисовки дроби на CSS */
.math-frac {
    display: flex; flex-direction: column; align-items: center;
    font-size: 18px; line-height: 1;
}

.math-num {
    border-bottom: 2px solid currentColor;
    padding: 2px 4px; display: block; width: 100%; text-align: center;
}

.math-den {
    padding: 2px 4px; display: block; width: 100%; text-align: center;
}

.math-op { 
    font-size: 20px; font-weight: 600; 
    font-family: var(--font-main); font-style: normal; 
}


/* Разделитель */
.soft-divider {
    border: none; height: 1px;
    background: linear-gradient(90deg, transparent, #E5E7EB, transparent);
    margin: 48px auto;
    max-width: 800px;
    width: 100%;
}

/* Описание */
.calc-description p {
    font-size: 16px; line-height: 1.7;
    color: var(--text-secondary); margin-bottom: 24px;
}
.calc-description strong { color: var(--text-primary); }

/* FAQ (Teal) */
.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-teal); 
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.15); /* Teal shadow */
}

.faq-section 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;
}

.faq-section summary.faq-question:hover { background-color: #F9FAFB; }

.faq-section .faq-item[open] summary.faq-question {
    color: var(--accent-teal);
    background: var(--accent-teal-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-teal);
}

.faq-answer {
    padding: 20px; color: var(--text-secondary);
    line-height: 1.6; font-size: 15px;
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ --- */
@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; }
}