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

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --purple-color: #8b5cf6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: var(--bg-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.25rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.nav-text {
    flex: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    transition: margin-left 0.3s ease;
    max-width: calc(100% - var(--sidebar-width));
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
    max-width: calc(100% - var(--sidebar-collapsed-width));
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    margin-bottom: 8px;
}

.date-range {
    font-size: 1rem;
    opacity: 0.85;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Section Titles */
.section-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary-color);
}

.subsection-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* Platform Titles */
.platform-title {
    position: relative;
    padding-left: 50px;
}

.platform-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.google-ads-title::before {
    background: #4285f4;
}

.search-console-title::before {
    background: #34a853;
}

.meta-title::before {
    background: #1877f2;
}

.seo-title::before {
    background: var(--purple-color);
}

/* Metrics Section */
.metrics-section {
    margin-bottom: 30px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.metric-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tooltip */
.tooltip-trigger {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
}

.tooltip {
    position: absolute;
    background: var(--text-primary);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    max-width: 300px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: var(--shadow-lg);
}

.tooltip.visible {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-top-color: var(--text-primary);
    bottom: -12px;
    left: 20px;
}

/* Chart Sections */
.chart-section {
    margin-bottom: 40px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-container {
    position: relative;
    height: 400px;
    margin-top: 20px;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.half-width {
    height: 350px;
}

/* Accordion */
.accordion {
    margin-top: 20px;
}

.accordion-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.accordion-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.accordion-header:hover {
    background: var(--bg-color);
}

.accordion-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.accordion-icon {
    transition: transform 0.3s;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 2000px;
    padding: 20px;
}

/* Default open accordion */
.accordion-item.active .accordion-content {
    display: block;
}

/* Platform Sections */
.platform-section {
    border-left: 4px solid var(--border-color);
    padding-left: 20px;
}

.google-ads-section {
    border-left-color: #4285f4;
}

.search-console-section {
    border-left-color: #34a853;
}

.meta-section {
    border-left-color: #1877f2;
}

.seo-section {
    border-left-color: var(--purple-color);
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

/* Progress Bar */
.progress-bar-container {
    position: relative;
    width: 100%;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 12px;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    z-index: 1;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.data-table thead {
    background: var(--primary-color);
    color: white;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }

    .chart-container {
        height: 300px;
    }

    .half-width {
        height: 300px;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 30px 15px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

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

    .chart-container {
        height: 250px;
    }
}

/* Print Styles */
@media print {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
    }

    .accordion-content {
        max-height: none !important;
        display: block !important;
    }

    .accordion-header {
        cursor: default;
    }
}
