/* calc/assets/css/calculators/headline_analyzer.css */

:root {
    --bg-dark-card: #171717; /* Neutral 900 */
    --text-dark-main: #F5F5F5; /* Neutral 100 */
    --text-dark-muted: #A3A3A3; /* Neutral 400 */
    
    /* Theme: Sunset & Magma */
    --accent-magma: #F97316; /* Orange 500 */
    --accent-magma-hover: #EA580C; /* Orange 600 */
    --accent-magma-glow: rgba(249, 115, 22, 0.2);
    
    --accent-pink: #EC4899; /* Pink 500 */
    
    --border-dark: #262626; /* Neutral 800 */
    --shadow-dark: 0 24px 48px -12px rgba(0, 0, 0, 0.9), 
                   0 0 15px rgba(0, 0, 0, 0.4);

    --score-red: #EF4444;
    --score-yellow: #EAB308;
    --score-green: #22C55E;
}

.calc-header { margin-bottom: 32px; }
.subtitle { color: var(--text-secondary); margin-top: 8px; }

/* ЖЕСТКАЯ СЕТКА */
.calc-grid { 
    display: grid !important; grid-template-columns: 1fr; gap: 24px; align-items: start; 
    width: 100%; box-sizing: border-box; 
}
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1fr 1fr !important; } }

.calc-inputs, .calc-results { 
    min-width: 0 !important; max-width: 100% !important; box-sizing: border-box !important; overflow: hidden !important; 
}

.group-title { font-size: 14px; font-weight: 800; color: #171717; margin: 0 0 12px 0; text-transform: uppercase; letter-spacing: 0.05em;}
.hidden { display: none !important; }

/* ПОЛЕ ВВОДА */
.input-group { position: relative; width: 100%; }
.headline-field {
    width: 100%; min-height: 120px; padding: 20px; font-size: 24px; font-weight: 700; line-height: 1.3;
    border: 2px solid #E5E5E5; border-radius: 16px; background: #FFFFFF;
    color: #171717; resize: vertical; outline: none; transition: all 0.3s;
    box-sizing: border-box; font-family: inherit;
}
.headline-field:focus { border-color: var(--accent-magma); box-shadow: 0 0 0 4px var(--accent-magma-glow); }
.headline-field::placeholder { color: #D4D4D4; font-weight: 500;}

.input-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px;}
.char-counter { font-size: 13px; font-weight: 700; color: #737373; }

.magma-action-btn {
    padding: 12px 24px; background: linear-gradient(135deg, var(--accent-pink), var(--accent-magma));
    color: #FFFFFF; font-size: 14px; font-weight: 800; border-radius: 12px; border: none; cursor: pointer;
    transition: all 0.3s ease; box-shadow: 0 8px 20px var(--accent-magma-glow);
}
.magma-action-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(249, 115, 22, 0.4); }

/* ИСТОРИЯ ЗАГОЛОВКОВ */
.history-container { max-height: 300px; overflow-y: auto; padding-right: 8px;}
.history-container::-webkit-scrollbar { width: 4px; }
.history-container::-webkit-scrollbar-thumb { background-color: #E5E5E5; border-radius: 10px; }

.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.hist-item {
    background: #FAFAFA; border: 1px solid #E5E5E5; border-radius: 12px;
    padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    cursor: pointer; transition: all 0.2s;
}
.hist-item:hover { border-color: var(--accent-magma); background: #FFF7ED; }
.hist-text { font-size: 14px; font-weight: 600; color: #404040; line-height: 1.3; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;}
.hist-score { 
    display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 50%; font-size: 14px; font-weight: 800; color: #FFF; flex-shrink: 0;
}

.secondary-action-btn {
    background: #F5F5F5; color: #525252; border: none; border-radius: 12px;
    font-size: 13px; font-weight: 700; cursor: pointer; transition: background 0.2s; padding: 12px;
}
.secondary-action-btn:hover { background: #E5E5E5; color: #171717; }


/* ========================================================
   ЯДЕРНЫЙ ФИКС ДЛЯ КАРТОЧКИ (УБИВАЕМ БЕЛЫЕ УГЛЫ)
   ======================================================== */
#result-card.card--dark-magma { 
    background: var(--bg-dark-card) !important; 
    background-color: var(--bg-dark-card) !important; 
    color: var(--text-dark-main) !important; 
    border: 1px solid var(--border-dark) !important; 
    border-radius: 24px !important;
    box-shadow: var(--shadow-dark) !important;
    overflow: hidden !important; 
    padding: 32px 0 0 0 !important; 
    display: flex !important; 
    flex-direction: column !important;
    min-width: 0 !important; 
    max-width: 100% !important; 
    box-sizing: border-box !important;
    
    /* ХАКИ ПРОТИВ ВМЕШАТЕЛЬСТВА CMS */
    isolation: isolate !important; 
    -webkit-mask-image: -webkit-radial-gradient(white, black) !important; 
    transform: translateZ(0) !important; 
}
#result-card.card--dark-magma::before, 
#result-card.card--dark-magma::after { 
    display: none !important; 
    background: transparent !important;
}

.magma-title { 
    color: var(--accent-magma); margin: 0 24px 16px; 
    font-size: 12px; text-align: center; 
    font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase;
}

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 24px; color: #737373; text-align: center;
    font-size: 14px; font-weight: 500; flex: 1;
}

/* КРУГОВОЙ ПРОГРЕСС БАР */
.score-display { display: flex; flex-direction: column; padding: 24px;}
.score-circle-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 32px; }
.score-circle { position: relative; width: 160px; height: 160px; }

.circular-chart { display: block; margin: 0 auto; max-width: 100%; max-height: 250px; }
.circle-bg { fill: none; stroke: #262626; stroke-width: 2; }
.circle-fg { fill: none; stroke-width: 2.5; stroke-linecap: round; transition: stroke-dasharray 1s ease-out, stroke 0.5s ease;}

.score-value {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center;
}
.score-value span:first-child { font-size: 48px; font-weight: 900; line-height: 1; color: #FFF; transition: color 0.5s ease;}
.score-max { font-size: 14px; font-weight: 700; color: #737373; margin-top: 4px; }

.score-badge { 
    margin-top: 16px; font-size: 14px; font-weight: 800; padding: 6px 16px; 
    border-radius: 99px; text-transform: uppercase; background: #262626; color: #A3A3A3;
}

/* МЕТРИКИ АНАЛИЗА */
.metrics-breakdown { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.metric-row {
    display: flex; align-items: center; gap: 16px; background: #262626; padding: 12px 16px; border-radius: 12px;
}
.m-icon { 
    display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; 
    border-radius: 10px; background: #171717; flex-shrink: 0;
}
.m-icon.magma svg { color: var(--accent-magma); }
.m-icon.emotional svg { color: var(--accent-pink); }
.m-icon.digits svg { color: #3B82F6; }
.m-icon.length svg { color: #10B981; }

.m-text { flex: 1; display: flex; justify-content: space-between; align-items: center;}
.m-label { font-size: 13px; font-weight: 600; color: #D4D4D4; }
.m-val { font-size: 14px; font-weight: 800; color: #FFF; }
.m-val.good { color: var(--score-green); }
.m-val.warn { color: var(--score-yellow); }
.m-val.bad { color: var(--score-red); }

/* ПОДСКАЗКИ */
.tips-box { background: rgba(249, 115, 22, 0.1); border: 1px solid rgba(249, 115, 22, 0.2); border-radius: 12px; padding: 16px;}
.tip-item { font-size: 13px; color: #D4D4D4; line-height: 1.5; margin-bottom: 8px; display: flex; gap: 8px; align-items: flex-start;}
.tip-item:last-child { margin-bottom: 0; }
.tip-item.plus::before { content: '✓'; color: var(--score-green); font-weight: 800;}
.tip-item.minus::before { content: '✗'; color: var(--score-red); font-weight: 800;}

/* 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; }
.magma-icon svg { color: var(--accent-magma); }
.slate-icon svg { color: #525252; }
.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; width: 100%; box-sizing: border-box;}
.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; min-width: 0; max-width: 100%; box-sizing: border-box;}
.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-magma { background: #FFF7ED; color: #EA580C; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.badge-dark { background: #F5F5F5; color: #404040; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.formula-card p { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.5; font-weight: 500; }

.seo-table-container { background: #fff; border: 1px solid #E5E5E5; border-radius: 16px; padding: 24px; margin-bottom: 40px; box-shadow: 0 4px 15px rgba(0,0,0,0.02); width: 100%; box-sizing: border-box; overflow: hidden; }
.seo-table-container h3 { margin-top: 0; margin-bottom: 20px; font-size: 18px; }
.seo-table { width: 100%; border-collapse: collapse; text-align: left; }
.seo-table th { background: #FAFAFA; padding: 12px 16px; font-weight: 700; border-bottom: 2px solid #E5E5E5; color: #525252;}
.seo-table td { padding: 16px; border-bottom: 1px solid #E5E5E5; font-weight: 500; color: #171717;}
.seo-table tr:last-child td { border-bottom: none; }
.soft-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, #E5E5E5, transparent); margin: 48px 0; }
.faq-section .faq-item { background: #fff; border: 1px solid #E5E5E5; border-radius: 12px; margin-bottom: 12px; overflow: hidden; transition: all 0.2s ease; }
.faq-section .faq-item[open] { border-color: var(--accent-magma); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
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: #FAFAFA; }
.faq-section .faq-item[open] summary.faq-question { color: #EA580C; background: #FFF7ED; }
.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: #EA580C; }
.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 { 
        display: flex !important; 
        flex-direction: column !important; 
        gap: 16px !important; 
    }
    .formulas-grid { grid-template-columns: 1fr !important; gap: 16px !important; margin-bottom: 32px !important; }
    
    /* Оптимизация поля ввода */
    .headline-field { font-size: 16px !important; min-height: 100px !important; padding: 16px !important; }
    
    /* Футер с кнопкой */
    .input-footer { flex-direction: column !important; align-items: stretch !important; gap: 16px !important; }
    .char-counter { text-align: center !important; margin-bottom: 4px !important;}
    .magma-action-btn { padding: 16px !important; font-size: 15px !important; width: 100% !important;}
    
    /* Темная карточка результатов */
    #result-card.card--dark-magma { border-radius: 16px !important; padding: 24px 0 0 0 !important; margin-top: 16px !important;}
    .score-display { padding: 16px !important; }
    
    /* Круговой прогресс бар */
    .score-circle-wrap { margin-bottom: 24px !important; }
    .score-circle { width: 120px !important; height: 120px !important; }
    .score-value span:first-child { font-size: 36px !important; }
    .score-badge { margin-top: 12px !important; font-size: 12px !important; }
    
    /* Метрики */
    .metrics-breakdown { gap: 8px !important; margin-bottom: 16px !important; }
    .metric-row { padding: 12px !important; gap: 12px !important; flex-wrap: wrap !important;}
    .m-icon { width: 32px !important; height: 32px !important; border-radius: 8px !important;}
    .m-icon svg { width: 16px !important; height: 16px !important; }
    
    .m-text { flex-direction: column !important; align-items: flex-start !important; gap: 4px !important; }
    .m-val { font-size: 14px !important; }
    .m-label { font-size: 12px !important; line-height: 1.2 !important; }
    
    .tips-box { padding: 12px !important; }
    .tip-item { font-size: 12px !important; margin-bottom: 10px !important; }

    /* ИСПРАВЛЕНИЕ ТАБЛИЦ ДЛЯ МОБИЛОК */
    .seo-table-container { 
        padding: 16px !important; 
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .seo-table { 
        display: block !important; 
        width: 100% !important; 
        overflow-x: auto !important; 
        -webkit-overflow-scrolling: touch !important; 
    }
    .seo-table thead, .seo-table tbody {
        display: table !important;
        width: 100% !important;
        min-width: 550px !important; 
    }
    .seo-table th, .seo-table td { 
        padding: 12px !important; 
        font-size: 13px !important; 
        white-space: normal !important; 
    }
}