/* Dashboard v2 Styles - NEON CYBER Theme */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Neon Cyber - Dark futuristic theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161f;
    --bg-hover: #1f1f2e;
    --border: #2a2a3a;
    --border-glow: rgba(168, 85, 247, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #c4b5fd;
    --text-tertiary: #a78bfa;
    --text-muted: #7c7c9a;
    
    /* Neon accent colors */
    --accent-primary: #a855f7;
    --accent-secondary: #06b6d4;
    --accent-tertiary: #ec4899;
    --accent-green: #22d3ee;
    --accent-blue: #818cf8;
    --accent-purple: #a855f7;
    --accent-orange: #f97316;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #06b6d4 0%, #a855f7 50%, #ec4899 100%);
    --gradient-accent: linear-gradient(90deg, #06b6d4, #a855f7);
    --gradient-glow: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(168, 85, 247, 0.2));
    
    /* Glow effects */
    --glow-purple: 0 0 20px rgba(168, 85, 247, 0.4);
    --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.4);
    --glow-pink: 0 0 20px rgba(236, 72, 153, 0.4);
    
    --sidebar-width: 200px;
    --danger-color: #f43f5e;
    --success-color: #22d3ee;
}

[data-theme="light"] {
    --bg-primary: #faf5ff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3e8ff;
    --bg-card: #ffffff;
    --bg-hover: #ede9fe;
    --border: #e9d5ff;
    --border-glow: rgba(168, 85, 247, 0.3);
    --text-primary: #1e1b4b;
    --text-secondary: #5b21b6;
    --text-tertiary: #7c3aed;
    --text-muted: #8b5cf6;
    --accent-primary: #7c3aed;
    --accent-secondary: #0891b2;
    --gradient-primary: linear-gradient(135deg, #0891b2 0%, #7c3aed 50%, #db2777 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
}

[data-theme="dark"] .sidebar {
    border-right-color: rgba(96, 165, 250, 0.2);
}

.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: rgba(96, 165, 250, 0.2);
}

.sidebar-logo {
    font-size: 16px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: var(--glow-purple);
}

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

.nav-section { margin-bottom: 16px; }

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 10px;
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .nav-item:hover {
    background: rgba(96, 165, 250, 0.1);
}

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

.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

[data-theme="dark"] .sidebar-footer {
    border-top-color: rgba(96, 165, 250, 0.2);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.user-menu:hover { background: var(--bg-card); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 12px;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text-muted); }

/* Main Content Area */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-theme="dark"] .header {
    border-bottom-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.1);
}

[data-theme="light"] .header { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

.header-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }

.mobile-menu-btn {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
}

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

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

[data-theme="light"] .theme-toggle { background: #f6f8fa; border-color: #d0d7de; }
.theme-toggle:hover { background: var(--bg-secondary); border-color: var(--accent-blue); transform: scale(1.05); }
[data-theme="light"] .theme-toggle:hover { background: #e7f3ff; }
.theme-toggle:active { transform: scale(0.95); }

.live-indicator { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent-green); }
.live-dot { width: 8px; height: 8px; background: var(--accent-green); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.date-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.date-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

[data-theme="light"] .date-btn { background: #f6f8fa; }
.date-btn:hover, .date-btn.active { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }
[data-theme="dark"] .date-btn { border-color: rgba(96, 165, 250, 0.3); }
[data-theme="dark"] .date-btn:hover:not(.active) { border-color: var(--accent-blue); background: rgba(96, 165, 250, 0.1); }
[data-theme="light"] .date-btn:hover:not(.active) { background: #e7f3ff; color: var(--accent-blue); border-color: var(--accent-blue); }

/* Main Layout */
.container { max-width: 1600px; margin: 0 auto; padding: 24px; width: 100%; box-sizing: border-box; }

/* Hero Metrics - auto-fit for fluid responsive */
.hero-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }

.hero-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="dark"] .hero-card { border-color: rgba(96, 165, 250, 0.2); }
[data-theme="dark"] .hero-card:hover { border-color: rgba(96, 165, 250, 0.4); box-shadow: 0 4px 12px rgba(96, 165, 250, 0.15); }
[data-theme="light"] .hero-card { box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04); }

.hero-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.hero-card.revenue::before { background: linear-gradient(90deg, var(--accent-green), #00ff88); }
.hero-card.conversions::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink)); }
.hero-card.visitors::before { background: linear-gradient(90deg, var(--accent-blue), #00d4ff); }
.hero-card.rate::before { background: linear-gradient(90deg, var(--accent-orange), #ffaa00); }

.hero-label { font-size: 13px; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; font-weight: 600; }
.hero-value { font-size: 36px; font-weight: 700; margin-bottom: 8px; }
.hero-card.revenue .hero-value { color: var(--accent-green); }
.hero-card.conversions .hero-value { color: var(--accent-purple); }
.hero-card.visitors .hero-value { color: var(--accent-blue); }
.hero-card.rate .hero-value { color: var(--accent-orange); }
.hero-sub { font-size: 13px; color: var(--text-secondary); }

/* Conversion Breakdown - auto-fit for fluid responsive */
.conversion-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }

.conv-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

[data-theme="dark"] .conv-card { border-color: rgba(96, 165, 250, 0.2); }
[data-theme="dark"] .conv-card:hover { border-color: rgba(96, 165, 250, 0.4); box-shadow: 0 2px 8px rgba(96, 165, 250, 0.15); }
[data-theme="light"] .conv-card { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

.conv-icon { font-size: 24px; }
.conv-info { flex: 1; }
.conv-label { font-size: 12px; color: var(--text-primary); font-weight: 500; }
.conv-value { font-size: 24px; font-weight: 600; color: var(--text-primary); }
.conv-qualified { font-size: 11px; color: var(--accent-green); font-weight: 500; margin-top: 2px; }
.conv-qualified:empty { display: none; }

/* Gradient Cards */
.conv-card.fb-spend { background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%); border-color: #3b82f6; }
[data-theme="light"] .conv-card.fb-spend { background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); border-color: #90caf9; }
.conv-card.pl-profit { background: linear-gradient(135deg, #166534 0%, #14532d 100%); border-color: #22c55e; }
[data-theme="light"] .conv-card.pl-profit { background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); border-color: #81c784; }
.conv-card.pl-loss { background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%); border-color: #ef4444; }
[data-theme="light"] .conv-card.pl-loss { background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%); border-color: #ef5350; }
.conv-card.roi { background: linear-gradient(135deg, #6b21a8 0%, #581c87 100%); border-color: #a855f7; }
[data-theme="light"] .conv-card.roi { background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); border-color: #ba68c8; }

/* Main Grid */
.main-grid { display: grid; grid-template-columns: 1fr 400px; gap: 24px; }

/* Panels */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="dark"] .panel { border-color: rgba(96, 165, 250, 0.2); }
[data-theme="light"] .panel { box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04); }

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

[data-theme="dark"] .panel-header { border-bottom-color: rgba(96, 165, 250, 0.2); }
.panel-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.panel-body { padding: 16px 20px; max-height: 400px; overflow-y: auto; }

/* Activity Feed */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .activity-item { border-bottom-color: rgba(96, 165, 250, 0.15); }
[data-theme="dark"] .activity-item:hover { background: rgba(96, 165, 250, 0.05); margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
[data-theme="light"] .activity-item { border-bottom-color: #e1e4e8; }
.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-icon.conversion { background: rgba(139, 92, 246, 0.2); }
.activity-icon.visitor { background: rgba(0, 168, 255, 0.2); }
.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; color: var(--text-primary); }
.activity-meta { font-size: 12px; color: var(--text-muted); }
.activity-value { font-size: 14px; font-weight: 600; color: var(--accent-green); }
.activity-time { font-size: 11px; color: var(--text-secondary); }

/* Country Table */
.country-table { width: 100%; font-size: 13px; }
.country-table th { text-align: left; padding: 8px 0; color: var(--text-primary); font-weight: 600; border-bottom: 1px solid var(--border); }
.country-table th:last-child, .country-table td:last-child { text-align: right; }
.country-table td { padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.country-table tr:last-child td { border-bottom: none; }
.country-flag { margin-right: 6px; }
.country-revenue { color: var(--accent-green); font-weight: 600; }

/* Loading */
.loading { color: var(--text-muted); font-size: 13px; padding: 20px; text-align: center; }

/* Responsive - auto-fit handles grid columns, just adjust gaps/padding */

@media (max-width: 1200px) {
    .main-grid { grid-template-columns: 1fr; }
    :root { --sidebar-width: 180px; }
    .sidebar-logo { font-size: 14px; }
    .nav-item { font-size: 12px; padding: 7px 8px; }
    .nav-item svg { width: 14px; height: 14px; }
}

@media (max-width: 1024px) {
    :root { --sidebar-width: 60px; }
    .sidebar-logo span { display: none; }
    .sidebar-logo::before { content: '📊'; font-size: 20px; }
    .nav-section-title { display: none; }
    .nav-item span { display: none; }
    .nav-item { justify-content: center; padding: 10px; }
    .nav-item svg { width: 18px; height: 18px; }
    .user-info { display: none; }
    .user-menu { justify-content: center; }
    .sidebar-footer { padding: 8px; }
    .container { padding: 16px; }
}

@media (max-width: 768px) {
    .sidebar { 
        transform: translateX(-100%); 
        position: fixed;
        width: 220px;
        z-index: 1000;
        transition: transform 0.2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar.open ~ .sidebar-overlay { display: block; }
    .main-area { margin-left: 0; }
    .hero-metrics { gap: 12px; }
    .conversion-grid { gap: 8px; }
    .header { padding: 12px 16px; }
    .container { padding: 12px; }
    .hero-card { padding: 16px; }
    .hero-value { font-size: 28px; }
    .conv-card { padding: 12px; }
    .conv-value { font-size: 20px; }
}

@media (max-width: 600px) {
    .date-filter { display: none; }
    .header-left .page-title { font-size: 16px; }
    .hero-value { font-size: 24px; }
    .panel-body { padding: 12px; }
}

/* Notification Toast */
.notification-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.notification { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); animation: slideIn 0.4s ease-out, fadeOut 0.4s ease-in 5.6s forwards; cursor: pointer; }
.notification:hover { transform: scale(1.02); border-color: var(--accent-blue); }
.notification-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.notification-icon { font-size: 24px; }
.notification-type { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.notification-type.purchase { color: #10b981; }
.notification-type.lead { color: #3b82f6; }
.notification-type.survey { color: #f59e0b; }
.notification-type.appointment { color: #8b5cf6; }
.notification-name { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.notification-email { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.notification-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.notification-value { color: var(--accent-green); font-weight: 600; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Profile Modal */
.profile-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.profile-modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 900px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; animation: modalSlideIn 0.3s ease-out; }
@keyframes modalSlideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.profile-modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px; border-bottom: 1px solid var(--border); }
.profile-header-info h2 { margin: 0 0 8px 0; font-size: 24px; color: var(--text-primary); }
.profile-header-info .email { color: var(--text-muted); font-size: 14px; }
.profile-header-badges { display: flex; gap: 8px; margin-top: 12px; }
.profile-badge { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.profile-badge.purchase { background: rgba(16,185,129,0.2); color: #10b981; }
.profile-badge.lead { background: rgba(59,130,246,0.2); color: #3b82f6; }
.profile-badge.survey { background: rgba(245,158,11,0.2); color: #f59e0b; }
.profile-badge.appointment { background: rgba(139,92,246,0.2); color: #8b5cf6; }
.qual-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; margin-left: 6px; }
.qual-badge.highly-qualified { background: rgba(16,185,129,0.2); color: #10b981; }
.qual-badge.partially-qualified { background: rgba(245,158,11,0.2); color: #f59e0b; }
.qual-badge.unqualified { background: rgba(239,68,68,0.2); color: #ef4444; }
.profile-modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 28px; cursor: pointer; padding: 0; line-height: 1; }
.profile-modal-close:hover { color: var(--text-primary); }
.profile-modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.profile-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.profile-stat { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.profile-stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.profile-stat-value.revenue { color: var(--accent-green); }
.profile-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.profile-section { margin-bottom: 24px; }
.profile-section-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.profile-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.profile-info-item { background: var(--bg-secondary); border-radius: 8px; padding: 12px; }
.profile-info-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.profile-info-value { font-size: 14px; color: var(--text-primary); }
.timeline-container { max-height: 300px; overflow-y: auto; }
.timeline-event { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-left: 2px solid var(--border); margin-left: 8px; }
.timeline-event:first-child { padding-top: 0; }
.timeline-event:last-child { border-left-color: transparent; }
.timeline-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: -22px; background: var(--bg-primary); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-title { font-size: 14px; color: var(--text-primary); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; bottom: 100%; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-bottom: 8px; display: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--text-primary); font-size: 13px; border-radius: 6px; cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.dropdown-item:hover { background: var(--bg-secondary); }
.dropdown-item.danger { color: #ef4444; }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); }
