/**
 * Text Checker Public Page Styles
 * 
 * Стили для публичной страницы проверки текста /text-checker
 * 
 * @package Kitchor Child
 * @version 2.1.0
 * 
 * Requirements: 8.1, 8.2, 8.3, 8.4, 8.5, 7.5, 7.6
 */

/* ============================================
   CSS Variables (inherit from text-checker.css)
   ============================================ */
:root {
    --tc-public-max-width: 900px;
    --tc-public-padding: 24px;
    --tc-public-gap: 24px;
}

/* ============================================
   Page Container
   ============================================ */
.text-checker-page {
    padding: var(--tc-public-padding);
    max-width: var(--tc-public-max-width);
    margin: 0 auto;
}

.text-checker-container {
    display: flex;
    flex-direction: column;
    gap: var(--tc-public-gap);
}

/* ============================================
   Header
   ============================================ */
.text-checker-header {
    text-align: center;
    margin-bottom: 10px;
}

.text-checker-title {
    font-family: "Circe", Sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--e-global-color-secondary, #0B1220);
    margin: 0;
    line-height: 1.3;
}

/* ============================================
   Features Block
   ============================================ */
.text-checker-features {
    margin-bottom: 24px;
    padding: 20px 24px;
    background: var(--e-global-color-border, #F2F4F7);
    border-radius: 8px;
}

.text-checker-features-title {
    font-family: "Circe", Sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--e-global-color-secondary, #0B1220);
    margin: 0 0 12px 0;
}

.text-checker-features-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 24px;
}

.text-checker-features-list li {
    font-family: "Nunito Sans", Sans-serif;
    font-size: 14px;
    color: var(--e-global-color-text, #1D2939);
    padding-left: 20px;
    position: relative;
}

.text-checker-features-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--e-global-color-primary, #F7A984);
    font-weight: 600;
}


/* ============================================
   Editor Wrapper (TinyMCE) - Requirement 8.2
   ============================================ */
.text-checker-editor-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-checker-editor-wrapper #wp-ugc_content-wrap.wp-editor-wrap,
.text-checker-editor-wrapper #wp-ugc_content-wrap .mce-tinymce {
    border: 1px solid var(--e-global-color-border, #F2F4F7) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

.text-checker-editor-wrapper .wp-editor-container {
    border: none;
}

.text-checker-editor-wrapper .mce-panel {
    border-color: var(--e-global-color-border, #F2F4F7) !important;
}

.text-checker-editor-wrapper .mce-toolbar-grp {
    background: var(--e-global-color-border, #F2F4F7) !important;
    border-bottom: 1px solid var(--e-global-color-border, #F2F4F7) !important;
}

.text-checker-editor-wrapper .mce-edit-area {
    min-height: 300px;
}

.text-checker-editor-wrapper .mce-edit-area iframe {
    min-height: 300px;
}

/* Character Counter (Requirement 8.9, 8.10) */
.text-checker-char-counter {
    font-family: "Nunito Sans", Sans-serif;
    font-size: 12px;
    color: var(--e-global-color-lighter, #98A2B3);
    text-align: right;
    padding: 4px 8px;
}

.text-checker-char-counter.is-warning {
    color: var(--e-global-color-highlight, #F79009);
}

.text-checker-char-counter.is-error {
    color: #ef4444;
    font-weight: 500;
}

/* Limit Warning (Requirement 8.10) */
.text-checker-limit-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 12px 16px;
    color: #ef4444;
    font-family: "Nunito Sans", Sans-serif;
    font-size: 14px;
    text-align: center;
}

/* ============================================
   SEO Content
   ============================================ */
.text-checker-seo-content {
    margin-top: 32px;
    padding: 24px;
    background: var(--e-global-color-border, #F2F4F7);
    border-radius: 8px;
}

.text-checker-seo-content p {
    font-family: "Nunito Sans", Sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--e-global-color-text, #1D2939);
    margin: 0 0 12px 0;
}

.text-checker-seo-content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Results Container
   ============================================ */
.text-checker-results-container {
    margin-top: 0;
}

/* ============================================
   Fullscreen Mode Styles (Telegraph-like)
   ============================================ */

/* Hide ALL fixed/sticky elements when fullscreen is active */
body.tc-fullscreen-active,
body.tc-fullscreen-active html {
    overflow: hidden !important;
}

/* Force hide site header and any sticky elements */
body.tc-fullscreen-active header,
body.tc-fullscreen-active .site-header,
body.tc-fullscreen-active #masthead,
body.tc-fullscreen-active .elementor-location-header,
body.tc-fullscreen-active [data-elementor-type="header"],
body.tc-fullscreen-active .elementor-sticky,
body.tc-fullscreen-active .sticky-header,
body.tc-fullscreen-active .fixed-header,
body.tc-fullscreen-active nav.main-navigation,
body.tc-fullscreen-active .site-navigation {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* Полноэкранный режим - основной контейнер */
.mce-fullscreen {
    background: #ffffff !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2147483647 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

/* Контейнер редактора в полноэкранном режиме */
.mce-fullscreen > .mce-container-body {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Toolbar в полноэкранном режиме */
.mce-tinymce.mce-fullscreen .mce-top-part {
    background: #ffffff !important;
    border-bottom: 1px solid #dcdcde !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
}

.mce-tinymce.mce-fullscreen .mce-toolbar-grp {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: 100% !important;
    display: block !important;
}

.mce-tinymce.mce-fullscreen .mce-toolbar-grp .mce-container-body.mce-stack-layout {
    display: block !important;
}

.mce-tinymce.mce-fullscreen .mce-toolbar {
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 15px !important;
    background: transparent !important;
    display: block !important;
}

.mce-tinymce.mce-fullscreen .mce-toolbar .mce-container-body {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    height: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.mce-tinymce.mce-fullscreen .mce-btn-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    height: 34px !important;
    margin: 0 4px !important;
    float: none !important;
}

.mce-tinymce.mce-fullscreen .mce-btn-group:last-child {
    margin-left: auto !important;
}

.mce-tinymce.mce-fullscreen .mce-btn-group > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

/* Устранение пустых строк тулбара */
.mce-toolbar:empty,
.mce-toolbar[style*="height: 0px"],
.mce-toolbar[style*="height:0px"],
.mce-toolbar.mce-stack-layout-item:not(.mce-first):not(.mce-last) {
    display: none !important;
}

/* Кнопки в тулбаре */
.mce-tinymce.mce-fullscreen .mce-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    margin: 0 2px !important;
    transition: all 0.2s ease !important;
}

.mce-tinymce.mce-fullscreen .mce-btn:hover {
    background: #f0f0f1 !important;
    border-color: #dcdcde !important;
    border-radius: 4px !important;
}

.mce-tinymce.mce-fullscreen .mce-btn.mce-active {
    background: #e5e7eb !important;
    border-color: #dcdcde !important;
    border-radius: 4px !important;
}

.mce-tinymce.mce-fullscreen .mce-btn button {
    padding: 4px 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Шрифт в редакторе (через iframe) */
.mce-tinymce.mce-fullscreen .mce-edit-area iframe {
    background: transparent !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

.mce-tinymce.mce-fullscreen .mce-edit-area {
    flex: 1 !important;
    display: block !important;
    padding: 0 !important;
    background: #f0f0f1 !important;
    overflow: hidden !important;
    width: 100% !important;
}

/* Стили внутри iframe при полноэкранном режиме */
.tc-editor-fullscreen-html {
    background: #f0f0f1 !important;
    height: 100% !important;
    overflow-y: auto !important;
    display: block !important;
}

body.tc-editor-fullscreen {
    background: #ffffff !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    display: block !important;
    min-height: 100% !important;
}

/* Режим "Страница" (Paginated) */
body.tc-editor-fullscreen.tc-editor-paginated {
    max-width: 850px !important;
    width: 100% !important;
    margin-top: 40px !important;
    margin-bottom: 40px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15) !important;
    padding: 60px 80px !important;
    border: 1px solid #dcdcde !important;
}

/* Режим "Бесконечная страница" (Infinite) */
body.tc-editor-fullscreen.tc-editor-infinite {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    padding: 40px 15% !important;
    border: none !important;
}

@media (max-width: 900px) {
    body.tc-editor-fullscreen.tc-editor-paginated {
        margin: 20px auto !important;
        padding: 40px 30px !important;
        max-width: 95% !important;
    }
    body.tc-editor-fullscreen.tc-editor-infinite {
        padding: 30px 20px !important;
    }
}

/* Кнопка fullscreen справа в тулбаре */
.mce-toolbar .mce-btn[aria-label="Fullscreen"],
.mce-toolbar .mce-btn[aria-label="Полноэкранный режим"] {
    margin-left: auto !important;
}

/* Стили для кнопки выхода из fullscreen */
.mce-tinymce.mce-fullscreen .mce-btn[aria-label="Fullscreen"],
.mce-tinymce.mce-fullscreen .mce-btn[aria-label="Полноэкранный режим"] {
    background: var(--e-global-color-primary, #F7A984) !important;
    border-radius: 4px !important;
}

.mce-tinymce.mce-fullscreen .mce-btn[aria-label="Fullscreen"]:hover,
.mce-tinymce.mce-fullscreen .mce-btn[aria-label="Полноэкранный режим"]:hover {
    background: var(--e-global-color-accent, #5D7285) !important;
}

.mce-tinymce.mce-fullscreen .mce-btn[aria-label="Fullscreen"] i,
.mce-tinymce.mce-fullscreen .mce-btn[aria-label="Полноэкранный режим"] i {
    color: #ffffff !important;
}


/* ============================================
   Result Mode (read-only) - Requirement 7.5, 7.6
   ============================================ */
.text-checker-result-score {
    margin-bottom: var(--tc-public-gap);
}

.text-checker-result-text-wrapper,
.text-checker-result-errors-wrapper {
    background: #ffffff;
    border: 1px solid var(--e-global-color-border, #F2F4F7);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--tc-public-gap);
}

.text-checker-section-title {
    font-family: "Circe", Sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--e-global-color-secondary, #0B1220);
    padding: 12px 16px;
    margin: 0;
    background: var(--e-global-color-border, #F2F4F7);
    border-bottom: 1px solid var(--e-global-color-border, #F2F4F7);
}

.text-checker-result-text {
    padding: 16px;
    font-family: "Nunito Sans", Sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--e-global-color-text, #1D2939);
    max-height: 400px;
    overflow-y: auto;
}

.text-checker-result-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.text-checker-new-check-btn {
    /* Стили как у .elementor-button */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background-color: var(--e-global-color-accent, #5D7285);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    /* Типографика как у кнопок Elementor Kit */
    font-family: "Circe", Sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.5;
    letter-spacing: 0.5px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.text-checker-new-check-btn:hover {
    background-color: var(--e-global-color-secondary, #0B1220);
    color: #ffffff;
}

.text-checker-new-check-btn:active {
    transform: scale(0.98);
}

.text-checker-new-check-btn:focus-visible {
    outline: 2px solid var(--e-global-color-primary, #F7A984);
    outline-offset: 2px;
}

/* ============================================
   Not Found Mode
   ============================================ */
.text-checker-not-found {
    text-align: center;
    padding: 60px 20px;
}

.text-checker-not-found-title {
    font-family: "Circe", Sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--e-global-color-secondary, #0B1220);
    margin: 0 0 12px 0;
}

.text-checker-not-found-message {
    font-family: "Nunito Sans", Sans-serif;
    font-size: 16px;
    color: var(--e-global-color-text, #1D2939);
    margin: 0 0 8px 0;
}

.text-checker-not-found-hint {
    font-family: "Nunito Sans", Sans-serif;
    font-size: 14px;
    color: var(--e-global-color-lighter, #98A2B3);
    margin: 0 0 24px 0;
}

.text-checker-not-found-btn {
    /* Стили как у .elementor-button */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 30px;
    background-color: var(--e-global-color-accent, #5D7285);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    /* Типографика как у кнопок Elementor Kit */
    font-family: "Circe", Sans-serif;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 2em;
    letter-spacing: 1.1px;
    text-shadow: 0px 0px 10px rgba(0,0,0,0.3);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.text-checker-not-found-btn:hover {
    background-color: var(--e-global-color-primary, #F7A984);
    color: #ffffff;
}


/* ============================================
   Score Display Styles
   ============================================ */
.text-checker-result-score .kitchor-text-checker-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    background: #ffffff;
    border: 1px solid var(--e-global-color-border, #F2F4F7);
    border-radius: 8px;
}

.text-checker-result-score .kitchor-score-value {
    font-family: "Circe", Sans-serif;
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.text-checker-result-score .kitchor-score-value.score-good {
    color: #22c55e;
}

.text-checker-result-score .kitchor-score-value.score-medium {
    color: var(--e-global-color-highlight, #F79009);
}

.text-checker-result-score .kitchor-score-value.score-low {
    color: #ef4444;
}

.text-checker-result-score .kitchor-score-label {
    font-family: "Circe", Sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--e-global-color-lighter, #98A2B3);
    margin-bottom: 12px;
}

.text-checker-result-score .kitchor-score-disclaimer {
    font-family: "Nunito Sans", Sans-serif;
    font-size: 12px;
    color: var(--e-global-color-lighter, #98A2B3);
    text-align: center;
    max-width: 400px;
    line-height: 1.4;
}

/* Score Breakdown Styles for Public Page */
.text-checker-result-score .kitchor-score-breakdown {
    margin-top: 16px;
    width: 100%;
    max-width: 400px;
}

.text-checker-result-score .kitchor-score-breakdown-toggle {
    font-family: "Nunito Sans", Sans-serif;
    font-size: 13px;
    color: var(--e-global-color-primary, #3b82f6);
    cursor: pointer;
    user-select: none;
    text-align: center;
    display: block;
}

.text-checker-result-score .kitchor-score-breakdown-toggle:hover {
    text-decoration: underline;
}

.text-checker-result-score .kitchor-score-breakdown-details {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    font-family: "Nunito Sans", Sans-serif;
    font-size: 13px;
}

.text-checker-result-score .breakdown-formula {
    color: var(--e-global-color-lighter, #98A2B3);
    margin-bottom: 10px;
    font-style: italic;
    text-align: center;
}

.text-checker-result-score .breakdown-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.text-checker-result-score .breakdown-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.08);
    padding: 4px 10px;
    border-radius: 4px;
}

.text-checker-result-score .breakdown-category {
    color: var(--e-global-color-text, #344054);
}

.text-checker-result-score .breakdown-penalty {
    color: #ef4444;
    font-weight: 600;
}

/* ============================================
   Category Accordion Styles
   Note: Main styles are in text-checker.css
   Only add result-page specific overrides here
   ============================================ */
.text-checker-result-errors-wrapper .kitchor-text-checker-panel {
    border: none;
    box-shadow: none;
    margin-top: 0;
}

.text-checker-result-errors-wrapper .kitchor-text-checker-panel__body {
    padding: 0;
}


/* ============================================
   Error Item Styles
   Note: Main styles are in text-checker.css
   Only add result-page specific overrides here
   ============================================ */

/* ============================================
   Text Highlight Styles (for result text)
   ============================================ */
.text-checker-result-text .kitchor-spelling-error {
    background-color: rgba(239, 68, 68, 0.15);
    text-decoration: underline wavy var(--tc-error-red, #ef4444);
    text-decoration-thickness: 2px;
    cursor: help;
    padding: 0 2px;
    border-radius: 2px;
}

.text-checker-result-text .kitchor-punct-error {
    background-color: rgba(245, 158, 11, 0.2);
    border-bottom: 2px solid var(--tc-warning-orange, #f59e0b);
    cursor: help;
    padding: 0 2px;
}

.text-checker-result-text .kitchor-style-purple {
    background-color: rgba(168, 85, 247, 0.15);
    cursor: help;
    padding: 0 2px;
    border-radius: 2px;
}

.text-checker-result-text .kitchor-style-blue {
    background-color: rgba(59, 130, 246, 0.15);
    cursor: help;
    padding: 0 2px;
    border-radius: 2px;
}

.text-checker-result-text .kitchor-style-orange {
    background-color: rgba(251, 146, 60, 0.15);
    cursor: help;
    padding: 0 2px;
    border-radius: 2px;
}

.text-checker-result-text .kitchor-style-gray {
    background-color: rgba(148, 163, 184, 0.15);
    cursor: help;
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================
   Error Tooltip
   ============================================ */
.kitchor-error-tooltip {
    position: fixed;
    z-index: 10000;
    background: var(--tc-text-primary, #1f2937);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: var(--tc-radius-sm, 8px);
    font-size: 13px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    animation: tooltip-fade-in 0.15s ease;
}

@keyframes tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Active error highlight (when clicked from error panel) */
.text-checker-result-text .kitchor-error-active {
    animation: kitchor-error-pulse 0.6s ease 3;
    outline: 2px solid var(--e-global-color-primary, #F7A984);
    outline-offset: 2px;
    border-radius: 2px;
}

@keyframes kitchor-error-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(247, 169, 132, 0.6);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(247, 169, 132, 0.2);
    }
}

/* Error item clickable style */
.text-checker-result-errors-wrapper .kitchor-text-checker-error {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.text-checker-result-errors-wrapper .kitchor-text-checker-error:hover {
    background-color: rgba(247, 169, 132, 0.1);
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 767px) {
    .text-checker-page {
        padding: 16px;
    }

    .text-checker-title {
        font-size: 1.5rem;
    }

    .text-checker-editor-wrapper .mce-edit-area {
        min-height: 200px;
    }

    .text-checker-editor-wrapper .mce-edit-area iframe {
        min-height: 200px;
    }

    .text-checker-run-btn {
        width: 100%;
    }
    
    .text-checker-result-score .kitchor-score-value {
        font-size: 36px;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .text-checker-actions,
    .text-checker-disclaimer,
    .text-checker-result-actions {
        display: none !important;
    }

    .text-checker-editor-wrapper {
        border: 1px solid #ccc;
    }
}


/* ============================================
   Version Mismatch Notice (Requirement 7.8)
   ============================================ */
.text-checker-version-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    margin-bottom: var(--tc-public-gap, 24px);
    font-family: "Nunito Sans", Sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--e-global-color-text, #1D2939);
}

.text-checker-version-notice-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: #3b82f6;
    margin-top: 1px;
}

.text-checker-version-notice span {
    flex: 1;
}
