/* ============================================
   Split Testing Panel - MedusaPay Style
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --info: #3b82f6;
    --orange: #f97316;
    --cyan: #06b6d4;
    
    /* Sidebar - Dark */
    --sidebar-bg: #0f0f1a;
    --sidebar-text: #9ca3af;
    --sidebar-text-white: #ffffff;
    --sidebar-border: #1f1f2e;
    --sidebar-hover: #1a1a2e;
    --sidebar-active: #8b5cf6;
    
    /* Main - Light */
    --bg-body: #f8f9fc;
    --bg-card: #ffffff;
    --bg-input: #f3f4f6;
    
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --text-muted: #9ca3af;
    
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    
    --sidebar-w: 240px;
    --radius: 12px;
    --radius-sm: 8px;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===================== LAYOUT ===================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===================== SIDEBAR (Dark) ===================== */

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--sidebar-text-white);
}

.sidebar-section {
    padding: 20px 20px 10px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-white);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: white;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

/* ===================== MAIN (Light) ===================== */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 24px 32px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-gray);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

/* ===================== STATS ROW ===================== */

.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
}

.stat-icon.yellow {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.1);
    color: var(--cyan);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
}

/* ===================== GRID LAYOUT ===================== */

.grid-2 {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* ===================== CARDS ===================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.card-action {
    font-size: 13px;
    color: var(--text-muted);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.card-action:hover {
    background: var(--bg-input);
    color: var(--text-dark);
}

.card-body {
    padding: 20px;
}

.card-body.no-padding {
    padding: 0;
}

/* ===================== CHART ===================== */

.chart-container {
    height: 260px;
    position: relative;
}

/* ===================== EVENTS LIST ===================== */

.events-list {
    display: flex;
    flex-direction: column;
}

.event-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.event-item:last-child {
    border-bottom: none;
}

.event-item:hover {
    background: var(--bg-input);
}

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

.event-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.event-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.event-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.event-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.event-content {
    flex: 1;
    min-width: 0;
}

.event-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.event-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===================== TABLE ===================== */

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

.table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-gray);
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr {
    transition: background 0.15s;
    cursor: pointer;
}

.table tbody tr:hover {
    background: var(--bg-input);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===================== BADGES ===================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-draft {
    background: var(--bg-input);
    color: var(--text-muted);
}

.badge-active,
.badge-pago {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-paused,
.badge-pendente {
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
}

.badge-finished {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

/* ===================== BUTTONS ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===================== FORMS ===================== */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-gray);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-dark);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

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

/* ===================== PERIOD SELECTOR ===================== */

.period-selector {
    display: flex;
    gap: 4px;
}

.period-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.period-btn:hover {
    background: var(--bg-input);
    color: var(--text-dark);
}

.period-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ===================== VARIATIONS ===================== */

.variation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.variation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.variation-card.winner {
    border-color: var(--success);
}

.variation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-light);
}

.variation-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.variation-weight {
    font-size: 12px;
    color: var(--text-muted);
}

.variation-body {
    padding: 18px;
}

/* Funnel */
.funnel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.funnel-stage {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.funnel-stage.success {
    border-left-color: var(--success);
}

.funnel-stage-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-gray);
}

.funnel-stage-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    min-width: 40px;
    text-align: right;
}

.funnel-stage-rate {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}

.funnel-arrow {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 0;
}

.variation-revenue {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.revenue-label {
    font-size: 13px;
    color: var(--text-muted);
}

.revenue-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
}

/* ===================== SIGNIFICANCE ===================== */

.significance-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 20px;
}

.significance-card.positive {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.03);
}

.significance-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.significance-icon {
    font-size: 20px;
}

.significance-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.significance-message {
    font-size: 13px;
    color: var(--text-gray);
}

/* ===================== CODE BLOCK ===================== */

.code-block {
    background: var(--sidebar-bg);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: var(--primary-light);
    overflow-x: auto;
    position: relative;
}

.code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ===================== EMPTY STATE ===================== */

.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ===================== TOAST ===================== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.2s ease;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================== UTILITIES ===================== */

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.hidden { display: none !important; }

/* ===================== RESPONSIVE ===================== */

.menu-toggle {
    display: none;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-dark);
    margin-right: 12px;
}

@media (max-width: 1280px) {
    .stats-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .variation-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
