/* RG Enterprises 121insights - Matching phealth.121insights.com */

:root {
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-card: #1f2937;
    --bg-hover: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: #374151;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
}

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

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 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;
}

.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: 180px;
    font-size: 0.875rem;
}

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

.filter-select, .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;
    cursor: pointer;
}

.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);
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

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

.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;
}

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

.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;
}

/* 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;
}

.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-orange); }
.kpi-card:nth-child(4)::before { background: var(--accent-purple); }

.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(16, 185, 129, 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-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Business Unit Section */
.business-unit-section, .channel-performance, .campaign-section, .product-section {
    margin-bottom: 1.5rem;
}

.business-unit-section h3, .channel-performance h3, .campaign-header h3, .product-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.business-unit-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.business-unit-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    border-left: 4px solid;
}

.business-unit-card.xline { border-left-color: var(--accent-blue); }
.business-unit-card.grease { border-left-color: var(--accent-orange); }
.business-unit-card.safety { border-left-color: var(--accent-green); }
.business-unit-card.saws { border-left-color: var(--accent-purple); }
.business-unit-card.equipment { border-left-color: var(--accent-cyan); }
.business-unit-card.other { border-left-color: var(--text-muted); }

.business-unit-name {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.business-unit-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

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

.bu-stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

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

/* Channel Performance */
.channel-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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

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

.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-icon.google { background: rgba(66, 133, 244, 0.2); color: #4285f4; }
.channel-icon.email { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }

.channel-name {
    font-weight: 600;
    flex: 1;
}

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

.channel-stats {
    display: flex;
    justify-content: space-between;
}

.stat {
    text-align: center;
}

.stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
}

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

/* Tables */
.campaign-header, .product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.campaign-count, .product-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

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

campaign-table th, .product-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);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

campaign-table tr:last-child td, .product-table tr:last-child td {
    border-bottom: none;
}

campaign-table tr:hover, .product-table tr:hover {
    background: var(--bg-hover);
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.status-badge.paused { background: rgba(249, 115, 22, 0.2); color: var(--accent-orange); }

.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;
}

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

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