/**
 * Farasync — Hidden message-template editor styles (v1.0.0, Round R).
 *
 * REMOVABLE FEATURE MODULE — delete this file together with
 * class-farasync-notify-templates.php / admin-notify-templates.js.
 * Scoped under .farasync-tpl-* so nothing leaks into the main UI.
 */

/* The notify panel becomes the positioning context for the secret trigger. */
[data-panel="notify"] {
    position: relative;
}

/* ---- secret trigger (nearly invisible on purpose) ------------------------ */

.farasync-tpl-secret {
    position: absolute;
    top: 12px;
    inset-inline-end: 14px;
    font-size: 15px;
    line-height: 1;
    color: #64748b;
    opacity: 0.16;
    cursor: pointer;
    user-select: none;
    transition: opacity 160ms ease;
    z-index: 5;
}

.farasync-tpl-secret:hover {
    opacity: 0.65;
}

/* ---- v1.0.0 (Round Y18): secret DEBUG toggle — icon-only sibling -------- */

.farasync-tpl-secret-debug {
    position: absolute;
    top: 14px;
    inset-inline-end: 42px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    font-size: 14px;
    line-height: 1;
    color: #64748b;
    opacity: 0.16;
    cursor: pointer;
    user-select: none;
    transition: opacity 160ms ease;
    z-index: 5;
    appearance: none;
    -webkit-appearance: none;
}

.farasync-tpl-secret-debug:hover {
    opacity: 0.65;
}

.farasync-tpl-secret-debug .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

.farasync-tpl-secret-debug:focus {
    outline: none;
    box-shadow: none;
}

/* v1.0.0 (Round Y18): BOTH secret buttons (pencil ✎ + debug icon) start
   HIDDEN by default; the header-logo 10-left-click code toggles the
   .farasync-secret-hidden class (sessionStorage keeps the state across the
   plugin's full-page tab navigations). Class-based — never [hidden] — so the
   Y14 lesson (display rules fighting the hidden attribute) cannot repeat. */
/* ---- v1.0.0 (user request): secret TEST-ALL toggle — third sibling ------ */

.farasync-tpl-secret-test {
    position: absolute;
    top: 14px;
    inset-inline-end: 70px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    font-size: 14px;
    line-height: 1;
    color: #64748b;
    opacity: 0.16;
    cursor: pointer;
    user-select: none;
    transition: opacity 160ms ease;
    z-index: 5;
    appearance: none;
    -webkit-appearance: none;
}

.farasync-tpl-secret-test:hover {
    opacity: 0.65;
}

.farasync-tpl-secret-test .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

.farasync-tpl-secret-test:focus {
    outline: none;
    box-shadow: none;
}

/* ---- v1.0.0 (user bug report): secret MSGS icon — FOURTH sibling --------
   It shipped with NO family rules, so it fell back to default WP button
   chrome (wrong size/colour) and sat at the panel's flow position instead
   of the sibling row. Mirror the test/debug recipe exactly and take the
   next slot in the row: ✎ 14px → debug 42px → test 70px → msgs 98px
   (inset-inline-end, so the row flips sides with the locale like before). */

.farasync-tpl-secret-msgs {
    position: absolute;
    top: 14px;
    inset-inline-end: 98px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    font-size: 14px;
    line-height: 1;
    color: #64748b;
    opacity: 0.16;
    cursor: pointer;
    user-select: none;
    transition: opacity 160ms ease;
    z-index: 5;
    appearance: none;
    -webkit-appearance: none;
}

.farasync-tpl-secret-msgs:hover {
    opacity: 0.65;
}

.farasync-tpl-secret-msgs .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

.farasync-tpl-secret-msgs:focus {
    outline: none;
    box-shadow: none;
}

.farasync-tpl-secret.farasync-secret-hidden,
.farasync-tpl-secret-debug.farasync-secret-hidden,
.farasync-tpl-secret-test.farasync-secret-hidden,
.farasync-tpl-secret-msgs.farasync-secret-hidden {
    display: none !important;
}

/* ---- drawer --------------------------------------------------------------- */

.farasync-tpl-drawer {
    margin-top: 26px;
    padding: 18px;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 14px;
}

.farasync-tpl-drawer[hidden] {
    display: none;
}

.farasync-tpl-head h2 {
    margin: 0 0 6px;
    font-size: 17px;
}

.farasync-tpl-head p {
    margin: 0 0 8px;
    font-size: 12.5px;
    line-height: 1.9;
    color: #475569;
    max-width: 860px;
}

.farasync-tpl-head .farasync-tpl-smart {
    color: #7c3aed;
}

.farasync-tpl-group {
    margin-top: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
}

.farasync-tpl-group h3 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #334155;
}

/* ---- bundled banner strip (Round S: images live inside the plugin) -------- */

.farasync-tpl-banners {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0 2px;
    font-size: 12.5px;
    color: #475569;
}

.farasync-tpl-banners img {
    max-width: 200px;
    max-height: 56px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: block;
}

/* side heading — only rendered when BOTH module modes are active */
.farasync-tpl-side {
    margin: 18px 0 8px;
    font-size: 14.5px;
    color: #1e293b;
}

/* ---- card ------------------------------------------------------------------ */

.farasync-tpl-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background: #ffffff;
}

.farasync-tpl-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.farasync-tpl-card-head strong {
    font-size: 13.5px;
    color: #0f172a;
}

.farasync-tpl-badge {
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 10px;
}

.farasync-tpl-badge.is-active {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #059669;
}

.farasync-tpl-badge.is-off {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

.farasync-tpl-badge.is-reserve {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    color: #7c3aed;
}

/* ---- tokens ----------------------------------------------------------------- */

.farasync-tpl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.farasync-tpl-chip {
    font-size: 10.5px;
    font-family: monospace;
    direction: ltr;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px 7px;
    cursor: pointer;
    color: #475569;
}

.farasync-tpl-chip:hover {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

/* ---- textarea ---------------------------------------------------------------- */

.farasync-tpl-text {
    width: 100%;
    min-height: 170px;
    resize: vertical;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 2;
    white-space: pre;
}

.farasync-tpl-text:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 2px #e2e8f0;
    outline: none;
}

.farasync-tpl-counter {
    font-size: 11px;
    color: #94a3b8;
    margin: 4px 0 0;
}

.farasync-tpl-counter.is-warn {
    color: #dc2626;
    font-weight: 600;
}

/* ---- actions ------------------------------------------------------------------- */

.farasync-tpl-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.farasync-tpl-actions .button-link {
    font-size: 11.5px;
    text-decoration: none;
}

.farasync-tpl-status {
    margin: 8px 0 0;
    font-size: 12px;
    color: #475569;
    min-height: 18px;
}

.farasync-tpl-status.is-ok {
    color: #059669;
}

.farasync-tpl-status.is-err {
    color: #dc2626;
}

/* small screens: keep the drawer usable */
@media (max-width: 782px) {
    .farasync-tpl-drawer {
        padding: 12px;
    }

    .farasync-tpl-card {
        padding: 10px;
    }
}

/* v1.0.0 (Round Y10): the visible per-side «send samples of all events»
   bar — sits directly on the notifications tab (the old test-all button
   hid inside the hidden template drawer). */
.farasync-tpl-side-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0 4px;
}
.farasync-tpl-side-actions .farasync-tpl-testall-side .dashicons {
    font-size: 16px;
    height: 16px;
    width: 16px;
    margin-top: 4px;
}
.farasync-tpl-side-actions .farasync-tpl-side-status {
    color: #475569;
    font-size: 12.5px;
    font-weight: 600;
}
.farasync-tpl-side-actions .farasync-tpl-side-status.is-ok {
    color: #16a34a;
}
.farasync-tpl-side-actions .farasync-tpl-side-status.is-err {
    color: #dc2626;
}

/* v1.0.0 (Round Y20, user request): the save button and the per-side
   «send samples of all events» buttons share ONE row — the relocated
   .farasync-tpl-side-actions bar sits right next to the save button. */
.farasync-notify-save-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 0;
}
.farasync-notify-save-row .farasync-notify-save {
    margin: 0;
}
.farasync-notify-save-row .farasync-tpl-side-actions {
    margin: 0;
}

/* v1.0.0 (UI audit): secret trigger buttons are near-invisible by design —
   keyboard users tabbed into INVISIBLE controls. Make focus reveal them. */
.farasync-tpl-secret:focus-visible,
.farasync-tpl-secret-btn:focus-visible,
.farasync-tpl-secret-trigger:focus-visible {
    opacity: 1 !important;
    outline: 2px solid #6366f1 !important;
    outline-offset: 2px !important;
}

