/* Import base styles from integrations */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --purple: #5E00FF;
    --blue: #0086FF;
    --bg-primary: #F2F2F2;
    --bg-secondary: #FFFFFF;
    --bg-card: #FAFAFA;
    --text-primary: #0A0A0A;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border: #E5E5E5;
    --border-light: #F0F0F0;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --sidebar-width: 260px;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Same as integrations */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

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

.nav-item.active {
    background: linear-gradient(135deg, rgba(94, 0, 255, 0.1), rgba(0, 134, 255, 0.1));
    color: var(--purple);
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.topbar-left h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.time-filter {
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-filter:hover {
    border-color: var(--purple);
}

.time-filter:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(94, 0, 255, 0.1);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.stat-change.negative svg {
    transform: rotate(180deg);
}

/* Analytics Container */
.analytics-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* Chart Cards */
.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.chart-card.large {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.chart-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.chart-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.chart-card.large .chart-container {
    height: 350px;
}

/* Highlight Card - After Hours */
.highlight-card {
    background: linear-gradient(135deg, var(--purple), var(--blue));
    border-radius: 20px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.highlight-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.highlight-card .highlight-icon {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.highlight-card .highlight-icon svg {
    color: white;
}

.highlight-content {
    position: relative;
    z-index: 1;
}

.highlight-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.highlight-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.highlight-stat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.highlight-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.highlight-label {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.9);
}

.highlight-message {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.95);
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.highlight-message strong {
    color: white;
    font-weight: 700;
}

/* Activity Section */
.activity-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--purple);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.view-all-link:hover {
    opacity: 0.8;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: var(--border-light);
}

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

.activity-icon.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    color: var(--success);
}

.activity-icon.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
    color: #3B82F6;
}

.activity-icon.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    color: var(--warning);
}

.activity-details {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.activity-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.activity-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .analytics-container {
        grid-template-columns: 1fr;
    }

    .chart-card.large {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .topbar-left h1 {
        font-size: 1.75rem;
    }

    .topbar-right {
        width: 100%;
    }

    .time-filter {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .highlight-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .highlight-card {
        padding: 2rem 1.5rem;
    }

    .highlight-card .highlight-icon {
        width: 48px;
        height: 48px;
        top: 1.5rem;
        right: 1.5rem;
    }

    .highlight-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .highlight-value {
        font-size: 2rem;
    }

    .highlight-message {
        font-size: 1rem;
    }

    .activity-item {
        flex-wrap: wrap;
    }

    .activity-time {
        width: 100%;
        text-align: left;
        margin-top: 0.25rem;
    }
}