/**
 * Email Template Customizer — admin styles.
 *
 * Split-pane layout: left editor (60%) + right preview (40%).
 * Uses the shared design tokens from premium-shared.css.
 */

/* ---------------------------------------------------------------
   Description & merge tags banner
   --------------------------------------------------------------- */
.strp-email-customizer__description {
    color: var(--strp-text-secondary);
    margin: 0 0 16px;
}

.strp-email-customizer__merge-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
}

.strp-email-customizer__merge-tags code {
    background: var(--strp-primary-bg);
    color: var(--strp-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* ---------------------------------------------------------------
   Split-pane layout
   --------------------------------------------------------------- */
.strp-email-customizer__layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1200px) {
    .strp-email-customizer__layout {
        grid-template-columns: 1fr;
    }
}

/* ---------------------------------------------------------------
   Tab navigation
   --------------------------------------------------------------- */
.strp-email-customizer__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--strp-border);
    padding-bottom: 0;
}

.strp-email-customizer__tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--strp-text-secondary);
    cursor: pointer;
    transition: color var(--strp-transition), border-color var(--strp-transition);
    white-space: nowrap;
}

.strp-email-customizer__tab:hover {
    color: var(--strp-text-primary);
}

.strp-email-customizer__tab--active {
    color: var(--strp-primary);
    border-bottom-color: var(--strp-primary);
}

.strp-email-customizer__tab:focus-visible {
    outline: 2px solid var(--strp-primary);
    outline-offset: -2px;
}

/* ---------------------------------------------------------------
   Form panels
   --------------------------------------------------------------- */
.strp-email-customizer__panel {
    display: none;
}

.strp-email-customizer__panel--active {
    display: block;
}

.strp-email-customizer__field {
    margin-bottom: 16px;
}

.strp-email-customizer__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--strp-text-primary);
    margin-bottom: 6px;
}

.strp-email-customizer__toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--strp-text-primary);
    cursor: pointer;
}

.strp-email-customizer__input.widefat {
    border: 1px solid var(--strp-border);
    border-radius: var(--strp-radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    transition: border-color var(--strp-transition), box-shadow var(--strp-transition);
}

.strp-email-customizer__input.widefat:focus {
    border-color: var(--strp-primary);
    box-shadow: 0 0 0 2px var(--strp-primary-bg);
    outline: none;
}

textarea.strp-email-customizer__input.widefat {
    resize: vertical;
    min-height: 140px;
    font-family: inherit;
    line-height: 1.5;
}

/* ---------------------------------------------------------------
   Actions / notice
   --------------------------------------------------------------- */
.strp-email-customizer__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.strp-email-customizer__notice {
    font-size: 13px;
    font-weight: 500;
}

.strp-email-customizer__notice--success {
    color: var(--strp-success);
}

.strp-email-customizer__notice--error {
    color: var(--strp-danger);
}

/* ---------------------------------------------------------------
   Preview pane
   --------------------------------------------------------------- */
.strp-email-customizer__preview {
    position: sticky;
    top: 40px;
}

.strp-email-customizer__preview-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--strp-text-primary);
    margin: 0 0 12px;
}

.strp-email-customizer__preview-container {
    background: var(--strp-surface-secondary);
    border: 1px solid var(--strp-border);
    border-radius: var(--strp-radius-md);
    overflow: hidden;
}

.strp-email-customizer__iframe {
    width: 100%;
    min-height: 520px;
    border: none;
    display: block;
}

/* ---------------------------------------------------------------
   WordPress color picker overrides
   --------------------------------------------------------------- */
.strp-email-customizer__field .wp-picker-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.strp-email-customizer__field .wp-color-result {
    border-radius: var(--strp-radius-sm);
}

/* RTL Support */
[dir="rtl"] .strp-email-customizer__layout {
    direction: rtl;
}

[dir="rtl"] .strp-email-customizer__panel {
    border-right: none;
    border-left: 1px solid #ddd;
}

[dir="rtl"] .strp-email-customizer__tab {
    text-align: right;
}
