/* ══════════════════════
   EMAIL SYSTEM STYLES
══════════════════════ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --bg2: #111111;
    --bg3: #161616;
    --bg4: #1e1e1e;
    --accent: #c8f65d;
    --red: #ff4d4d;
    --blue: #4d9fff;
    --orange: #ff8c42;
    --purple: #a855f7;
    --green: #22c55e;
    --text: #ffffff;
    --text2: #888888;
    --text3: #444444;
    --border: #222222;
    --border2: #2a2a2a;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ══════════════════════
   NAVBAR
══════════════════════ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 10, 10, 0.97);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 500;
}

.nav-logo {
    font-family: 'Bebas Neue', cursive;
    font-size: 28px;
    letter-spacing: 3px;
    color: var(--text);
}

.nav-logo span {
    color: var(--accent);
}

.nav-tabs {
    display: flex;
    gap: 4px;
}

.nav-tab {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text3);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    font-family: 'Space Grotesk', sans-serif;
}

.nav-tab:hover {
    color: var(--text2);
    background: var(--bg3);
}

.nav-tab.active {
    color: var(--accent);
    background: rgba(200, 246, 93, 0.08);
}

/* ══════════════════════
   LAYOUT
══════════════════════ */
.page {
    padding-top: 64px;
    min-height: 100vh;
    display: none;
}

.page.show {
    display: block;
}

.page-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 40px 32px;
}

/* ══════════════════════
   PAGE HEADER
══════════════════════ */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-family: 'Bebas Neue', cursive;
    font-size: 48px;
    letter-spacing: 4px;
    line-height: 1;
}

.page-header h1 span {
    color: var(--accent);
}

.page-header p {
    font-size: 13px;
    color: var(--text2);
    margin-top: 6px;
}

/* ══════════════════════
   CARDS
══════════════════════ */
.card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.card-title {
    font-family: 'Bebas Neue', cursive;
    font-size: 16px;
    letter-spacing: 2px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--accent);
}

/* ══════════════════════
   STATS ROW
══════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    position: relative;
    overflow: hidden;
    cursor: default;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--border2);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--c, var(--accent));
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 10px;
}

.stat-value {
    font-family: 'Bebas Neue', cursive;
    font-size: 34px;
    letter-spacing: 2px;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-sub {
    font-size: 11px;
    color: var(--text2);
}

/* ══════════════════════
   FLOW LIST
══════════════════════ */
.flows-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 28px;
}

.flow-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.flow-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--flow-color, var(--accent));
    opacity: 0;
    transition: opacity 0.2s;
}

.flow-card:hover {
    border-color: var(--border2);
}

.flow-card:hover::before {
    opacity: 1;
}

.flow-card.active-flow::before {
    opacity: 1;
}

.flow-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.flow-info {
    flex: 1;
}

.flow-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.flow-desc {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.5;
}

.flow-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text3);
    margin-top: 6px;
}

.flow-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.flow-sent {
    font-family: 'Bebas Neue', cursive;
    font-size: 26px;
    letter-spacing: 1px;
    color: var(--text);
}

.flow-rate {
    font-size: 12px;
    font-weight: 700;
}

.rate-good {
    color: var(--green);
}

.rate-mid {
    color: var(--orange);
}

.rate-low {
    color: var(--red);
}

/* Flow toggle */
.toggle {
    width: 44px;
    height: 24px;
    background: var(--border2);
    border-radius: 24px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.toggle.on {
    background: var(--accent);
}

.toggle::after {
    content: '';
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: left 0.2s;
}

.toggle.on::after {
    left: 23px;
}

/* ══════════════════════
   BUILDER
══════════════════════ */
.builder-layout {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 20px;
    height: calc(100vh - 180px);
}

.builder-sidebar,
.builder-canvas,
.builder-settings {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.builder-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Bebas Neue', cursive;
    letter-spacing: 2px;
    color: var(--text2);
}

.template-list {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

.template-item {
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
}

.template-item:hover {
    background: var(--bg4);
}

.template-item.active {
    background: rgba(200, 246, 93, 0.1);
    border: 1px solid rgba(200, 246, 93, 0.2);
}

.template-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.template-type {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
}

/* Canvas */
.canvas-toolbar {
    padding: 12px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.canvas-toolbar-btn {
    padding: 8px 16px;
    border-radius: 10px;
    background: var(--bg4);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.canvas-toolbar-btn i {
    color: var(--accent);
}

.device-toggle {
    margin-left: auto;
    display: flex;
    background: var(--bg);
    padding: 4px;
    border-radius: 10px;
}

.device-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-btn.active {
    background: var(--bg3);
    color: var(--accent);
}

.email-preview-wrap {
    flex: 1;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.email-frame {
    width: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: fit-content;
    overflow: hidden;
}

.email-frame.mobile {
    width: 375px;
}

/* Settings */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.settings-tab {
    flex: 1;
    padding: 14px;
    background: none;
    border: none;
    color: var(--text3);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.settings-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.settings-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.setting-group {
    margin-bottom: 24px;
}

.setting-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text3);
    margin-bottom: 8px;
}

.setting-input,
.setting-select,
.setting-textarea {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    outline: none;
}

.setting-textarea {
    resize: vertical;
    min-height: 100px;
}

.var-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.var-chip {
    padding: 4px 10px;
    background: rgba(200, 246, 93, 0.1);
    border: 1px solid rgba(200, 246, 93, 0.2);
    border-radius: 8px;
    font-size: 11px;
    color: var(--accent);
    cursor: pointer;
    font-family: monospace;
}

.color-row {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-swatch.selected {
    border-color: white;
}

/* ══════════════════════
   ANALYTICS
══════════════════════ */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 200px;
    margin-top: 20px;
    padding-bottom: 20px;
}

.chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: var(--accent);
    border-radius: 6px 6px 0 0;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-label {
    font-size: 10px;
    color: var(--text3);
    font-weight: 700;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text2);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

.filter-btn.active-filter {
    background: var(--accent);
    color: black;
    border-color: var(--accent);
}

/* Table */
.perf-table,
.sub-table {
    width: 100%;
    border-collapse: collapse;
}

.perf-table th,
.sub-table th {
    text-align: left;
    padding: 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text3);
    border-bottom: 1px solid var(--border);
}

.perf-table td,
.sub-table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.seg-btn {
    padding: 8px 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text2);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.seg-btn.active-seg {
    background: var(--accent);
    color: black;
    border-color: var(--accent);
}

/* Subscriber Tags */
.sub-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.tag-active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
}

.tag-vip {
    background: rgba(200, 246, 93, 0.1);
    color: var(--accent);
}

/* ══════════════════════
   MODAL & TOAST
══════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 24px;
    width: 500px;
    padding: 32px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-family: 'Bebas Neue', cursive;
    font-size: 28px;
    letter-spacing: 2px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text2);
    cursor: pointer;
}

.toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ══════════════════════
   UTILITIES
══════════════════════ */
.btn-new-flow {
    padding: 9px 18px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #000;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-new-flow:hover {
    background: #a8d94a;
}

.flex-gap-10 {
    display: flex;
    gap: 10px;
}

.flex-gap-8 {
    display: flex;
    gap: 8px;
}

.flex-column-gap-14 {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.flex-1 {
    flex: 1;
}

.mb-20 {
    margin-bottom: 20px;
}

.pb-0 {
    padding-bottom: 0;
}

.color-accent {
    color: var(--accent);
}

.color-blue {
    color: var(--blue);
}

.color-purple {
    color: var(--purple);
}

.color-green {
    color: var(--green);
}

.color-orange {
    color: var(--orange);
}

.color-red {
    color: var(--red);
}

.stat-c-accent {
    --c: var(--accent);
}

.stat-c-blue {
    --c: var(--blue);
}

.stat-c-purple {
    --c: var(--purple);
}

.stat-c-green {
    --c: var(--green);
}

.stat-c-orange {
    --c: var(--orange);
}

.stat-c-red {
    --c: var(--red);
}

.btn-broadcast {
    padding: 10px 20px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 10px;
    color: var(--text2);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-broadcast:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.hide {
    display: none;
}

.bg-c8f65d {
    background: #c8f65d;
}

.bg-4d9fff {
    background: #4d9fff;
}

.bg-ff4d4d {
    background: #ff4d4d;
}

.sub-search-input {
    margin-left: auto;
    padding: 8px 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    outline: none;
    min-width: 220px;
}

.max-w-800 {
    max-width: 800px;
}

.provider-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.provider-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
}

.provider-card.selected-provider {
    border: 2px solid var(--accent);
    background: rgba(200, 246, 93, 0.04);
}

.provider-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.provider-sub {
    font-size: 12px;
    color: var(--text2);
}

.global-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: var(--bg4);
    border-radius: 10px;
}

.global-toggle-row.mb-10 {
    margin-bottom: 10px;
}

.toggle-title {
    font-size: 14px;
    font-weight: 600;
}

.toggle-sub {
    font-size: 12px;
    color: var(--text2);
}

.sub-filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toast {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-left: 4px solid var(--accent);
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ══════════════════════
   EMAIL TEMPLATE PREVIEW STYLES
══════════════════════ */
.email-header-bar {
    background: #000;
    padding: 20px 32px;
    text-align: center;
}

.email-logo {
    font-family: 'Bebas Neue', cursive;
    font-size: 28px;
    letter-spacing: 4px;
    color: white;
}

.email-logo span {
    color: #c8f65d;
}

.email-body-content {
    padding: 48px 32px;
    text-align: center;
    color: #111;
}

.email-headline {
    font-family: 'Bebas Neue', cursive;
    font-size: 42px;
    margin-bottom: 16px;
    color: #000;
}

.email-text {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 32px;
}

.email-button {
    display: inline-block;
    padding: 16px 40px;
    background: #000;
    color: #c8f65d;
    text-decoration: none;
    font-family: 'Bebas Neue', cursive;
    font-size: 20px;
    border-radius: 12px;
}

.email-footer-bar {
    padding: 32px;
    background: #f8f8f8;
    text-align: center;
    color: #888;
    font-size: 12px;
    line-height: 1.6;
}

.email-product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0 32px 32px;
}

.product-item {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.product-img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 10px;
}

.product-name {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 4px;
    color: #000;
}

.product-price {
    font-family: 'Bebas Neue', cursive;
    font-size: 18px;
    color: #000;
}