/* ============================================================
   Flyrix — Main Stylesheet
   ============================================================ */

:root {
    /* Landing Page Colors */
    --navy:          #0B0E1A;
    --navy-mid:      #111526;
    --navy-card:     #161B2E;
    --orange:        #FF6B35;
    --orange-dk:     #E55A25;
    --purple:        #7C3AED;
    --purple-lt:     #A78BFA;
    --cyan:          #06B6D4;

    /* Primary Colors (Updated) */
    --primary:       #FF6B35;
    --primary-dark:  #E55A25;
    --primary-light: #FFE5D9;
    --secondary:     #7C3AED;
    --success:       #059669;
    --success-light: #d1fae5;
    --warning:       #d97706;
    --warning-light: #fef3c7;
    --danger:        #dc2626;
    --danger-light:  #fee2e2;
    --info:          #06B6D4;
    --info-light:    #CFFAFE;

    /* Background Colors (Updated) */
    --bg:            #0B0E1A;
    --bg-card:       #161B2E;
    --border:        #1F2937;
    --border-light:  #374151;

    /* Text Colors (Updated) */
    --text:          #FFFFFF;
    --text_admin:    #E5E7EB;
    --text-muted:    #9CA3AF;
    --text-light:    #D1D5DB;

    --sidebar-w:     260px;
    --topbar-h:      64px;
    --radius:        10px;
    --radius-sm:     6px;
    --radius-lg:     16px;
    --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --transition:    .2s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-light);
    background: var(--navy);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-body { background: #0B0E1A; background-image: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,.35) 0%, transparent 70%), radial-gradient(ellipse 60% 50% at 80% 60%, rgba(255,107,53,.18) 0%, transparent 60%), radial-gradient(ellipse 50% 40% at 10% 80%, rgba(6,182,212,.12) 0%, transparent 60%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-wrapper { width: 100%; max-width: 440px; }
.auth-card { background: #161B2E; border: 1px solid rgba(255,255,255,.07); border-radius: var(--radius-lg); padding: 40px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-icon { width: 60px; height: 60px; background: linear-gradient(135deg, #FF6B35 0%, #7C3AED 100%); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; margin-bottom: 12px; }
.auth-logo h1 { font-size: 1.6rem; font-weight: 700; color: #FFFFFF; }
.auth-logo p { color: rgba(255,255,255,.55); font-size: .9rem; margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer { text-align: center; margin-top: 24px; color: rgba(255,255,255,.55); font-size: .9rem; }
.auth-footer a { color: #FF6B35; }
.auth-footer a:hover { color: #E55A25; }
.free-features { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }
.free-feature { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: rgba(255,255,255,.55); }
.free-feature i { color: #FF6B35; font-size: .8rem; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-body { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy-mid);
    color: #E5E7EB;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    overflow-y: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-icon { width: 36px; height: 36px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.brand-name { font-size: 1.1rem; font-weight: 700; color: #fff; }
.sidebar-toggle { background: none; border: none; color: #c7d2fe; cursor: pointer; font-size: 16px; padding: 4px; }

.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-section { margin-bottom: 8px; }
.nav-label { display: block; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--orange); padding: 8px 10px 4px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: #D1D5DB; font-size: .875rem; font-weight: 500;
    text-decoration: none; transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active { background: linear-gradient(135deg, var(--orange) 0%, var(--purple) 100%); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: .9rem; }

.sidebar-plan { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.plan-badge { background: rgba(255,255,255,.08); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
.plan-name { font-size: .8rem; font-weight: 600; color: #c7d2fe; }
.plan-upgrade { font-size: .75rem; background: var(--warning); color: #fff; padding: 3px 8px; border-radius: 4px; text-decoration: none; font-weight: 600; }
.plan-upgrade:hover { background: #b45309; text-decoration: none; }

/* Main wrapper */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: var(--topbar-h);
    background: var(--navy-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-toggle { display: none; background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); }
.breadcrumb-nav { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.bc-link { color: var(--text-muted); }
.bc-sep { color: var(--text-light); }
.bc-current { color: var(--text); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 6px; border-radius: var(--radius-sm); transition: all var(--transition); }
.topbar-btn:hover { background: var(--bg); color: var(--text); }

/* User menu */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; font-size: .875rem; color: var(--text); transition: all var(--transition); }
.user-btn:hover { background: var(--bg); }
.user-avatar { width: 28px; height: 28px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: .7rem; font-weight: 700; }
.user-name { font-weight: 500; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); min-width: 180px; box-shadow: var(--shadow-lg); display: none; z-index: 200; }
.user-dropdown.open { display: block; }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--text); font-size: .875rem; text-decoration: none; transition: background var(--transition); }
.user-dropdown a:hover { background: rgba(255,107,53,.1); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Page content */
.page-content { flex: 1; padding: 28px 24px; max-width: 1400px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 20px; font-size: .875rem; font-weight: 500; border-left: 4px solid; margin: 0 24px; }
.alert-success { background: var(--success-light); border-color: var(--success); color: #065f46; }
.alert-error   { background: var(--danger-light);  border-color: var(--danger);  color: #991b1b; }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: #075985; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all var(--transition);
    text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary); color: var(--text-light); border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline  { background: #fff; color: black; border-color: var(--border); }
.btn-outline:hover  { background: var(--primary-dark); color: white;}
.btn-ghost    { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover    { background: var(--bg); color: var(--text); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover   { background: #b91c1c; }
.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover  { background: #047857; }
.btn-warning  { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover  { background: #b45309; }
.btn-sm { padding: 6px 12px; font-size: .8rem; border: 1px solid gray; color: var(--text-muted); background: transparent;}
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; }

/* Icon buttons */
.btn-icon { background: none; border: 1px solid var(--border); color: var(--text-muted); padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: .8rem; transition: all var(--transition); }
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon-danger { color: var(--danger); }
.btn-icon-danger:hover { background: var(--danger-light); border-color: var(--danger); }
.btn-icon-success { color: var(--success); }
.btn-icon-success:hover { background: var(--success-light); border-color: var(--success); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-light); display: flex; /*justify-content: space-between;*/ align-items: center; }
.label-link { font-weight: 400; color: var(--primary); font-size: .8rem; }
.form-control {
    padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .875rem; color: var(--text-light); background: var(--navy-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    background: var(--navy-mid);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,.2); }
.form-control:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .85rem; pointer-events: none; }
.input-icon .form-control { padding-left: 36px; }
.form-check { flex-direction: row; align-items: center; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--text-muted); cursor: pointer; }
.required { color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 80px; }
.rich-editor { font-family: monospace; font-size: .85rem; }
.code-editor { font-family: 'Courier New', monospace; font-size: .8rem; background: var(--navy-mid); color: #E5E7EB; border-color: var(--border); }
.code-editor:focus { border-color: var(--primary); }

/* ============================================================
   CARDS
   ============================================================ */
.card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }

/* ============================================================
   STATS
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-blue   { background: rgba(6,182,212,.15); color: #06B6D4; }
.stat-purple { background: rgba(124,58,237,.15); color: #A78BFA; }
.stat-green  { background: rgba(5,150,105,.15); color: #10B981; }
.stat-orange { background: rgba(255,107,53,.15); color: #FF6B35; }
.stat-pink   { background: rgba(236,72,153,.15); color: #F472B6; }
.stat-teal   { background: rgba(13,148,136,.15); color: #14B8A6; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-limit { font-size: .75rem; color: var(--text-light); }
.stat-progress { background: var(--border-light); border-radius: 4px; height: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .5s ease; }
.progress-purple { background: var(--secondary); }
.progress-orange { background: var(--warning); }

.stat-card-sm { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.stat-icon-sm { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.stat-value-sm { font-size: 1.4rem; font-weight: 700; }
.stat-label-sm { font-size: .78rem; color: var(--text-muted); }

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 12px; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 20px; background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: .8rem; font-weight: 600; transition: all var(--transition); min-width: 90px; }
.quick-action:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.qa-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.qa-purple { background: rgba(124,58,237,.15); color: #A78BFA; }
.qa-blue   { background: rgba(6,182,212,.15); color: #06B6D4; }
.qa-orange { background: rgba(255,107,53,.15); color: #FF6B35; }
.qa-green  { background: rgba(5,150,105,.15); color: #10B981; }
.qa-pink   { background: rgba(236,72,153,.15); color: #F472B6; }
.qa-teal   { background: rgba(13,148,136,.15); color: #14B8A6; }
.tab-btn {     background: var(--primary-dark); padding: 5px; border-radius: var(--radius-sm); color: var(--text-light);}
/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.dash-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dash-card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dash-card-header h3 { font-size: .95rem; font-weight: 600; }
.dash-card-link { font-size: .8rem; color: var(--primary); }

.contact-list { padding: 8px 0; }
.contact-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; transition: background var(--transition); }
.contact-item:hover { background: rgba(255,107,53,.05); }
.contact-avatar { width: 36px; height: 36px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.contact-avatar.sm { width: 32px; height: 32px; font-size: .7rem; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-email { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-status { font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.status-subscribed { background: var(--success-light); color: var(--success); }
.status-unsubscribed { background: var(--danger-light); color: var(--danger); }
.status-bounced { background: var(--warning-light); color: var(--warning); }

.funnel-stats { padding: 8px 0; }
.funnel-stat-item { padding: 10px 20px; border-bottom: 1px solid var(--border-light); }
.funnel-stat-item:last-child { border-bottom: none; }
.funnel-stat-name { font-size: .875rem; font-weight: 500; margin-bottom: 4px; }
.funnel-stat-nums { font-size: .78rem; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.sep { color: var(--text-light); }
.conv-rate { background: var(--success-light); color: var(--success); padding: 1px 6px; border-radius: 10px; font-weight: 600; }

/* ============================================================
   UPGRADE BANNER
   ============================================================ */
.upgrade-banner { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, var(--orange), var(--purple)); color: #fff; border-radius: var(--radius); padding: 20px 24px; }
.upgrade-banner-icon { font-size: 28px; flex-shrink: 0; }
.upgrade-banner-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.upgrade-banner-text strong { font-size: 1rem; }
.upgrade-banner-text span { font-size: .85rem; opacity: .85; }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th { background: var(--navy-mid); padding: 10px 16px; text-align: left; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,107,53,.05); }
.fw-medium { font-weight: 500; }
.text-sm { font-size: .8rem; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--success); }
.action-btns { display: flex; gap: 6px; align-items: center; }
.contact-cell { display: flex; align-items: center; gap: 10px; }
.product-cell { display: flex; align-items: center; gap: 10px; }
.product-icon { width: 36px; height: 36px; background: var(--navy-mid); border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-active, .badge-published, .badge-approved { background: var(--success-light); color: var(--success); }
.badge-draft, .badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-archived, .badge-rejected, .badge-cancelled { background: var(--danger-light); color: var(--danger); }
.badge-sent { background: var(--info-light); color: var(--info); }
.badge-subscribed { background: var(--success-light); color: var(--success); }
.badge-unsubscribed { background: var(--danger-light); color: var(--danger); }
.badge-bounced { background: var(--warning-light); color: var(--warning); }
.badge-paid { background: var(--success-light); color: var(--success); }
.badge-type { background: rgba(255,107,53,.15); color: var(--orange); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .85rem; }
.search-box .form-control { padding-left: 36px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 16px; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; color: var(--text-muted); text-decoration: none; transition: all var(--transition); }
.page-btn:hover { background: rgba(255,107,53,.1); color: var(--text); text-decoration: none; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   MODALS
   ============================================================ */
.modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.modal-box { position: relative; background: var(--navy-card); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn .2s ease; }
.modal-lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 18px; padding: 4px; border-radius: var(--radius-sm); transition: all var(--transition); }
.modal-close:hover { background: rgba(255,107,53,.1); color: var(--text); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-icon { font-size: 48px; color: var(--text-light); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; font-size: .9rem; }
.empty-state-sm { text-align: center; padding: 32px 24px; color: var(--text-muted); font-size: .875rem; }
.empty-state-sm i { font-size: 28px; display: block; margin-bottom: 10px; color: var(--text-light); }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { background: none; border: none; padding: 10px 20px; font-size: .875rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   FUNNELS
   ============================================================ */
.limit-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.limit-bar-label { font-size: .85rem; font-weight: 500; white-space: nowrap; }
.limit-bar-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.limit-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .5s; }

.funnel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.funnel-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow var(--transition); }
.funnel-card:hover { box-shadow: var(--shadow-md); }
.funnel-card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0; }
.funnel-card-icon { width: 40px; height: 40px; background: rgba(255,107,53,.15); color: var(--orange); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.funnel-card-body { padding: 12px 16px; }
.funnel-card-name { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.funnel-card-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; }
.funnel-card-stats { display: flex; gap: 16px; }
.funnel-stat { display: flex; flex-direction: column; }
.funnel-stat-val { font-size: 1.1rem; font-weight: 700; }
.funnel-stat-lbl { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.funnel-card-footer { padding: 12px 16px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; align-items: center; }

/* Funnel builder */
.funnel-builder { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.funnel-pipeline { display: flex; flex-direction: column; align-items: center; gap: 0; }
.funnel-arrow { color: var(--text-light); font-size: 20px; padding: 4px 0; }
.funnel-step-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; width: 100%; /*max-width: 500px;*/ display: flex; align-items: center; gap: 16px; transition: box-shadow var(--transition); }
.funnel-step-card:hover { box-shadow: var(--shadow-md); }
.step-type-badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
.step-optin    { background: rgba(6,182,212,.15); color: #06B6D4; }
.step-sales    { background: rgba(5,150,105,.15); color: #10B981; }
.step-upsell   { background: rgba(255,107,53,.15); color: #FF6B35; }
.step-downsell { background: rgba(236,72,153,.15); color: #F472B6; }
.step-thankyou { background: rgba(124,58,237,.15); color: #A78BFA; }
.step-custom   { background: var(--navy-mid); color: var(--text-muted); }
.step-info { flex: 1; }
.step-name { font-weight: 600; font-size: .9rem; color: var(--text-light);}
.step-slug { font-size: .75rem; color: var(--text-muted); font-family: monospace; }
.step-stats { display: flex; gap: 12px; font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.step-actions { display: flex; gap: 6px; }

.funnel-editor-panel { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; position: sticky; top: 80px; }
.editor-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.editor-panel-header h3 { font-size: .95rem; font-weight: 600; }
.editor-form { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.editor-actions { padding-top: 8px; }

/* Step type grid */
.step-type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.step-type-option input { display: none; }
.step-type-card { border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; cursor: pointer; transition: all var(--transition); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-type-card i { font-size: 20px; color: var(--primary); }
.step-type-card span { font-size: .8rem; font-weight: 600; }
.step-type-card small { font-size: .7rem; color: var(--text-muted); }
.step-type-option input:checked + .step-type-card { border-color: var(--primary); background: rgba(255,107,53,.15); }

/* ============================================================
   COURSES
   ============================================================ */
.course-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.course-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow var(--transition); }
.course-card:hover { box-shadow: var(--shadow-md); }
.course-card-thumb { height: 140px; background: rgba(255,107,53,.15); position: relative; overflow: hidden; }
.course-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--orange); }
.course-card-status { position: absolute; top: 10px; right: 10px; font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.course-card-body { padding: 16px; }
.course-card-title { font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.course-card-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: 10px; }
.course-card-meta { display: flex; gap: 12px; font-size: .78rem; color: var(--text-muted); flex-wrap: wrap; }
.course-card-footer { padding: 12px 16px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; align-items: center; }

/* Course builder */
.course-builder { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.course-curriculum { display: flex; flex-direction: column; gap: 12px; }
.curriculum-section { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.curriculum-section-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--navy-mid); border-bottom: 1px solid var(--border); }
.section-drag { color: var(--text-light); cursor: grab; }
.section-title-text { flex: 1; font-weight: 600; font-size: .9rem; }
.section-actions { display: flex; gap: 6px; }
.curriculum-lessons { padding: 8px 0; }
.curriculum-lesson { display: flex; align-items: center; gap: 10px; padding: 8px 16px; transition: background var(--transition); }
.curriculum-lesson:hover { background: rgba(255,107,53,.05); }
.lesson-drag { color: var(--text-light); cursor: grab; font-size: .8rem; }
.lesson-icon { color: var(--text-muted); font-size: .85rem; }
.lesson-title { flex: 1; font-size: .875rem; }
.lesson-actions { display: flex; gap: 6px; }
.no-lessons { padding: 12px 16px; font-size: .8rem; color: var(--text-muted); font-style: italic; }

.course-settings-panel { position: sticky; top: 80px; }
.settings-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: .875rem; }
.setting-row:last-child { border-bottom: none; }
.setting-label { color: var(--text-muted); font-weight: 500; }

/* ============================================================
   BLOG
   ============================================================ */
.blog-header-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.blog-header-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 12px; min-width: 280px; flex: 1; }
.blog-header-icon { width: 40px; height: 40px; background: rgba(255,107,53,.15); color: var(--orange); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.blog-header-info { flex: 1; }
.blog-header-name { font-weight: 600; }
.blog-header-meta { font-size: .8rem; color: var(--text-muted); }
.blog-header-actions { display: flex; gap: 6px; }

.post-editor { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.post-editor-form { display: contents; }
.post-editor-main { display: flex; flex-direction: column; gap: 16px; }
.post-title-input { font-size: 1.4rem; font-weight: 700; border: none; border-bottom: 2px solid var(--border); border-radius: 0; padding: 8px 0; width: 100%; }
.post-title-input:focus { outline: none; border-bottom-color: var(--primary); box-shadow: none; }
.post-editor-sidebar { position: sticky; top: 80px; }
.editor-sidebar-card { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.editor-sidebar-card h4 { font-size: .875rem; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

/* ============================================================
   AUTOMATIONS
   ============================================================ */
.automation-list { padding: 8px 0; }
.automation-item { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
.automation-item:last-child { border-bottom: none; }
.automation-item:hover { background: var(--bg); }
.automation-icon { width: 36px; height: 36px; background: #fef3c7; color: var(--warning); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.automation-info { flex: 1; }
.automation-name { font-weight: 600; font-size: .9rem; }
.automation-trigger { font-size: .8rem; color: var(--text-muted); }
.automation-status { display: flex; align-items: center; gap: 8px; }
.toggle-btn { width: 40px; height: 22px; background: var(--border); border-radius: 11px; border: none; cursor: pointer; position: relative; transition: background var(--transition); }
.toggle-btn.active { background: var(--success); }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-btn.active .toggle-knob { transform: translateX(18px); }

/* ============================================================
   AFFILIATES
   ============================================================ */
.affiliate-overview { margin-bottom: 20px; }
.affiliate-program-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.program-header { display: flex; align-items: center; gap: 16px; }
.program-icon { width: 48px; height: 48px; background: var(--primary-light); color: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.program-info { flex: 1; }
.program-info h3 { font-size: 1.05rem; font-weight: 700; }
.program-info p { font-size: .85rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.settings-nav { background: var(--navy-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: sticky; top: 80px; }
.settings-nav-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text-muted); font-size: .875rem; font-weight: 500; text-decoration: none; border-left: 3px solid transparent; transition: all var(--transition); }
.settings-nav-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.settings-nav-item.active { color: var(--primary); background: var(--primary-light); border-left-color: var(--primary); }
.settings-content { display: flex; flex-direction: column; gap: 20px; }
.settings-tab { display: none; }
.settings-tab.active { display: block; }

.profile-avatar-section { display: flex; align-items: center; gap: 16px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.profile-avatar-large { width: 64px; height: 64px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; flex-shrink: 0; }

.current-plan-badge { display: flex; align-items: center; gap: 16px; background: var(--primary-light); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; }
.plan-badge-icon { width: 44px; height: 44px; background: var(--primary); color: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.plan-badge-name { font-size: 1rem; font-weight: 700; color: var(--primary); }
.plan-badge-desc { font-size: .8rem; color: var(--text-muted); }

.plan-limits { margin-bottom: 24px; }
.plan-limits h4 { font-size: .875rem; font-weight: 700; margin-bottom: 12px; }
.usage-item { margin-bottom: 12px; }
.usage-label { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 4px; }
.usage-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.usage-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .5s; }
.usage-warning { background: var(--warning); }
.usage-danger { background: var(--danger); }

.upgrade-plans h4 { font-size: .875rem; font-weight: 700; margin-bottom: 12px; }
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.plan-card-featured { border-color: var(--primary); background: var(--primary-light); }
.plan-card-name { font-size: .9rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.plan-card-price { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.plan-card-price span { font-size: .9rem; font-weight: 400; color: var(--text-muted); }
.plan-card-features { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.plan-card-features li { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-muted); }
.plan-card-features li i { color: var(--success); font-size: .75rem; }

/* ============================================================
   INSTALLER
   ============================================================ */
.install-body { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.install-card { background: #fff; border-radius: var(--radius-lg); padding: 40px; max-width: 560px; width: 100%; box-shadow: var(--shadow-lg); }
.install-header { text-align: center; margin-bottom: 32px; }
.install-steps { display: flex; gap: 0; margin-bottom: 32px; }
.install-step { flex: 1; text-align: center; position: relative; }
.install-step::after { content: ''; position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.install-step:last-child::after { display: none; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--border); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; position: relative; z-index: 1; margin-bottom: 6px; }
.install-step.active .step-num { background: var(--primary); color: #fff; }
.install-step.done .step-num { background: var(--success); color: #fff; }
.step-label { font-size: .72rem; color: var(--text-muted); }

/* ============================================================
   404
   ============================================================ */
.page-404 { text-align: center; padding: 80px 24px; }
.page-404 h1 { font-size: 5rem; font-weight: 900; color: var(--primary); }
.page-404 h2 { font-size: 1.5rem; margin-bottom: 12px; }
.page-404 p { color: var(--text-muted); margin-bottom: 24px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .funnel-builder { grid-template-columns: 1fr; }
    .course-builder { grid-template-columns: 1fr; }
    .post-editor { grid-template-columns: 1fr; }
    .settings-layout { grid-template-columns: 1fr; }
    .plan-cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-260px); width: 260px; }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .topbar-toggle { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid-4 { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .funnel-cards, .course-cards { grid-template-columns: 1fr; }
    .quick-actions { gap: 8px; }
    .quick-action { min-width: 80px; padding: 12px; }
    .upgrade-banner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; }
    .modal-box { margin: 10px; }
}

/* ============================================================
   COLLAPSIBLE SIDEBAR
   ============================================================ */
:root {
    --sidebar-collapsed-w: 70px;
}

.sidebar {
    transition: width var(--transition), transform var(--transition);
}

.main-wrapper {
    transition: margin-left var(--transition);
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-w);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed-w);
}

body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .plan-badge,
body.sidebar-collapsed .sidebar-plan {
    display: none;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

body.sidebar-collapsed .nav-item i {
    margin: 0;
    font-size: 1.2rem;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 20px 0;
}

body.sidebar-collapsed .brand-link {
    justify-content: center;
}


/* ============================================================
   AUTH PAGES — Dark theme overrides for form elements
   (Matches the landing page color scheme)
   ============================================================ */
.auth-body .form-label { color: rgba(255,255,255,.75); }
.auth-body .label-link { color: #FF6B35; }
.auth-body .label-link:hover { color: #E55A25; }
.auth-body .form-control {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.12);
    color: #FFFFFF;
}
.auth-body .form-control::placeholder { color: rgba(255,255,255,.35); }
.auth-body .form-control:focus {
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255,107,53,.15);
}
.auth-body .input-icon i { color: rgba(255,255,255,.4); }
.auth-body .check-label { color: rgba(255,255,255,.55); }
.auth-body .btn-primary {
    background: #FF6B35;
    border-color: #FF6B35;
    color: #fff;
}
.auth-body .btn-primary:hover {
    background: #E55A25;
    border-color: #E55A25;
}
.auth-body .alert { margin: 0; border-radius: var(--radius-sm); }
.auth-body .alert-error { background: rgba(220,38,38,.15); border-color: #dc2626; color: #fca5a5; }
.auth-body .alert-success { background: rgba(5,150,105,.15); border-color: #059669; color: #6ee7b7; }
.auth-body .alert-info { background: rgba(2,132,199,.15); border-color: #0284c7; color: #7dd3fc; }
