/**
 * Evergo Modular Rich Text & Table Editor - Stylesheet
 * Önállóan betölthető, design-biztos szöveg- és táblázatszerkesztő modul (text-editor/text-editor.css)
 */

/* ==========================================================================
   1. LEBEGŐ SZÖVEGSZERKESZTŐ ESZKÖZTÁR (SINGLETON FLOATING TOOLBAR)
   ========================================================================== */
.evergo-rte-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 950;
    display: none;
    flex-direction: column;
    background: #2b2b2b;
    border: 1px solid #444444;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
    color: #e4e4e7;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    user-select: none;
    pointer-events: auto;
    max-width: calc(100vw - 24px);
}

.evergo-rte-toolbar.is-visible {
    display: flex;
}

body.preview-mode .evergo-rte-toolbar {
    display: none !important;
}

.evergo-rte-row,
.evergo-rte-main-row {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 7px;
    white-space: nowrap;
}

.evergo-rte-row + .evergo-rte-row {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.evergo-rte-row-1 {
    padding-top: 6px;
    padding-bottom: 5px;
}

.evergo-rte-row-2 {
    padding-top: 5px;
    padding-bottom: 6px;
    background: rgba(0, 0, 0, 0.12);
}

.evergo-rte-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 3px;
    flex-shrink: 0;
}

/* --- Bekezdés / Címsor / Betű típusválasztók --- */
.evergo-rte-select {
    background: #363636;
    color: #ffffff;
    border: 1px solid #4a4a4a;
    border-radius: 5px;
    padding: 3px 6px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    height: 26px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.rte-select-font {
    min-width: 118px;
    max-width: 130px;
    font-weight: 500;
}

.rte-select-size {
    width: 66px;
    font-weight: 600;
    text-align: center;
}

.rte-select-block {
    min-width: 108px;
}

.rte-select-lh {
    min-width: 102px;
}

.evergo-rte-select:hover,
.evergo-rte-select:focus {
    border-color: rgba(255, 255, 255, 0.35);
    background: #404040;
}

.evergo-rte-select.has-override {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3) !important;
}

.rte-override-reset-btn {
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #f59e0b;
    color: #ffffff;
    border: 1px solid #1e1e1e;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease, background 0.15s ease;
    padding: 0;
}
.rte-override-reset-btn i {
    pointer-events: none;
}

/* 1. sorban lévő kontrollnál felette helyezkedik el */
.evergo-rte-row-1 .rte-override-reset-btn {
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
}
.evergo-rte-row-1 .rte-override-reset-btn:hover {
    background: #ef4444;
    transform: translateX(-50%) scale(1.15);
}

/* 2. sorban lévő kontrollnál alatta helyezkedik el */
.evergo-rte-row-2 .rte-override-reset-btn {
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
}
.evergo-rte-row-2 .rte-override-reset-btn:hover {
    background: #ef4444;
    transform: translateX(-50%) scale(1.15);
}

.evergo-rte-select option {
    background: #2b2b2b;
    color: #ffffff;
    padding: 4px 6px;
}

.rte-font-opt-poppins { font-family: 'Poppins', sans-serif !important; }
.rte-font-opt-inter { font-family: 'Inter', sans-serif !important; }
.rte-font-opt-space { font-family: 'Space Grotesk', sans-serif !important; }
.rte-font-opt-jakarta { font-family: 'Plus Jakarta Sans', sans-serif !important; }
.rte-font-opt-syne { font-family: 'Syne', sans-serif !important; }
.rte-font-opt-outfit { font-family: 'Outfit', sans-serif !important; }
.rte-font-opt-montserrat { font-family: 'Montserrat', sans-serif !important; }
.rte-font-opt-playfair { font-family: 'Playfair Display', serif !important; }

/* --- Eszköztár gombok --- */
.evergo-rte-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #d4d4d8;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.14s ease;
    position: relative;
}

.evergo-rte-btn.rte-btn-wide {
    width: auto;
    padding: 0 7px;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
}

.evergo-rte-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.evergo-rte-btn.is-active {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
}

.evergo-rte-btn.rte-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.rte-color-indicator {
    position: absolute;
    bottom: 3px;
    left: 5px;
    right: 5px;
    height: 2.5px;
    border-radius: 2px;
    background: #ffffff;
}

/* ==========================================================================
   2. KONTEXTUÁLIS TÁBLÁZAT-KEZELŐ ALSÁV (AMIKOR A KURZOR TÁBLÁZATBAN VAN)
   ========================================================================== */
.evergo-rte-table-bar {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    padding: 4px 7px;
    background: #242424;
    border-top: 1px solid #383838;
    border-radius: 0 0 8px 8px;
}

.evergo-rte-table-bar.is-visible {
    display: flex;
}

.evergo-rte-table-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #e4e4e7;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 4px;
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================================================
   3. FELUGRÓ PANELEK (SZÍNPALETTA, LINK SZERKESZTŐ, TÁBLÁZAT MÉRETVÁLASZTÓ)
   ========================================================================== */
.evergo-rte-popover {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #2b2b2b;
    border: 1px solid #444444;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
    padding: 10px;
    z-index: 960;
    min-width: 210px;
}

.evergo-rte-popover.is-open {
    display: block;
}

.rte-popover-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Színpaletta */
.rte-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}

.rte-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
    padding: 0;
}

.rte-color-swatch:hover {
    transform: scale(1.12);
    border-color: #ffffff;
}

.rte-color-custom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rte-color-custom-row input[type="color"] {
    width: 26px;
    height: 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

/* Link szerkesztő popover */
.rte-link-popover {
    width: 260px;
}

.rte-link-input {
    width: 100%;
    background: #202020;
    border: 1px solid #444444;
    border-radius: 5px;
    color: #ffffff;
    padding: 6px 8px;
    font-size: 12px;
    outline: none;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.rte-link-input:focus {
    border-color: rgba(255, 255, 255, 0.4);
}

.rte-link-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.rte-link-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #cbd5e1;
    cursor: pointer;
}

.rte-popover-btn {
    background: #3e3e3e;
    color: #ffffff;
    border: 1px solid #555555;
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rte-popover-btn:hover {
    background: #4e4e4e;
    border-color: #666666;
}

.rte-popover-btn.rte-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #cccccc;
    border-color: rgba(255, 255, 255, 0.12);
}

.rte-popover-btn.rte-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Táblázat beszúró rács-választó (Grid Picker) */
.rte-table-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 20px);
    gap: 4px;
    padding: 4px;
    background: #202020;
    border-radius: 6px;
    border: 1px solid #444444;
    justify-content: center;
}

.rte-table-picker-cell {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background: #303030;
    border: 1px solid #484848;
    cursor: pointer;
    transition: background-color 0.1s ease, border-color 0.1s ease;
}

.rte-table-picker-cell.is-highlighted {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Régi beégetett .text-format-toolbar elrejtése (kompatibilitás korábbi mentésekkel) */
.text-format-toolbar {
    display: none !important;
}

/* ==========================================================================
   4. DESIGN-BIZTOS TIPOGRÁFIA ÉS RESZPONZÍV TÁBLÁZATOK (.text-content-box)
   ========================================================================== */
.text-content-box {
    outline: none;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    pointer-events: auto !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.55;
    color: #1e293b;
}

.text-content-box * {
    user-select: text !important;
    -webkit-user-select: text !important;
}

.text-content-box > *:first-child {
    margin-top: 0 !important;
}

.text-content-box > *:last-child {
    margin-bottom: 0 !important;
}

.text-content-box h1 {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    line-height: 1.2;
    color: #0f172a;
    margin: 0 0 12px 0;
    letter-spacing: -0.02em;
}

.text-content-box h2 {
    font-size: clamp(21px, 3vw, 28px);
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
    margin: 0 0 10px 0;
    letter-spacing: -0.01em;
}

.text-content-box h3 {
    font-size: clamp(18px, 2.4vw, 22px);
    font-weight: 600;
    line-height: 1.3;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.text-content-box h4 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    color: #334155;
    margin: 0 0 6px 0;
}

.text-content-box p {
    font-size: 15px;
    line-height: inherit;
    color: #475569;
    margin: 0 0 10px 0;
}

.text-content-box p.rte-lead {
    font-size: clamp(17px, 2vw, 19px);
    font-weight: 400;
    line-height: 1.65;
    color: #334155;
    margin: 0 0 14px 0;
}

.text-content-box blockquote {
    margin: 12px 0;
    padding: 10px 16px;
    border-left: 3px solid var(--primary-color, #346af3);
    background: rgba(52, 106, 243, 0.05);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #334155;
}

.text-content-box ul,
.text-content-box ol {
    margin: 8px 0 12px 0;
    padding-left: 22px;
    color: #475569;
}

.text-content-box li {
    margin-bottom: 4px;
    line-height: inherit;
}

.text-content-box a {
    color: var(--primary-color, #346af3);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.text-content-box mark,
.text-content-box .rte-highlight {
    background-color: #fef08a;
    color: inherit;
    padding: 1px 4px;
    border-radius: 3px;
}

/* --- Design-biztos, reszponzív táblázat (.rte-table-wrapper & .rte-table) --- */
.text-content-box .rte-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin: 14px 0;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.text-content-box table.rte-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
    color: #334155;
}

.text-content-box table.rte-table th,
.text-content-box table.rte-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #f1f5f9;
    min-width: 70px;
    vertical-align: top;
    outline: none;
}

.text-content-box table.rte-table th:last-child,
.text-content-box table.rte-table td:last-child {
    border-right: none;
}

.text-content-box table.rte-table tbody tr:last-child td {
    border-bottom: none;
}

.text-content-box table.rte-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #0f172a;
    border-bottom: 2px solid #e2e8f0;
}

/* Zebra csíkozás opció */
.text-content-box table.rte-table.rte-table-striped tbody tr:nth-child(even) td {
    background-color: #f8fafc;
}

/* Kompakt táblázat opció */
.text-content-box table.rte-table.rte-table-compact th,
.text-content-box table.rte-table.rte-table-compact td {
    padding: 6px 10px;
    font-size: 13px;
}

/* Aktív szerkesztett cella finom kiemelése szerkesztő módban */
body:not(.preview-mode) .text-content-box table.rte-table td:focus,
body:not(.preview-mode) .text-content-box table.rte-table th:focus,
body:not(.preview-mode) .text-content-box table.rte-table .rte-active-cell {
    box-shadow: inset 0 0 0 1.5px var(--primary-color, #346af3);
    background-color: rgba(52, 106, 243, 0.03);
}

/* Felső és alsó kapitális gombok a toolbarban */
.evergo-rte-btn.rte-btn-case {
    font-size: 11px;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.text-content-box [data-case-mode="uppercase"],
.text-content-box .rte-case-uppercase {
    text-transform: uppercase !important;
    font-variant: normal !important;
}

.text-content-box [data-case-mode="small-caps"],
.text-content-box .rte-case-small-caps {
    font-variant: small-caps !important;
    text-transform: none !important;
}

.text-content-box [data-case-mode="lowercase"],
.text-content-box .rte-case-lowercase {
    text-transform: lowercase !important;
    font-variant: normal !important;
}

