/**
 * Text Checker Styles
 * 
 * Стили для Error_Panel и Tooltip модуля проверки текста.
 * Стили подсветки ошибок внедряются в TinyMCE iframe через content_style.
 * 
 * @package Kitchor Child
 * @version 1.1.0
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --tc-error-red: #ef4444;
    --tc-error-red-bg: rgba(239, 68, 68, 0.1);
    --tc-warning-orange: #f59e0b;
    --tc-warning-orange-bg: rgba(245, 158, 11, 0.2);
    --tc-focus-blue: #3b82f6;
    --tc-focus-blue-bg: rgba(59, 130, 246, 0.12);
    --tc-radius-sm: 8px;
    --tc-radius-md: 10px;
    --tc-control-bg: #ffffff;
    --tc-control-bg-muted: #f9fafb;
    --tc-style-purple: rgba(168, 85, 247, 0.2);
    --tc-style-yellow: rgba(250, 204, 21, 0.2);
    --tc-style-orange: rgba(251, 146, 60, 0.2);
    --tc-style-gray: rgba(148, 163, 184, 0.2);
    --tc-style-blue: rgba(59, 130, 246, 0.2);
    --tc-panel-bg: #ffffff;
    --tc-panel-border: #e5e7eb;
    --tc-panel-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --tc-text-primary: #1f2937;
    --tc-text-secondary: #6b7280;
    --tc-text-muted: #9ca3af;
}

#wp-custom_field_4-wrap .mce-tinymce,
#wp-ugc_content-wrap .mce-tinymce {
    border: 1px solid var(--tc-panel-border);
    border-radius: var(--tc-radius-md);
    box-shadow: var(--tc-panel-shadow);
    overflow: hidden;
    background: var(--tc-control-bg);
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

#wp-custom_field_4-wrap .wp-editor-container,
#wp-ugc_content-wrap .wp-editor-container {
    border: 0;
    border-radius: var(--tc-radius-md);
    overflow: hidden;
    box-shadow: none;
}

#wp-custom_field_4-wrap .mce-edit-area iframe,
#wp-ugc_content-wrap .mce-edit-area iframe {
    border: 0;
    outline: none;
}

#wp-custom_field_4-wrap .mce-tinymce:focus-within,
#wp-ugc_content-wrap .mce-tinymce:focus-within {
    border-color: var(--tc-panel-border);
    box-shadow: var(--tc-panel-shadow);
}

#wp-custom_field_4-wrap .mce-tinymce.kitchor-tc-has-errors:not(:focus-within),
#wp-ugc_content-wrap .mce-tinymce.kitchor-tc-has-errors:not(:focus-within),
#wp-custom_field_4-wrap .mce-tinymce.kitchor-tc-has-api-error:not(:focus-within),
#wp-ugc_content-wrap .mce-tinymce.kitchor-tc-has-api-error:not(:focus-within) {
    border-color: var(--tc-panel-border);
    box-shadow: var(--tc-panel-shadow);
}

#wp-custom_field_4-wrap.kitchor-tc-has-errors:not(:focus-within),
#wp-ugc_content-wrap.kitchor-tc-has-errors:not(:focus-within),
#wp-custom_field_4-wrap.kitchor-tc-has-api-error:not(:focus-within),
#wp-ugc_content-wrap.kitchor-tc-has-api-error:not(:focus-within) {
    border-color: var(--tc-panel-border);
    box-shadow: var(--tc-panel-shadow);
}

#wp-custom_field_4-wrap .mce-tinymce.kitchor-tc-has-warnings:not(:focus-within),
#wp-ugc_content-wrap .mce-tinymce.kitchor-tc-has-warnings:not(:focus-within) {
    border-color: var(--tc-panel-border);
    box-shadow: var(--tc-panel-shadow);
}

#wp-custom_field_4-wrap.kitchor-tc-has-warnings:not(:focus-within),
#wp-ugc_content-wrap.kitchor-tc-has-warnings:not(:focus-within) {
    border-color: var(--tc-panel-border);
    box-shadow: var(--tc-panel-shadow);
}

#wp-custom_field_4-wrap .mce-top-part::before,
#wp-ugc_content-wrap .mce-top-part::before {
    box-shadow: none;
}

#wp-custom_field_4-wrap .mce-top-part,
#wp-ugc_content-wrap .mce-top-part {
    background: var(--tc-control-bg-muted);
    border-bottom: 1px solid var(--tc-panel-border);
}

#wp-custom_field_4-wrap .mce-toolbar-grp,
#wp-ugc_content-wrap .mce-toolbar-grp {
    border-bottom: 0;
    background: transparent;
}

#wp-custom_field_4-wrap .mce-toolbar-grp,
#wp-ugc_content-wrap .mce-toolbar-grp,
#wp-custom_field_4-wrap .mce-menubar,
#wp-ugc_content-wrap .mce-menubar {
    padding: 6px 8px;
}

#wp-custom_field_4-wrap .mce-btn button,
#wp-ugc_content-wrap .mce-btn button,
#wp-custom_field_4-wrap .mce-btn .mce-txt,
#wp-ugc_content-wrap .mce-btn .mce-txt {
    font-family: inherit;
}

#wp-custom_field_4-wrap .mce-btn,
#wp-ugc_content-wrap .mce-btn {
    border-radius: 6px;
}

#wp-custom_field_4-wrap .mce-btn button,
#wp-ugc_content-wrap .mce-btn button {
    border-radius: 6px;
}

#wp-custom_field_4-wrap .mce-btn:hover,
#wp-ugc_content-wrap .mce-btn:hover {
    background: rgba(148, 163, 184, 0.16);
}

#wp-custom_field_4-wrap .mce-btn[aria-label*="Toolbar Toggle"],
#wp-ugc_content-wrap .mce-btn[aria-label*="Toolbar Toggle"] {
    display: none !important;
}

#wp-custom_field_4-wrap .mce-btn.mce-active,
#wp-ugc_content-wrap .mce-btn.mce-active,
#wp-custom_field_4-wrap .mce-btn:active,
#wp-ugc_content-wrap .mce-btn:active {
    background: rgba(148, 163, 184, 0.24);
}

#wp-custom_field_4-wrap .mce-btn button:focus-visible,
#wp-ugc_content-wrap .mce-btn button:focus-visible {
    outline: 2px solid var(--tc-focus-blue);
    outline-offset: 2px;
}

#wp-link-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100000;
}

#wp-link-wrap {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
    z-index: 100001;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #111827;
}

#wp-link-wrap #wp-link-close {
    display: none !important;
}

#wp-link-wrap #wplink-link-existing-content,
#wp-link-wrap #search-panel {
    display: none !important;
}

/* Mobile Adaptation */
@media screen and (max-width: 782px) {
    .kitchor-text-checker-panel {
        margin-top: 12px;
        font-size: 13px;
    }
    
    .kitchor-tc-panel-header {
        padding: 10px 12px;
    }
    
    .kitchor-tc-panel-body {
        max-height: 250px;
    }
    
    .kitchor-tc-error-item {
        padding: 10px 12px;
    }
    
    .kitchor-text-checker-tooltip {
        max-width: calc(100vw - 32px);
        left: 16px !important;
        right: 16px !important;
        transform: none !important;
    }
}

/* WordPress Link Dialog Styling */
#wp-link-wrap .submitbox {
    background: var(--tc-control-bg-muted);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: nowrap;
    padding-top: 14px;
}

#wp-link-wrap #wp-link-cancel,
#wp-link-wrap #wp-link-update {
    margin: 0;
}

#wp-link-wrap input[type="text"],
#wp-link-wrap input[type="search"],
#wp-link-wrap input[type="url"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    font-size: 14px;
    line-height: 1.4;
    color: #111827;
    box-shadow: none;
}

#wp-link-wrap input[type="text"]:focus,
#wp-link-wrap input[type="search"]:focus,
#wp-link-wrap input[type="url"]:focus {
    outline: none;
    border-color: #2563eb;
}

#wp-link-wrap .button,
#wp-link-wrap input.button {
    font-size: 14px !important;
    line-height: 1.1 !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    border: 1px solid #d1d5db !important;
    background: #ffffff !important;
    color: #111827 !important;
    font-weight: 500 !important;
    box-shadow: none !important;
}

#wp-link-wrap .button.button-primary,
#wp-link-wrap input.button.button-primary {
    background: var(--e-global-color-accent, #F7A984) !important;
    border-color: var(--e-global-color-accent, #F7A984) !important;
    color: #ffffff !important;
}

#wp-link-wrap .button.button-primary:hover,
#wp-link-wrap input.button.button-primary:hover {
    filter: brightness(0.97);
}

#wp-link-wrap .button:hover,
#wp-link-wrap input.button:hover {
    filter: brightness(0.98);
}

#wp-link-wrap .button:active,
#wp-link-wrap input.button:active {
    transform: translateY(1px);
}

#wp-custom_field_4-wrap .mce-edit-area,
#wp-ugc_content-wrap .mce-edit-area {
    background: var(--tc-control-bg);
}

#wp-custom_field_4-wrap .mce-edit-area iframe,
#wp-ugc_content-wrap .mce-edit-area iframe {
    background: var(--tc-control-bg);
}

#wp-custom_field_4-wrap .mce-statusbar,
#wp-ugc_content-wrap .mce-statusbar {
    background: var(--tc-control-bg-muted);
    border-top: 1px solid var(--tc-panel-border);
}

#wp-custom_field_4-wrap .mce-statusbar .mce-path-item,
#wp-ugc_content-wrap .mce-statusbar .mce-path-item {
    font-family: inherit;
    color: var(--tc-text-secondary);
}

/* ============================================
   Error Panel Container
   ============================================ */
.kitchor-text-checker-panel {
    position: relative;
    background: var(--tc-panel-bg);
    border: 1px solid var(--tc-panel-border);
    border-radius: var(--tc-radius-md);
    box-shadow: var(--tc-panel-shadow);
    margin-top: 16px;
    overflow: hidden;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

/* Panel Header */
.kitchor-text-checker-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--tc-control-bg-muted);
    border-bottom: 1px solid var(--tc-panel-border);
}

.kitchor-text-checker-panel__title {
    font-weight: 600;
    color: var(--tc-text-primary);
    margin: 0;
    font-size: 14px;
}


.kitchor-text-checker-panel__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--tc-error-red);
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.kitchor-text-checker-panel__count--warning {
    background: var(--tc-warning-orange);
}

.kitchor-text-checker-panel__count--success {
    background: #10b981;
}

.kitchor-text-checker-panel__loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    font-size: 12px;
    color: var(--tc-text-secondary);
    white-space: nowrap;
}

.kitchor-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-top-color: rgba(59, 130, 246, 0.9);
    animation: kitchor-tc-spin 0.8s linear infinite;
}

@keyframes kitchor-tc-spin {
    to { transform: rotate(360deg); }
}

/* Panel Body */
.kitchor-text-checker-panel__body {
    overflow-y: visible;
}

.kitchor-text-checker-panel__warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.08);
    border-bottom: 1px solid rgba(239, 68, 68, 0.18);
    color: #991b1b;
    font-size: 13px;
}

.kitchor-text-checker-panel__warning-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Empty State */
.kitchor-text-checker-panel__empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--tc-text-muted);
}

.kitchor-text-checker-panel__empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

/* Info Message (for English text) */
.kitchor-text-checker-panel__info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    color: #1d4ed8;
    font-size: 13px;
}

.kitchor-text-checker-panel__info-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* ============================================
   Category Accordion
   ============================================ */
.kitchor-text-checker-category {
    border-bottom: 1px solid var(--tc-panel-border);
}

.kitchor-text-checker-category:last-child {
    border-bottom: none;
}

.kitchor-text-checker-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
}

.kitchor-text-checker-category__header:hover {
    background: #f9fafb;
}

.kitchor-text-checker-category__header:focus-visible {
    outline: 2px solid var(--tc-focus-blue);
    outline-offset: -2px;
    background: rgba(59, 130, 246, 0.06);
}

.kitchor-text-checker-category__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--tc-text-primary);
    font-size: 13px;
}

.kitchor-text-checker-category__icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Category color indicators */
.kitchor-text-checker-category--spelling .kitchor-text-checker-category__icon {
    background: var(--tc-error-red);
}

.kitchor-text-checker-category--punctuation .kitchor-text-checker-category__icon {
    background: var(--tc-warning-orange);
}

.kitchor-text-checker-category--headlines .kitchor-text-checker-category__icon {
    background: #8b5cf6;
}

.kitchor-text-checker-category--stopwords .kitchor-text-checker-category__icon {
    background: #a855f7;
}

.kitchor-text-checker-category--amplifiers .kitchor-text-checker-category__icon {
    background: #eab308;
}

.kitchor-text-checker-category--evaluations .kitchor-text-checker-category__icon {
    background: #f97316;
}

.kitchor-text-checker-category--official .kitchor-text-checker-category__icon {
    background: #64748b;
}

.kitchor-text-checker-category--vague .kitchor-text-checker-category__icon {
    background: #3b82f6;
}

.kitchor-text-checker-category--repeats .kitchor-text-checker-category__icon {
    background: #ec4899;
}

.kitchor-text-checker-category--water .kitchor-text-checker-category__icon {
    background: #06b6d4;
}

.kitchor-text-checker-category--seo .kitchor-text-checker-category__icon {
    background: #10b981;
}

.kitchor-text-checker-category--passive .kitchor-text-checker-category__icon {
    background: #6366f1;
}

.kitchor-text-checker-category--pleonasms .kitchor-text-checker-category__icon {
    background: #f43f5e;
}

.kitchor-text-checker-category--cliches .kitchor-text-checker-category__icon {
    background: #84cc16;
}

.kitchor-text-checker-category--complex .kitchor-text-checker-category__icon {
    background: #78716c;
}

.kitchor-text-checker-category--other .kitchor-text-checker-category__icon {
    background: #9ca3af;
}


.kitchor-text-checker-category__count {
    font-size: 12px;
    color: var(--tc-text-secondary);
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
}

.kitchor-text-checker-category__chevron {
    width: 16px;
    height: 16px;
    color: var(--tc-text-muted);
    transition: transform 0.2s ease;
}

.kitchor-text-checker-category.is-expanded .kitchor-text-checker-category__chevron {
    transform: rotate(180deg);
}

/* Category Content */
.kitchor-text-checker-category__content {
    display: none;
    padding: 0;
    background: #fafafa;
}

.kitchor-text-checker-category.is-expanded .kitchor-text-checker-category__content {
    display: block;
}

/* Error Items */
.kitchor-text-checker-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px 10px 32px;
    border-top: 1px solid var(--tc-panel-border);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.kitchor-text-checker-error:hover {
    background: #f3f4f6;
}

.kitchor-text-checker-error:focus-visible {
    outline: 2px solid var(--tc-focus-blue);
    outline-offset: -2px;
    background: rgba(59, 130, 246, 0.06);
}

.kitchor-text-checker-error__word {
    font-weight: 500;
    color: var(--tc-text-primary);
    word-break: break-word;
}

.kitchor-text-checker-error__message {
    font-size: 12px;
    color: var(--tc-text-secondary);
    margin-top: 2px;
}

/* ============================================
   Tooltip
   ============================================ */
.kitchor-text-checker-tooltip {
    position: fixed;
    z-index: 2147483647;
    max-width: 300px;
    padding: 12px 16px;
    background: var(--tc-panel-bg);
    border: 1px solid var(--tc-panel-border);
    border-radius: var(--tc-radius-md);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

/* ARIA/Accessibility: Focus styles for keyboard navigation */
.kitchor-text-checker-tooltip:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.kitchor-text-checker-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.kitchor-text-checker-tooltip__title {
    font-weight: 600;
    color: var(--tc-text-primary);
    margin-bottom: 6px;
}

.kitchor-text-checker-tooltip__message {
    color: var(--tc-text-secondary);
    margin-bottom: 10px;
}

/* Suggestions */
.kitchor-text-checker-tooltip__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.kitchor-text-checker-tooltip__suggestion {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #f3f4f6;
    border: 1px solid var(--tc-panel-border);
    border-radius: 4px;
    color: var(--tc-text-primary);
    font-size: 12px;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.kitchor-text-checker-tooltip__suggestion:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.kitchor-text-checker-tooltip__suggestion:focus-visible {
    outline: 2px solid var(--tc-focus-blue);
    outline-offset: 2px;
}

/* Add to Dictionary Button */
.kitchor-text-checker-tooltip__add-dict {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--tc-panel-border);
    border-radius: 4px;
    color: var(--tc-text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.kitchor-text-checker-tooltip__add-dict:hover {
    background: #f3f4f6;
    color: var(--tc-text-primary);
}

.kitchor-text-checker-tooltip__add-dict:focus-visible {
    outline: 2px solid var(--tc-focus-blue);
    outline-offset: 2px;
}

/* Tooltip Arrow */
.kitchor-text-checker-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: var(--tc-panel-bg);
    border-left: 1px solid var(--tc-panel-border);
    border-top: 1px solid var(--tc-panel-border);
    transform: rotate(45deg);
}


/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 767px) {
    .kitchor-text-checker-panel {
        margin-top: 12px;
        border-radius: var(--tc-radius-sm);
    }
    
    .kitchor-text-checker-panel__header {
        padding: 10px 12px;
    }
    
    .kitchor-text-checker-panel__body {
        max-height: 200px;
    }
    
    .kitchor-text-checker-category__header {
        padding: 8px 12px;
    }
    
    .kitchor-text-checker-error {
        padding: 8px 12px 8px 24px;
    }
    
    .kitchor-text-checker-tooltip {
        max-width: calc(100vw - 32px);
        left: 16px !important;
        right: 16px !important;
    }
}

#text-checker-hint,
#ugc-link-limit-hint,
#link-limit-hint,
#ugc_content_hint {
    display: block;
    color: var(--tc-text-secondary) !important;
    font-size: 12px !important;
    margin-top: 8px !important;
    line-height: 1.5;
}

#ugc_content_hint {
    font-size: 14px !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
}

#text-checker-toast,
#link-limit-toast,
#ugc-link-limit-toast {
    display: inline-block;
    color: #b91c1c !important;
    font-size: 12px !important;
    margin-left: 8px !important;
}

body .ugc-edit-form #wp-ugc_content-wrap.wp-editor-wrap,
body .ugc-edit-form #wp-ugc_content-wrap .mce-tinymce {
    border-color: var(--tc-panel-border) !important;
    border-radius: var(--tc-radius-md) !important;
    box-shadow: var(--tc-panel-shadow) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap.wp-editor-wrap:focus-within,
body .ugc-edit-form #wp-ugc_content-wrap .mce-tinymce:focus-within {
    border-color: rgba(59, 130, 246, 0.55) !important;
    box-shadow: 0 0 0 3px var(--tc-focus-blue-bg), var(--tc-panel-shadow) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap .mce-tinymce.kitchor-tc-has-errors:not(:focus-within),
body .ugc-edit-form #wp-ugc_content-wrap .mce-tinymce.kitchor-tc-has-api-error:not(:focus-within) {
    border-color: rgba(239, 68, 68, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08), var(--tc-panel-shadow) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap.wp-editor-wrap.kitchor-tc-has-errors:not(:focus-within),
body .ugc-edit-form #wp-ugc_content-wrap.wp-editor-wrap.kitchor-tc-has-api-error:not(:focus-within) {
    border-color: rgba(239, 68, 68, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08), var(--tc-panel-shadow) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap .mce-tinymce.kitchor-tc-has-warnings:not(:focus-within) {
    border-color: rgba(245, 158, 11, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.10), var(--tc-panel-shadow) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap.wp-editor-wrap.kitchor-tc-has-warnings:not(:focus-within) {
    border-color: rgba(245, 158, 11, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.10), var(--tc-panel-shadow) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap .mce-toolbar-grp,
body .ugc-edit-form #wp-ugc_content-wrap .mce-toolbar,
body .ugc-edit-form #wp-ugc_content-wrap .mce-menubar,
body .ugc-edit-form #wp-ugc_content-wrap .wp-editor-tools {
    background: var(--tc-control-bg-muted) !important;
    border-color: var(--tc-panel-border) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap .mce-btn {
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
}

body .ugc-edit-form #wp-ugc_content-wrap .mce-btn:hover {
    background: rgba(148, 163, 184, 0.16) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap .mce-btn.mce-active,
body .ugc-edit-form #wp-ugc_content-wrap .mce-btn:active {
    background: rgba(148, 163, 184, 0.24) !important;
}

body .ugc-edit-form #wp-ugc_content-wrap .mce-statusbar {
    background: var(--tc-control-bg-muted) !important;
    border-color: var(--tc-panel-border) !important;
}

/* ============================================
   Readiness Index Score Display
   Requirements: 5.7, 9.1, 9.2
   - 5.7: Display readiness index next to error list
   - 9.1: Disclaimer text under the index
   - 9.2: Neutral, informational color indication
   ============================================ */
.kitchor-text-checker-score {
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--tc-panel-border);
}

.kitchor-text-checker-score__content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.kitchor-text-checker-score__value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* Color classes - neutral and informational, not evaluative */
.kitchor-text-checker-score__value.score-good {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 2px solid #10b981;
}

.kitchor-text-checker-score__value.score-medium {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 2px solid #f59e0b;
}

.kitchor-text-checker-score__value.score-low {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 2px solid #ef4444;
}

.kitchor-text-checker-score__info {
    flex: 1;
    min-width: 0;
}

.kitchor-text-checker-score__label {
    font-weight: 600;
    font-size: 14px;
    color: var(--tc-text-primary);
    margin-bottom: 4px;
}

.kitchor-text-checker-score__disclaimer {
    font-size: 12px;
    line-height: 1.5;
    color: var(--tc-text-secondary);
}

/* Score Breakdown Styles */
.kitchor-text-checker-score__breakdown {
    margin: 8px 0;
}

.kitchor-text-checker-score__breakdown-toggle {
    font-size: 12px;
    color: var(--tc-focus-blue);
    cursor: pointer;
    user-select: none;
    display: inline-block;
    padding: 2px 0;
}

.kitchor-text-checker-score__breakdown-toggle:hover {
    text-decoration: underline;
}

.kitchor-text-checker-score__breakdown-toggle:focus {
    outline: 2px solid var(--tc-focus-blue);
    outline-offset: 2px;
    border-radius: 2px;
}

.kitchor-text-checker-score__breakdown-details {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--tc-radius-sm);
    font-size: 12px;
}

.kitchor-text-checker-score__breakdown-details .breakdown-formula {
    color: var(--tc-text-secondary);
    margin-bottom: 8px;
    font-style: italic;
}

.kitchor-text-checker-score__breakdown-details .breakdown-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.kitchor-text-checker-score__breakdown-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.08);
    padding: 3px 8px;
    border-radius: 4px;
}

.kitchor-text-checker-score__breakdown-item .breakdown-category {
    color: var(--tc-text-primary);
}

.kitchor-text-checker-score__breakdown-item .breakdown-penalty {
    color: var(--tc-error-red);
    font-weight: 600;
}

/* Responsive adjustments for score */
@media (max-width: 767px) {
    .kitchor-text-checker-score {
        padding: 12px;
    }
    
    .kitchor-text-checker-score__content {
        gap: 12px;
    }
    
    .kitchor-text-checker-score__value {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .kitchor-text-checker-score__label {
        font-size: 13px;
    }
    
    .kitchor-text-checker-score__disclaimer {
        font-size: 11px;
    }
}

/* RTL support for score */
[dir="rtl"] .kitchor-text-checker-score__content {
    flex-direction: row-reverse;
}

/* Print styles - hide score */
@media print {
    .kitchor-text-checker-score {
        display: none !important;
    }
}

/* ============================================
   Animation for Panel Updates
   ============================================ */
@keyframes kitchor-tc-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kitchor-text-checker-category__content .kitchor-text-checker-error {
    animation: kitchor-tc-fade-in 0.2s ease;
}

/* ============================================
   Highlight Pulse Animation (for scroll-to-error)
   ============================================ */
@keyframes kitchor-tc-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
    }
}

.kitchor-highlight-pulse {
    animation: kitchor-tc-pulse 0.6s ease 2;
}

/* ============================================
   Headline Warning Styles (for TinyMCE iframe)
   ============================================ */
/* 
 * These styles should be injected into TinyMCE content_style
 * They provide visual feedback for headline-level warnings
 */
.kitchor-headline-warning {
    position: relative;
    border-left: 3px solid var(--tc-warning-orange, #f59e0b);
    padding-left: 8px;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, transparent 100%);
}

.kitchor-headline-warning::after {
    content: '⚠';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.6;
}

/* ============================================
   FIX #6: Info Message Styles (Requirement 6.5)
   Yellow info message for missing headlines warning
   ============================================ */
.kitchor-info-message {
    background-color: var(--tc-style-yellow, rgba(250, 204, 21, 0.2));
    border-bottom: 2px solid #eab308;
    cursor: help;
}

/* Info-only error items in panel (not clickable) */
.kitchor-text-checker-error--info {
    cursor: default;
    opacity: 0.9;
}

.kitchor-text-checker-error--info:hover {
    background: inherit;
}

.kitchor-text-checker-error__icon {
    flex-shrink: 0;
    font-size: 14px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .kitchor-text-checker-panel,
    .kitchor-text-checker-tooltip {
        display: none !important;
    }
}

/* ============================================
   RTL (Right-to-Left) Support
   FIX #22: Support for RTL languages
   ============================================ */
[dir="rtl"] .kitchor-text-checker-panel__header,
[dir="rtl"] .kitchor-text-checker-category__header,
[dir="rtl"] .kitchor-text-checker-error {
    flex-direction: row-reverse;
}

[dir="rtl"] .kitchor-text-checker-category__title {
    flex-direction: row-reverse;
}

[dir="rtl"] .kitchor-text-checker-error {
    padding-left: 16px;
    padding-right: 32px;
}

[dir="rtl"] .kitchor-text-checker-tooltip::before {
    left: auto;
    right: 20px;
}

[dir="rtl"] .kitchor-headline-warning {
    border-left: none;
    border-right: 3px solid var(--tc-warning-orange, #f59e0b);
    padding-left: 0;
    padding-right: 8px;
    background: linear-gradient(270deg, rgba(245, 158, 11, 0.1) 0%, transparent 100%);
}

[dir="rtl"] .kitchor-headline-warning::after {
    right: auto;
    left: 4px;
}

[dir="rtl"] .kitchor-text-checker-tooltip__suggestions {
    flex-direction: row-reverse;
}

[dir="rtl"] .kitchor-text-checker-tooltip__add-dict {
    flex-direction: row-reverse;
}

/* RTL responsive adjustments */
@media (max-width: 767px) {
    [dir="rtl"] .kitchor-text-checker-error {
        padding-left: 12px;
        padding-right: 24px;
    }
}


/* ============================================
   Share Button Styles
   Requirement 7.7: Кнопка "Поделиться результатом"
   ============================================ */
.kitchor-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-left: auto;
    margin-right: 12px;
    background: transparent;
    border: 1px solid var(--tc-panel-border);
    border-radius: 6px;
    color: var(--tc-text-secondary);
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.kitchor-share-btn:hover {
    background: #f3f4f6;
    color: var(--tc-text-primary);
    border-color: #d1d5db;
}

.kitchor-share-btn:focus-visible {
    outline: 2px solid var(--tc-focus-blue);
    outline-offset: 2px;
}

.kitchor-share-btn:active {
    transform: translateY(1px);
}

.kitchor-share-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.kitchor-share-btn.is-loading {
    pointer-events: none;
}

.kitchor-share-btn.is-loading .kitchor-share-btn__icon {
    animation: kitchor-tc-spin 0.8s linear infinite;
}

.kitchor-share-btn__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.kitchor-share-btn__text {
    line-height: 1;
}

/* Mobile: hide text, show only icon */
@media (max-width: 480px) {
    .kitchor-share-btn {
        padding: 6px 8px;
        margin-right: 8px;
    }
    
    .kitchor-share-btn__text {
        display: none;
    }
}

/* ============================================
   Share Notification Styles
   Toast notification for share actions
   ============================================ */
.kitchor-share-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--tc-panel-bg);
    border: 1px solid var(--tc-panel-border);
    border-radius: var(--tc-radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: var(--tc-text-primary);
    z-index: 2147483647;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.kitchor-share-notification.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.kitchor-share-notification__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.kitchor-share-notification__text {
    flex: 1;
    min-width: 0;
}

/* Success notification */
.kitchor-share-notification--success {
    border-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.kitchor-share-notification--success .kitchor-share-notification__icon {
    color: #059669;
}

/* Error notification */
.kitchor-share-notification--error {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.kitchor-share-notification--error .kitchor-share-notification__icon {
    color: #dc2626;
}

/* Info notification */
.kitchor-share-notification--info {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.kitchor-share-notification--info .kitchor-share-notification__icon {
    color: #2563eb;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .kitchor-share-notification {
        left: 16px;
        right: 16px;
        bottom: 16px;
        transform: translateX(0) translateY(20px);
        max-width: none;
    }
    
    .kitchor-share-notification.is-visible {
        transform: translateX(0) translateY(0);
    }
}

/* RTL support for share button and notification */
[dir="rtl"] .kitchor-share-btn {
    margin-left: 12px;
    margin-right: auto;
    flex-direction: row-reverse;
}

[dir="rtl"] .kitchor-share-notification {
    flex-direction: row-reverse;
}

/* Print styles - hide share elements */
@media print {
    .kitchor-share-btn,
    .kitchor-share-notification {
        display: none !important;
    }
}
