/* ─── LEAD EMAIL SERIES STYLES ──────────────────────────────────────────── */

/* Layout: sidebar | main | preview */
.le-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 80px);
}

.le-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--border, #e2e8f0);
    padding: 20px;
    overflow-y: auto;
    background: var(--bg, #f7f8fa);
}
.le-sidebar h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted, #718096);
    margin: 0 0 12px;
}

.le-main {
    flex: 1 1 0;
    min-width: 0;
    padding: 20px;
    overflow-y: auto;
}

.le-preview {
    flex: 1 1 0;
    min-width: 0;
    border-left: 1px solid var(--border, #e2e8f0);
    background: #fafbfc;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Series list */
.le-series-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.le-series-card {
    padding: 10px 12px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s;
}
.le-series-card:hover { border-color: #a0aec0; }
.le-series-card.active {
    border-color: #303030;
    box-shadow: 0 0 0 1px #303030;
}

.le-series-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.le-series-stats {
    margin-top: 4px;
    font-size: 12px;
    display: flex;
    gap: 8px;
}
.le-stat-sent { color: #22c55e; }
.le-stat-queued { color: #1a73e8; }
.le-stat-paused { color: #d97706; }

/* Detail header */
.le-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.le-detail-header h2 { margin: 0 0 2px; font-size: 20px; }
.le-detail-actions { display: flex; gap: 8px; align-items: center; }

/* Test mode toggle */
.le-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted, #718096);
}
.le-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.le-toggle-label { user-select: none; }

/* Tabs */
.le-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border, #e2e8f0);
    margin-bottom: 16px;
}
.le-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: var(--muted, #718096);
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.le-tab:hover { color: #303030; }
.le-tab.active {
    color: #303030;
    border-bottom-color: #303030;
    font-weight: 600;
}

/* Email list */
.le-email-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.le-email-row {
    padding: 12px 14px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    transition: all 0.15s;
}
.le-email-row:hover { border-color: #a0aec0; }
.le-email-row.selected {
    border-color: #303030;
    box-shadow: 0 0 0 1px #303030;
}

.le-email-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.le-email-seq {
    font-weight: 600;
    font-size: 13px;
}

.le-email-subject {
    font-size: 14px;
    line-height: 1.4;
}

.le-email-date {
    margin-left: auto;
    font-size: 12px;
}

.le-email-row-actions {
    margin-top: 4px;
}

/* Badges */
.le-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.le-badge-queued { background: #e8f0fe; color: #1a73e8; }
.le-badge-sent { background: #f0fdf4; color: #16a34a; }
.le-badge-paused { background: #fef3c7; color: #d97706; }
.le-badge-cancelled { background: #f3f4f6; color: #6b7280; }
.le-badge-failed { background: #fee2e2; color: #dc2626; }

/* Preview panel */
.le-preview-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.le-preview-header h3 { margin: 0; font-size: 14px; font-weight: 600; }

.le-preview-envelope {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: #fff;
}
.le-preview-subject {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}
.le-preview-preheader {
    font-size: 13px;
    color: var(--muted, #718096);
}

.le-preview-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.le-preview-body p {
    margin: 0 0 12px;
}
.le-preview-body blockquote {
    border-left: 3px solid #cbd5e0;
    padding: 8px 14px;
    margin: 12px 0;
    color: #4a5568;
    font-size: 13px;
}
.le-preview-stat {
    background: #f0f4ff;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    color: #1a73e8;
    text-align: center;
    margin: 12px 0;
}
.le-preview-cta {
    font-weight: 600;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border, #e2e8f0);
}

/* Markdown preview (deck/analysis tabs) */
.le-markdown-preview {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', monospace;
}

/* Empty state */
.le-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted, #718096);
}

/* Error text */
.le-error { color: #dc2626; font-size: 12px; margin-top: 4px; }

/* Muted helper */
.le-muted { color: var(--muted, #718096); font-size: 13px; }

/* Button overrides */
.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid var(--border, #e2e8f0);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}
.btn-sm:hover { background: #f7f8fa; }

.btn-xs {
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--border, #e2e8f0);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}
.btn-xs:hover { background: #f7f8fa; }

/* Preview header layout */
.le-preview-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Edit mode — subject inline editable */
.le-editable {
    outline: none;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    padding: 4px 8px;
    transition: border-color 0.15s;
}
.le-editable:focus { border-color: #303030; }

/* Quill editor overrides */
#editorWrap {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
#editorWrap .ql-toolbar {
    border-left: none;
    border-right: none;
    border-top: none;
    background: #fafbfc;
    flex-shrink: 0;
}
#editorWrap .ql-container {
    border: none;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
}
#editorWrap .ql-editor {
    padding: 20px;
    overflow-y: auto;
}
#editorWrap .ql-editor p {
    margin-bottom: 12px;
}
#editorWrap .ql-editor blockquote {
    border-left: 3px solid #cbd5e0;
    padding: 8px 14px;
    margin: 12px 0;
    color: #4a5568;
    font-style: italic;
}

.le-edit-textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 4px;
    outline: none;
    resize: vertical;
    box-sizing: border-box;
}
.le-edit-textarea:focus { border-color: #303030; }

.le-edit-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border, #e2e8f0);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: #fafbfc;
    z-index: 10;
}

.le-btn-save {
    background: #303030;
    color: #fff;
    border-color: #303030;
}
.le-btn-save:hover { background: #1a1a1a; }

/* Overlay / Modal */
.le-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.le-modal {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}
.le-modal h3 {
    margin: 0 0 8px;
    font-size: 18px;
}
.le-modal p {
    margin: 0 0 16px;
}
.le-modal .le-edit-textarea {
    margin-bottom: 16px;
}

.le-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Copy button */
.le-copy-btn {
    color: #303030;
    transition: all 0.15s;
}
.le-copy-btn-flash {
    color: #16a34a !important;
    border-color: #16a34a !important;
}

/* Tab toolbar (sits above content) */
.le-tab-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
    .le-preview { flex: 1; }
}
/* Sharing links */
.le-sharing-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.le-sharing-row {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.le-sharing-label {
    width: 120px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 13px;
    color: var(--text, #1a202c);
}
.le-sharing-url {
    flex: 1;
    font-family: 'Lato', monospace;
    font-size: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background: var(--bg, #f7f8fa);
    color: var(--text, #1a202c);
    cursor: pointer;
}
.le-sharing-url:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}
.le-copy-toast {
    font-size: 12px;
    color: #16a34a;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .le-layout { flex-direction: column; }
    .le-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    .le-main { max-width: 100%; }
    .le-preview { width: 100%; border-left: none; border-top: 1px solid var(--border); }
}
