/* ===== Writing Guide popup ===== */
/* פופאפ הקשרי שמופיע ליד שורה כדי להסביר את סוג השורה.
   מוצב ב־position absolute לפי חישוב מיקום ב־JS. */

/* כשמדריך ההיכרות פעיל — להסתיר את פופאפ מדריך הכתיבה לחלוטין. */
body.tour-active .wg-popup { display: none !important; }

.wg-popup {
    position: absolute;
    width: 320px;
    background: linear-gradient(160deg, #2a2a2a 0%, #1f1f1f 60%, #161616 100%);
    border-radius: 12px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 0 6px #2a2a2a,
        0 22px 56px rgba(0, 0, 0, 0.55),
        0 6px 16px rgba(0, 0, 0, 0.35);
    direction: rtl;
    font-family: Assistant, Arial, sans-serif;
    color: #fff;
    z-index: 9000;
    padding: 14px 16px 12px;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: auto;
}
.wg-popup.wg-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.wg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.wg-nav {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.wg-nav-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.wg-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.wg-popup.wg-light .wg-nav-btn {
    color: #94a3b8;
}
.wg-popup.wg-light .wg-nav-btn:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.wg-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.wg-title {
    flex: 1;
    text-align: center;
}

.wg-shortcut {
    display: inline-block;
    margin-right: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 7px;
    border-radius: 4px;
    vertical-align: middle;
    font-family: 'Courier New', Arial, monospace;
    letter-spacing: 0.02em;
}
.wg-popup.wg-light .wg-shortcut {
    color: #475569;
    background: rgba(15, 23, 42, 0.06);
}

.wg-title {
    font-weight: 700;
    font-size: 0.98rem;
    color: #ffffff;
    line-height: 1.3;
}

.wg-close {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: rgba(255, 255, 255, 0.65);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.wg-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.wg-body {
    font-size: 0.86rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 10px;
}

.wg-format {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}
.wg-format strong {
    color: #ffffff;
    font-weight: 600;
}

.wg-examples-label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    margin: 6px 0 4px;
    font-weight: 500;
}
.wg-examples {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.wg-example {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.55;
    font-family: Arial, sans-serif;
    white-space: pre-line;
}
.wg-example + .wg-example {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Format-block: mini screenplay snippet (character → parenthetical → dialogue),
   used by the parenthetical entry so users see the format in context.
   Right-padding values create the editor's RTL cascade: character is the most
   indented from the right (so it sits left), dialogue is the least indented. */
.wg-format-block {
    text-align: right;
    padding: 10px 12px;
}
.wg-fb-line {
    font-family: Arial, sans-serif;
    font-size: 0.85rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.78);
}
.wg-fb-character {
    font-weight: 700;
    padding-right: 45%;
}
.wg-fb-parenthetical {
    padding-right: 22%;
}
.wg-fb-dialogue {
    padding-right: 5%;
}

.wg-workflow-label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    margin: 8px 0 4px;
    font-weight: 500;
}
.wg-workflow {
    font-size: 0.85rem;
    color: #ffffff;
    line-height: 1.6;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 8px 11px;
    border-radius: 6px;
    border-right: 2px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.wg-workflow-icon {
    flex-shrink: 0;
    margin-top: 3px;
    opacity: 0.85;
}

.wg-tip {
    font-size: 0.8rem;
    color: rgba(255, 220, 120, 0.85);
    line-height: 1.55;
    margin-bottom: 12px;
}

.wg-footer {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.wg-disable-icon {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.wg-disable-icon:hover {
    background: rgba(255, 100, 100, 0.12);
    color: #ff6b6b;
}

.wg-btn-primary,
.wg-btn-secondary {
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-family: Assistant, sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.wg-btn-primary {
    background: #ffffff;
    color: #0f0f12;
}
.wg-btn-primary:hover {
    background: #e6e6e6;
    transform: translateY(-1px);
}
.wg-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.55);
}
.wg-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

/* חץ קטן בצד הפופאפ (כלפי השורה) — רק קישוט עדין */
.wg-arrow {
    display: none;
}

/* ===== Help menu — toggle state label ===== */
.wg-state-label {
    margin-right: auto;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
}


/* ============================================================
   Light mode — צבעים בלבד. גודל, מרווחים וגופנים זהים למצב הכהה.
   הסטרוק הלבן והפנימי נעשים דרך box-shadow כדי לא לשנות גודל.
   ============================================================ */

.wg-popup.wg-light {
    background: linear-gradient(160deg, #f6f6f6 0%, #ececec 60%, #e4e4e4 100%);
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.06),
        0 0 0 6px #ffffff,
        0 22px 56px rgba(15, 23, 42, 0.16),
        0 6px 16px rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.wg-popup.wg-light .wg-title { color: #0f172a; }

.wg-popup.wg-light .wg-close {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.5);
}
.wg-popup.wg-light .wg-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #0f172a;
}

.wg-popup.wg-light .wg-body {
    color: #1f2937;
    font-weight: 500;
}

.wg-popup.wg-light .wg-format {
    background: rgba(0, 0, 0, 0.05);
    color: #475569;
}
.wg-popup.wg-light .wg-format strong { color: #0f172a; }

.wg-popup.wg-light .wg-examples-label { color: #64748b; }

.wg-popup.wg-light .wg-examples {
    background: #ffffff;
}
.wg-popup.wg-light .wg-example { color: #1e293b; }
.wg-popup.wg-light .wg-example + .wg-example {
    border-top-color: rgba(0, 0, 0, 0.06);
}

.wg-popup.wg-light .wg-fb-line { color: #1e293b; }

.wg-popup.wg-light .wg-workflow-label { color: #64748b; }

.wg-popup.wg-light .wg-workflow {
    background: #2a2a2a;
    color: #ffffff;
    border-right-color: #555555;
}

.wg-popup.wg-light .wg-tip { color: #92400e; }

.wg-popup.wg-light .wg-btn-primary {
    background: #000000;
    color: #ffffff;
}
.wg-popup.wg-light .wg-btn-primary:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
}

.wg-popup.wg-light .wg-disable-icon {
    color: #94a3b8;
}
.wg-popup.wg-light .wg-disable-icon:hover {
    background: rgba(220, 50, 50, 0.1);
    color: #c0392b;
}

/* כפתור טוגל בתוך הפופאפ — מצב כהה / בהיר */
.wg-theme-toggle {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    margin-left: 4px;
}
.wg-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.wg-popup.wg-light .wg-theme-toggle {
    color: #94a3b8;
}
.wg-popup.wg-light .wg-theme-toggle:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}
