/*
 * RayyanMailHub Pro — Frontend CSS
 * UPDATED: Added rich HTML editor styles and attachment button styles
 */

/* ─── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html.rmh-html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.rmh-login-body,
body.rmh-dashboard-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #2d3748;
    background: #f7fafc;
}

/* Completely hide admin bar — belt-and-braces via CSS too */
#wpadminbar,
#wp-admin-bar-root-default,
.admin-bar #wpadminbar { display: none !important; }
html.admin-bar { margin-top: 0 !important; padding-top: 0 !important; }
body.admin-bar { margin-top: 0 !important; }

/* ─── Shared utilities ─────────────────────────────────────────────────────── */
.rmh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.rmh-btn:focus-visible { outline: 3px solid #4299e1; outline-offset: 2px; }
.rmh-btn-primary   { background: #3b82f6; color: #fff; }
.rmh-btn-primary:hover { background: #2563eb; }
.rmh-btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.rmh-btn-secondary { background: transparent; color: #3b82f6; border-color: #3b82f6; }
.rmh-btn-secondary:hover { background: #eff6ff; }
.rmh-btn-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.rmh-btn-danger:hover { background: #fee2e2; }
.rmh-btn-full { width: 100%; justify-content: center; }
.rmh-btn-sm { padding: 7px 14px; font-size: 0.82rem; }

.rmh-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}
.rmh-alert svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; }
.rmh-alert-error   { background: #fff5f5; border: 1px solid #fed7d7; color: #c53030; }
.rmh-alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.rmh-alert-success { background: #f0fff4; border: 1px solid #9ae6b4; color: #276749; }
.rmh-alert-lg { padding: 16px 20px; margin-bottom: 24px; }
.rmh-alert-lg strong { display: block; margin-bottom: 4px; }

.rmh-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.rmh-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.07); }
.rmh-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.rmh-card-header h2 { font-size: 1rem; font-weight: 600; color: #1a202c; }
.rmh-card-body { padding: 20px; }

.rmh-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.rmh-badge--green { background: #c6f6d5; color: #22543d; }
.rmh-badge--red   { background: #fed7d7; color: #9b2c2c; }
.rmh-badge--blue  { background: #bee3f8; color: #2b6cb0; }
.rmh-badge--yellow { background: #fefcbf; color: #744210; }
.rmh-badge--grey  { background: #e2e8f0; color: #4a5568; }

/* ─── Form elements ────────────────────────────────────────────────────────── */
.rmh-field { margin-bottom: 16px; }
.rmh-field:last-child { margin-bottom: 0; }
.rmh-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}
.rmh-input {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2d3748;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.rmh-input:focus { border-color: #4299e1; box-shadow: 0 0 0 3px rgba(66,153,225,0.2); outline: none; }
.rmh-input:disabled { background: #f7fafc; color: #718096; cursor: not-allowed; }
.rmh-field-note { font-size: 0.8rem; color: #718096; margin-top: 4px; }
.rmh-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rmh-field-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.rmh-field-row--checkboxes {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}
.rmh-required { color: #e53e3e; margin-left: 2px; }

.rmh-checkbox-label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 0.875rem; }
.rmh-checkbox { width: 16px; height: 16px; accent-color: #3b82f6; cursor: pointer; }

/* ─── Textarea ──────────────────────────────────────────────────────────────── */
.rmh-textarea {
    resize: vertical;
    min-height: 180px;
    font-family: inherit;
    line-height: 1.6;
}

/* ─── Loading spinner ──────────────────────────────────────────────────────── */
.rmh-loading {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
    font-size: 0.9rem;
}
.rmh-loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: rmh-spin 0.7s linear infinite;
    margin: 0 auto 12px;
}
.rmh-spin-icon {
    width: 16px;
    height: 16px;
    animation: rmh-spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes rmh-spin { to { transform: rotate(360deg); } }

/* ─── Server clock ────────────────────────────────────────────────────────── */
#rmh-server-clock {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

/* ─── Attachment area ──────────────────────────────────────────────────────── */
#rmh-attachment-area {
    transition: all 0.3s ease;
    cursor: pointer;
}
#rmh-attachment-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}
#rmh-attachment-area.dragover {
    border-color: #48bb78;
    background: #f0fff4;
    transform: scale(1.01);
}

/* ─── Attachment list ──────────────────────────────────────────────────────── */
#rmh-attachment-list ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
#rmh-attachment-list li {
    animation: rmh-slide-in 0.3s ease;
}
@keyframes rmh-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.rmh-btn-remove-attachment:hover {
    background: #e53e3e !important;
}

/* ─── Distribution preview / stat cards ────────────────────────────────────── */
#rmh-preview-text {
    font-size: 13px;
    color: #4a5568;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 6px;
    display: inline-block;
    min-width: 200px;
}

.rmh-stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}
.rmh-stat-card-mini {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 18px;
    border-radius: 10px;
    text-align: center;
    color: white;
}
.rmh-stat-card-mini .value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}
.rmh-stat-card-mini .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
    margin-top: 6px;
}
.rmh-stat-card-mini--green {
    background: linear-gradient(135deg, #48bb78 0%, #276749 100%);
}
.rmh-stat-card-mini--orange {
    background: linear-gradient(135deg, #ed8936 0%, #c05621 100%);
}

/* ─── Day-of-week selector ──────────────────────────────────────────────────── */
.rmh-days-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.rmh-day-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.rmh-day-toggle input { display: none; }
.rmh-day-toggle span {
    display: inline-block;
    padding: 5px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #718096;
    background: #f7fafc;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
}
.rmh-day-toggle input:checked + span {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.rmh-day-toggle:hover span { border-color: #4299e1; }

/* ─── Day quick actions ────────────────────────────────────────────────────── */
.rmh-day-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.rmh-day-actions .rmh-btn-sm {
    font-size: 11px;
    padding: 4px 10px;
}

/* ─── Selected days summary ────────────────────────────────────────────────── */
.rmh-selected-days-summary {
    margin-top: 12px;
    background: #e9f2f9;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.rmh-selected-days-summary strong {
    color: #2c5282;
}
.rmh-selected-days-summary .days-text {
    color: #3182ce;
    font-weight: 500;
}
.rmh-selected-days-summary .days-count {
    margin-left: auto;
    background: #3182ce;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* ─── Shortcode / placeholder toolbar ──────────────────────────────────────── */
.rmh-shortcode-toolbar {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.rmh-shortcode-toolbar .label {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    white-space: nowrap;
}
.rmh-shortcode-btn {
    font-family: monospace;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #bee3f8;
    background: #ebf8ff;
    color: #2b6cb0;
    cursor: pointer;
    transition: all 0.2s ease;
}
.rmh-shortcode-btn:hover {
    background: #bee3f8;
    transform: translateY(-1px);
}
.rmh-shortcode-btn--email {
    background: #f0fff4;
    border-color: #c6f6d5;
    color: #276749;
}
.rmh-shortcode-btn--message {
    background: #faf5ff;
    border-color: #e9d8fd;
    color: #553c9a;
}
.rmh-shortcode-btn--unsubscribe {
    background: #fff5f5;
    border-color: #fed7d7;
    color: #c53030;
}

/* ─── Rich HTML Editor (TinyMCE) styles ────────────────────────────────────── */
.rmh-textarea.mce-edit-area {
    border-radius: 8px;
}

.tox .tox-toolbar__group {
    padding: 0 4px;
}
.tox .tox-tbtn {
    height: 30px;
    width: 30px;
}
.tox .tox-toolbar-overlord,
.tox .tox-toolbar__primary {
    background: #f7fafc;
    border-radius: 8px 8px 0 0;
}
.tox .tox-edit-area__iframe {
    background: white;
}
.tox .tox-editor-header {
    border-bottom: 1px solid #e2e8f0;
}

/* ─── Logs sub-tabs ─────────────────────────────────────────────────────────── */
.rmh-logs-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.rmh-logs-tab-btn {
    padding: 8px 18px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #718096;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.rmh-logs-tab-btn:hover { border-color: #4299e1; color: #2b6cb0; }
.rmh-logs-tab-btn--active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* ─── Table styles ──────────────────────────────────────────────────────────── */
.rmh-table-wrap { overflow-x: auto; }
.rmh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.rmh-table th, .rmh-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.rmh-table th { font-weight: 600; color: #4a5568; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; background: #f7fafc; }
.rmh-table tr:last-child td { border-bottom: none; }
.rmh-table tr:hover td { background: #f7fafc; }
.rmh-table-empty { text-align: center; padding: 40px 20px; color: #718096; }
.rmh-table tr.rmh-row-dirty td { background: #fffbeb; }
.rmh-table tr.rmh-row-dirty .rmh-input { border-color: #ed8936; }
#rmh-unsaved-count {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 1px 8px;
    margin-left: 4px;
    font-size: 0.72rem;
}
.rmh-text-red { color: #c53030; font-size: 0.82rem; }
/* Wrapper element (not the <td> itself) carries the width constraint —
   max-width on a table cell is unreliable in table-layout:auto, but an
   inline-block child respects it, so long SMTP error messages reliably
   wrap onto multiple lines within their own column instead of overflowing
   into the Date & Time / Actions columns next to them. */
.rmh-error-text {
    display: inline-block;
    max-width: 260px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: middle;
    line-height: 1.4;
}

/* ─── Real-time progress stats ─────────────────────────────────────────────── */
#rmh-real-time-stats {
    background: linear-gradient(135deg, rgba(59,130,246,0.05) 0%, rgba(118,75,162,0.05) 100%);
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}
#rmh-real-time-stats .stat-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}
#rmh-real-time-stats .stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
#rmh-real-time-stats .stat-label {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#rmh-real-time-stats .stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

/* ─── Campaign progress section ────────────────────────────────────────────── */
#rmh-campaign-progress {
    animation: rmh-fade-in 0.5s ease;
}
@keyframes rmh-fade-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

#rmh-schedule-summary {
    animation: rmh-fade-in 0.3s ease;
}

/* ═══════════════════════════════════════════════════════ LOGIN PAGE ═════════ */

.rmh-login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

.rmh-login-brand {
    text-align: center;
    margin-bottom: 32px;
    color: #fff;
}
.rmh-login-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.12);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    backdrop-filter: blur(8px);
}
.rmh-login-icon svg { width: 28px; height: 28px; color: #fff; }
.rmh-login-brand-name { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.3px; }
.rmh-login-brand-tagline { font-size: 0.85rem; color: rgba(255,255,255,0.65); margin-top: 4px; }

.rmh-login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.rmh-login-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 24px;
    text-align: center;
}

.rmh-login-form .rmh-field { margin-bottom: 18px; }

.rmh-password-wrap { position: relative; }
.rmh-password-wrap .rmh-input { padding-right: 42px; }
.rmh-pwd-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: #a0aec0;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s;
}
.rmh-pwd-toggle:hover { color: #4a5568; }
.rmh-pwd-toggle svg { width: 18px; height: 18px; }

.rmh-remember {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.rmh-forgot-link { font-size: 0.85rem; color: #3b82f6; text-decoration: none; }
.rmh-forgot-link:hover { text-decoration: underline; }
.rmh-link { color: #3b82f6; text-decoration: none; }
.rmh-link:hover { text-decoration: underline; }

.rmh-login-footer {
    margin-top: 28px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
}

/* ═══════════════════════════════════════════════════════ DASHBOARD ══════════ */

.rmh-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.rmh-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #1a202c;
    color: #cbd5e0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}

.rmh-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.rmh-sidebar-icon {
    width: 36px;
    height: 36px;
    background: #3b82f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rmh-sidebar-icon svg { width: 18px; height: 18px; color: #fff; }
.rmh-sidebar-brand-name { font-size: 0.9rem; font-weight: 700; color: #fff; }

.rmh-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.rmh-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4299e1, #667eea);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rmh-sidebar-user-name { font-size: 0.85rem; font-weight: 600; color: #e2e8f0; line-height: 1.3; }
.rmh-sidebar-user-plan { font-size: 0.75rem; color: #718096; }

.rmh-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rmh-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #a0aec0;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.rmh-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.rmh-nav-item:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
.rmh-nav-item--active { background: rgba(59,130,246,0.2); color: #63b3ed; }
.rmh-nav-item--active:hover { background: rgba(59,130,246,0.25); }
.rmh-nav-item--logout { color: #fc8181; }
.rmh-nav-item--logout:hover { background: rgba(252,129,129,0.1); }

.rmh-sidebar-footer { padding: 8px; border-top: 1px solid rgba(255,255,255,0.08); }

/* ─── Main area ────────────────────────────────────────────────────────────── */
.rmh-main {
    margin-left: 240px;
    flex: 1;
    padding: 0;
    min-width: 0;
}

.rmh-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.rmh-topbar-title { font-size: 1rem; font-weight: 600; color: #1a202c; flex: 1; }
.rmh-topbar-right { display: flex; align-items: center; gap: 12px; }

.rmh-hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}
.rmh-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #4a5568;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.rmh-notifications { padding: 0 24px; }
.rmh-notifications:empty { display: none; }

/* Plan card */
.rmh-plan-card {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    background: linear-gradient(135deg, #2b6cb0 0%, #4299e1 100%);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 24px 0;
    color: #fff;
}
.rmh-plan-card-col { display: flex; flex-direction: column; }
.rmh-plan-card-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; }
.rmh-plan-card-name  { font-size: 1.75rem; font-weight: 700; margin-top: 4px; }
.rmh-plan-card-desc  { font-size: 0.875rem; opacity: 0.85; margin-top: 4px; }
.rmh-plan-card-value {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 4px;
}
.rmh-plan-card-value--warn { color: #fefcbf; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* Stat grid */
.rmh-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    padding: 24px 24px 0;
}
.rmh-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.2s;
}
.rmh-stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.rmh-stat-icon svg { width: 30px; height: 30px; }
.rmh-stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.rmh-stat-label { font-size: 0.75rem; color: #718096; margin-top: 2px; }

/* Cards within main */
.rmh-main .rmh-card { margin: 24px; }

/* Progress / quota */
.rmh-quota-pct { font-size: 1rem; font-weight: 700; }
.rmh-progress-track { height: 14px; background: #e2e8f0; border-radius: 8px; overflow: hidden; }
.rmh-progress-bar   { height: 14px; border-radius: 8px; transition: width 0.5s ease; }
.rmh-progress-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: #718096; margin-top: 8px; }

/* Quick actions */
.rmh-quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Settings grid */
.rmh-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: 24px;
}
.rmh-settings-grid .rmh-card { margin: 0 12px 24px; }
.rmh-settings-grid .rmh-card:first-child { margin-left: 0; }
.rmh-settings-grid .rmh-card:last-child  { margin-right: 0; }

/* ─── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .rmh-settings-grid { grid-template-columns: 1fr; }
    .rmh-settings-grid .rmh-card { margin: 0 0 24px; }
    .rmh-stat-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .rmh-sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    .rmh-sidebar.rmh-sidebar--open { transform: translateX(0); }
    .rmh-main { margin-left: 0; }
    .rmh-hamburger { display: flex; }

    .rmh-plan-card { margin: 16px 16px 0; padding: 18px; grid-template-columns: 1fr 1fr; }
    .rmh-stat-grid { padding: 16px 16px 0; gap: 12px; }
    .rmh-main .rmh-card { margin: 16px; }
    .rmh-topbar { padding: 12px 16px; }
    .rmh-notifications { padding: 0 16px; }
    .rmh-settings-grid { margin: 0 16px; }
    .rmh-field-row { grid-template-columns: 1fr 1fr; }
    .rmh-logs-tabs { padding: 0 16px; }
    .rmh-days-selector { gap: 6px; }
    .rmh-stat-cards { grid-template-columns: 1fr; }
    .rmh-shortcode-toolbar .label { display: none; }
}

@media (max-width: 480px) {
    .rmh-plan-card { grid-template-columns: 1fr; }
    .rmh-field-row { grid-template-columns: 1fr; }
}

/* Sidebar overlay (mobile) */
.rmh-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}
.rmh-sidebar-overlay.rmh-sidebar-overlay--visible { display: block; }
/* ══════════════════════════════════════════════════════════════════════
   Campaign History — Dashboard Summary cards
══════════════════════════════════════════════════════════════════════ */
.rmh-history-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.rmh-history-summary-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #cbd5e0;
    border-radius: 10px;
    padding: 16px 18px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.rmh-history-summary-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.rmh-history-summary-card--wide {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left-color: #4299e1;
    background: linear-gradient(135deg, #ebf8ff 0%, #ffffff 100%);
}
.rmh-history-summary-card--action {
    cursor: pointer;
    border: 2px dashed #3b82f6;
    border-left: 2px dashed #3b82f6;
    background: #eff6ff;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.rmh-history-summary-card--action:hover {
    background: #dbeafe;
    transform: translateY(-1px);
}
/* Semantic accent colors so each metric is scannable at a glance */
#rmh-history-total-campaigns { color: #2b6cb0; }
.rmh-history-summary-grid .rmh-history-summary-card:nth-child(2) { border-left-color: #4299e1; }
#rmh-history-active-campaigns { color: #276749; }
.rmh-history-summary-grid .rmh-history-summary-card:nth-child(3) { border-left-color: #48bb78; }
#rmh-history-total-pending { color: #b7791f; }
.rmh-history-summary-grid .rmh-history-summary-card:nth-child(4) { border-left-color: #ecc94b; }
#rmh-history-today-pending { color: #c05621; }
.rmh-history-summary-grid .rmh-history-summary-card:nth-child(5) { border-left-color: #ed8936; }

.rmh-history-summary-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #718096;
    margin-bottom: 8px;
}
.rmh-history-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
}
@media (max-width: 600px) {
    .rmh-history-summary-card--wide { grid-column: span 1; }
    .rmh-history-summary-value { font-size: 1.25rem; }
}

/* Campaign History tab — consistent vertical rhythm between sections */
.rmh-main .rmh-card + .rmh-card { margin-top: 0; }
.rmh-history-summary-card--action .rmh-history-summary-label { color: #2b6cb0; }

/* ══════════════════════════════════════════════════════════════════════
   Campaign History — mini progress bar inside the campaigns table
══════════════════════════════════════════════════════════════════════ */
.rmh-progress-mini-track {
    width: 90px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.rmh-progress-mini-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #4299e1);
    border-radius: 3px;
}
.rmh-progress-mini-label {
    font-size: 0.7rem;
    color: #718096;
    margin-left: 6px;
}

/* ══════════════════════════════════════════════════════════════════════
   Pending Emails — toolbar / pagination
══════════════════════════════════════════════════════════════════════ */
.rmh-pending-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.rmh-pending-info { font-size: 0.82rem; color: #718096; }
.rmh-pending-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #4a5568;
}

/* ══════════════════════════════════════════════════════════════════════
   Modal (View HTML Message / Attachments)
══════════════════════════════════════════════════════════════════════ */
.rmh-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.rmh-modal.rmh-modal--open { display: flex; }
.rmh-modal-box {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    animation: rmhModalIn 0.18s ease;
}
.rmh-modal-wide { max-width: 760px; }
@keyframes rmhModalIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
.rmh-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #edf2f7;
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
}
.rmh-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #a0aec0;
    cursor: pointer;
    padding: 0 4px;
}
.rmh-modal-close:hover { color: #e53e3e; }
.rmh-modal-body { padding: 18px 20px; font-size: 0.875rem; color: #2d3748; }
.rmh-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #edf2f7;
}
.rmh-message-subject {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf2f7;
}
.rmh-html-preview {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    background: #f7fafc;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
}
/* Message View: plain text keeps the author's exact line breaks, spacing
   and paragraph separation; HTML messages keep their native structure. */
.rmh-message-content {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
}
.rmh-message-content-plain {
    white-space: pre-wrap;
    tab-size: 4;
}
.rmh-message-content-html {
    white-space: normal;
}
.rmh-message-content-html p {
    margin: 0 0 1em;
}
.rmh-message-content-html p:last-child {
    margin-bottom: 0;
}
.rmh-message-content-html pre {
    white-space: pre-wrap;
    tab-size: 4;
    overflow-wrap: anywhere;
}
.rmh-message-content-html blockquote {
    margin: 1em 0;
}
.rmh-html-preview img,
.rmh-html-preview svg {
    max-width: 100%;
    max-height: 320px;
    width: auto;
    height: auto;
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
}
/* Emails composed elsewhere sometimes carry oversized width/height
   attributes on <img> (e.g. a decorative icon saved at its native,
   uncompressed size). Attribute-based sizing beats our CSS max-width
   unless we explicitly override it, so pin every dimension back to
   "auto" and let the max-width/max-height rules above do the scaling. */
.rmh-html-preview img[width],
.rmh-html-preview img[height] {
    width: auto !important;
    height: auto !important;
}
/* ── Emoji size fix ────────────────────────────────────────────────────────
   WordPress Twemoji replaces unicode emoji with <img class="emoji"> at
   72×72 px. Constrain them to inline text size everywhere on the dashboard,
   including table cells (history / logs) and the message-preview modal.
   !important is required because Twemoji inlines width/height attributes.
   ──────────────────────────────────────────────────────────────────────── */
img.emoji {
    width: 1em !important;
    height: 1em !important;
    max-width: 1em !important;
    max-height: 1em !important;
    vertical-align: -0.1em;
    display: inline;
    object-fit: contain;
}
/* Inside the HTML preview modal the font-size is 0.85rem, so 1em resolves
   correctly to the preview's own text size. */
.rmh-html-preview img.emoji {
    width: 1em !important;
    height: 1em !important;
    max-width: 1em !important;
    max-height: 1em !important;
}
.rmh-attachment-view-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.rmh-attachment-view-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.82rem;
}
.rmh-attachment-view-list li:last-child { border-bottom: none; }
.rmh-attachment-view-list a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
}
.rmh-attachment-view-list a:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .rmh-modal-box { max-width: 100%; }
}

/* ══════════════════════════════════════════════════════════════════════
   Campaign History — improved table layout & button polish
══════════════════════════════════════════════════════════════════════ */

/* Give the history/logs tables a cleaner, slightly roomier look */
#rmh-history-container .rmh-table td,
#rmh-history-container .rmh-table th {
    vertical-align: middle;
}

/* Action buttons in the campaigns table should sit tightly in a row */
#rmh-history-container .rmh-table td:last-child {
    white-space: nowrap;
}
#rmh-history-container .rmh-table td:last-child .rmh-btn {
    margin-right: 4px;
}
#rmh-history-container .rmh-table td:last-child .rmh-btn:last-child {
    margin-right: 0;
}

/* "processing" badge — pulse animation so actively-running campaigns stand out */
.rmh-badge--blue {
    animation: rmh-pulse-blue 2s ease-in-out infinite;
}
@keyframes rmh-pulse-blue {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* Sent/Failed column: green for sent, red for any failure */
.rmh-sent-count  { color: #22863a; font-weight: 600; }
.rmh-failed-count--none { color: #a0aec0; }
.rmh-failed-count--some { color: #dc2626; font-weight: 600; }

/* Logs table — Date & Time column (5th) should not line-wrap. Column 4 is
   Status (Sent Logs) or Error (Failed Logs) — those must NOT be forced to
   a single line: a long SMTP error message with nowrap has nowhere to go
   but overflow straight through the Date & Time and Actions columns next
   to it, exactly the visual overlap this used to cause. */
#rmh-logs-container .rmh-table td:nth-child(5) {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Pending Emails table — Scheduled Time column no wrap */
#rmh-pending-container .rmh-table td:last-child {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Clock in history summary — larger and monospace so it reads clearly */
#rmh-history-clock {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

/* (wide summary card accent now defined in the Dashboard Summary block above) */

/* Make the "No campaigns found" empty-state link more prominent */
.rmh-table-empty a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
}
.rmh-table-empty a:hover { text-decoration: underline; }

/* Logs tab-switcher pill styling */
.rmh-logs-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    width: fit-content;
}
.rmh-logs-tab-btn {
    background: #f7fafc;
    border: none;
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.rmh-logs-tab-btn + .rmh-logs-tab-btn {
    border-left: 1px solid #e2e8f0;
}
.rmh-logs-tab-btn--active {
    background: #3b82f6;
    color: #fff;
}
.rmh-logs-tab-btn:hover:not(.rmh-logs-tab-btn--active) {
    background: #edf2f7;
    color: #2d3748;
}
