/* SMMASH Marketing Admin Panel - brand styling */
:root {
    --smmash-yellow: #ebe22b;
    --smmash-black: #212121;
    --smmash-dark: #1a1a1a;
    --smmash-gray-50: #fafafa;
    --smmash-gray-100: #f4f4f4;
    --smmash-gray-200: #e5e5e5;
    --smmash-gray-300: #d4d4d4;
    --smmash-gray-400: #a3a3a3;
    --smmash-gray-500: #737373;
    --smmash-gray-600: #525252;
    --smmash-gray-700: #404040;
    --smmash-green: #22c55e;
    --smmash-red: #ef4444;
    --smmash-blue: #3b82f6;
    --smmash-orange: #f97316;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--smmash-black);
    background: var(--smmash-gray-100);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--smmash-black); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* Layout */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--smmash-black);
    color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid #333;
}

.sidebar-brand .logo {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 1px;
    color: var(--smmash-yellow);
}

.sidebar-brand .subtitle {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #999;
    margin-top: 4px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section {
    padding: 14px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 9px 20px;
    color: #ccc;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: background 0.1s;
}

.sidebar-link:hover {
    background: rgba(235, 226, 43, 0.05);
    color: white;
}

.sidebar-link.active {
    background: rgba(235, 226, 43, 0.1);
    border-left-color: var(--smmash-yellow);
    color: var(--smmash-yellow);
    font-weight: 600;
}

.sidebar-link .icon { width: 16px; margin-right: 10px; opacity: 0.7; }
.sidebar-link.active .icon { opacity: 1; }

.sidebar-link .badge {
    margin-left: auto;
    background: #333;
    color: #ccc;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
}

.sidebar-link.active .badge { background: var(--smmash-yellow); color: var(--smmash-black); }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid #333;
    font-size: 12px;
    color: #999;
}

.sidebar-footer .user { display: flex; align-items: center; gap: 8px; }
.sidebar-footer .avatar {
    width: 28px; height: 28px; background: var(--smmash-yellow); color: var(--smmash-black);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 11px;
}

/* Main content */
.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    background: white;
    padding: 14px 32px;
    border-bottom: 1px solid var(--smmash-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .title { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.topbar .sub { color: var(--smmash-gray-500); font-size: 13px; margin-top: 2px; }

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

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: var(--smmash-yellow); color: var(--smmash-black); }
.btn-primary:hover { background: #d6cd24; }
.btn-secondary { background: var(--smmash-gray-100); color: var(--smmash-black); border: 1px solid var(--smmash-gray-200); }
.btn-secondary:hover { background: var(--smmash-gray-200); }
.btn-ghost { color: var(--smmash-gray-600); }
.btn-ghost:hover { background: var(--smmash-gray-100); }
.btn-danger { background: var(--smmash-red); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.content { padding: 24px 32px; }

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--smmash-gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title { font-size: 16px; font-weight: 700; }
.card-subtitle { font-size: 12px; color: var(--smmash-gray-500); margin-top: 2px; }
.card-body { padding: 20px; }

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

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--smmash-gray-500);
    font-weight: 600;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}

.kpi-change {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-change.up { color: var(--smmash-green); }
.kpi-change.down { color: var(--smmash-red); }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--smmash-gray-500);
    font-weight: 600;
    border-bottom: 1px solid var(--smmash-gray-200);
    background: var(--smmash-gray-50);
}

.table th.right { text-align: right; }

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--smmash-gray-100);
    font-size: 13px;
}

.table td.right { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:hover td { background: var(--smmash-gray-50); }

.table .mail { font-family: 'SF Mono', 'Monaco', monospace; font-size: 12px; }

/* Status pills */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.pill-green { background: #dcfce7; color: #15803d; }
.pill-red { background: #fee2e2; color: #b91c1c; }
.pill-yellow { background: #fef3c7; color: #92400e; }
.pill-gray { background: var(--smmash-gray-200); color: var(--smmash-gray-700); }
.pill-blue { background: #dbeafe; color: #1e40af; }
.pill-orange { background: #ffedd5; color: #c2410c; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.dot-green { background: var(--smmash-green); }
.dot-red { background: var(--smmash-red); }
.dot-yellow { background: var(--smmash-yellow); }
.dot-gray { background: var(--smmash-gray-400); }

/* Filters */
.filter-bar {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: var(--smmash-gray-50);
    border-bottom: 1px solid var(--smmash-gray-200);
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar input[type="text"], .filter-bar select {
    padding: 6px 10px;
    border: 1px solid var(--smmash-gray-200);
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.filter-bar input[type="text"] { width: 260px; }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    width: min(720px, 92vw);
    max-height: 90vh;
    overflow: auto;
}

.modal-large { width: min(960px, 95vw); }

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--smmash-gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body { padding: 20px; }

/* Forms */
.form-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; margin-bottom: 14px; align-items: start; }
.form-row label { font-size: 13px; color: var(--smmash-gray-700); padding-top: 8px; font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
    padding: 8px 10px;
    border: 1px solid var(--smmash-gray-200);
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
}
.form-row textarea { resize: vertical; min-height: 80px; font-family: inherit; }

/* Charts placeholder */
.chart {
    background: linear-gradient(180deg, rgba(235,226,43,0.05) 0%, rgba(235,226,43,0) 100%);
    border-radius: 4px;
    padding: 20px;
    height: 240px;
    position: relative;
}

.chart-bars { display: flex; align-items: flex-end; height: 200px; gap: 4px; padding-top: 10px; }
.chart-bar { flex: 1; background: var(--smmash-yellow); border-radius: 2px 2px 0 0; min-height: 4px; position: relative; }
.chart-bar:hover { background: var(--smmash-black); }
.chart-bar.dim { background: var(--smmash-gray-300); }
.chart-x-labels { display: flex; gap: 4px; font-size: 10px; color: var(--smmash-gray-500); margin-top: 6px; }
.chart-x-labels span { flex: 1; text-align: center; }

/* Sparkline */
.sparkline { display: inline-flex; align-items: flex-end; height: 24px; gap: 1px; }
.sparkline > div { width: 3px; background: var(--smmash-yellow); border-radius: 1px; min-height: 2px; }

/* Email template preview */
.tmpl-preview {
    border: 1px solid var(--smmash-gray-200);
    border-radius: 4px;
    background: white;
    height: 600px;
    overflow: auto;
}

.tmpl-list-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--smmash-gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.tmpl-list-item:hover { background: var(--smmash-gray-50); }
.tmpl-list-item.active { background: rgba(235, 226, 43, 0.1); border-left: 3px solid var(--smmash-yellow); }

/* Workflow visual */
.wf-step {
    background: white;
    border: 2px solid var(--smmash-gray-200);
    border-radius: 8px;
    padding: 14px 18px;
    min-width: 200px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.wf-step.trigger { border-color: var(--smmash-yellow); background: rgba(235,226,43,0.05); }
.wf-step.action { border-color: var(--smmash-blue); }
.wf-step.wait { border-color: var(--smmash-orange); border-style: dashed; }
.wf-step.condition { border-color: var(--smmash-gray-700); }

.wf-step-type { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--smmash-gray-500); font-weight: 700; }
.wf-step-title { font-weight: 600; margin-top: 4px; }
.wf-step-detail { color: var(--smmash-gray-500); font-size: 12px; margin-top: 4px; }

.wf-arrow { padding: 8px 0; color: var(--smmash-gray-400); display: flex; justify-content: center; }

.wf-canvas { display: flex; flex-direction: column; align-items: center; padding: 32px; background: var(--smmash-gray-50); border-radius: 8px; }

/* AI Builder */
.ai-prompt-box {
    background: var(--smmash-black);
    color: white;
    padding: 24px;
    border-radius: 8px;
}

.ai-prompt-box textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    color: white;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 12px;
    min-height: 80px;
    font-family: inherit;
    font-size: 14px;
}

.ai-prompt-box textarea::placeholder { color: #666; }

.ai-example {
    background: rgba(235,226,43,0.1);
    color: var(--smmash-yellow);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 8px;
    cursor: pointer;
}

.ai-example:hover { background: rgba(235,226,43,0.2); }

/* Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-gray { color: var(--smmash-gray-500); }
.text-green { color: var(--smmash-green); }
.text-red { color: var(--smmash-red); }
.font-bold { font-weight: 700; }
.tabular { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--smmash-gray-200); margin: 16px 0; }

[x-cloak] { display: none !important; }

/* Multi-select dropdown */
.multi-select {
    position: relative;
    min-width: 180px;
    background: white;
    border: 1px solid var(--smmash-gray-200);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 13px;
    min-height: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.multi-select-chip {
    background: var(--smmash-yellow);
    color: var(--smmash-black);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.multi-select-chip-x {
    cursor: pointer;
    color: var(--smmash-gray-700);
    font-weight: 700;
    line-height: 1;
}
.multi-select-chip-x:hover { color: var(--smmash-red); }
.multi-select-placeholder { color: var(--smmash-gray-400); padding: 2px 4px; }
.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--smmash-gray-200);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 280px;
    overflow: auto;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.multi-select-option {
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.multi-select-option:hover { background: var(--smmash-gray-100); }
.multi-select-option.selected { background: rgba(235,226,43,0.15); }
.multi-select-group-label {
    padding: 6px 10px 2px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--smmash-gray-500);
    font-weight: 700;
    background: var(--smmash-gray-50);
}
