/* RG Enterprises 121 Insights Dashboard - Dark Theme */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

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

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 200px;
    font-size: 0.875rem;
}

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

.header-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Main Container */
.main-container {
    display: flex;
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

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

.nav-item.active {
    background: var(--accent-blue);
    color: white;
    margin: 0 0.75rem;
    border-radius: 8px;
}

.nav-item svg {
    flex-shrink: 0;
}

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

.sidebar-footer .nav-item {
    margin-bottom: 0.5rem;
}

.version {
    display: block;
    padding: 0 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.content {
    flex: 1;
    margin-left: 240px;
    padding: 1.5rem 2rem;
    max-width: calc(100% - 240px);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

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

.page-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.business-unit-filter {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.platform-tabs {
    display: flex;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab:hover {
    color: var(--text-primary);
}

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

/* KPI Section */
.kpi-section {
    margin-bottom: 1.5rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-blue);
}

.kpi-card:nth-child(2)::before { background: var(--accent-green); }
.kpi-card:nth-child(3)::before { background: var(--accent-purple); }
.kpi-card:nth-child(4)::before { background: var(--accent-orange); }

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

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

.kpi-trend {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.kpi-trend.positive {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.kpi-trend.negative {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.kpi-target {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.chart-header {
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

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

/* Table Section */
.table-section {
    margin-bottom: 1.5rem;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.table-header {
    margin-bottom: 1rem;
}

.table-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.table-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

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

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

.performance-bar {
    width: 100px;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.performance-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
}

/* Channel Section */
.channel-section {
    margin-bottom: 1.5rem;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.channel-card.google { border-top: 3px solid #4285f4; }
.channel-card.email { border-top: 3px solid var(--accent-green); }
.channel-card.organic { border-top: 3px solid var(--accent-purple); }
.channel-card.direct { border-top: 3px solid var(--accent-cyan); }

.channel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.channel-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.channel-card.google .channel-icon { background: rgba(66, 133, 244, 0.2); color: #4285f4; }
.channel-card.email .channel-icon { background: rgba(34, 197, 94, 0.2); color: var(--accent-green); }
.channel-card.organic .channel-icon { background: rgba(168, 85, 247, 0.2); color: var(--accent-purple); }
.channel-card.direct .channel-icon { background: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); }

.channel-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.channel-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Alerts Section */
.alerts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.alerts-card, .customer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.alerts-header, .customer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.alerts-header h3, .customer-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.alerts-count {
    font-size: 0.75rem;
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

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

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 3px solid;
}

.alert-item.critical { border-color: var(--accent-red); }
.alert-item.high { border-color: var(--accent-orange); }
.alert-item.medium { border-color: var(--accent-yellow, #eab308); }

.alert-severity {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.alert-item.critical .alert-severity { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.alert-item.high .alert-severity { background: rgba(249, 115, 22, 0.2); color: var(--accent-orange); }
.alert-item.medium .alert-severity { background: rgba(234, 179, 8, 0.2); color: #eab308; }

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.alert-description {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.customer-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.customer-stat {
    text-align: center;
}

.customer-stat .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.customer-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.top-customer {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.top-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.top-name {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.25rem;
}

.top-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .channel-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-section {
        grid-template-columns: 1fr;
    }
    .alerts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .content {
        margin-left: 0;
        max-width: 100%;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .channel-grid {
        grid-template-columns: 1fr;
    }
}
