/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.header h1 {
    margin: 0;
    color: #2d3748;
    font-size: 2rem;
}

/* Filter Section */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.filter-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: #4a5568;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.view-toggle {
    display: flex;
    flex-direction: row;
    margin-left: auto;
    align-items: flex-end;
}

.toggle-button {
    padding: 0.5rem 1rem;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 0.875rem;
}

.toggle-button:first-child {
    border-radius: 0.25rem 0 0 0.25rem;
}

.toggle-button:last-child {
    border-radius: 0 0.25rem 0.25rem 0;
}

.toggle-button.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Card and Grid Styles */
.card {
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: #2d3748;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Key Insights Styles */
.insight-card {
    text-align: center;
    padding: 1rem;
    border-radius: 0.25rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.insight-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #4a5568;
}

.insight-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #2d3748;
}

.insight-subtitle {
    font-size: 0.75rem;
    color: #64748b;
}

.insight-card .positive {
    color: #28a745;
}

.insight-card .negative {
    color: #dc3545;
}

.insight-card .neutral {
    color: #6c757d;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.table th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: #4a5568;
    /* Text wrapping for table headers */
    word-wrap: break-word;
    white-space: normal;
    vertical-align: middle;
    max-width: 150px; /* Adjust as needed */
    min-height: 50px;
}

.table td {
    /* Text wrapping for table cells */
    word-wrap: break-word;
    white-space: normal;
}

.table tr:hover {
    background-color: #f8fafc;
}

.parent-name {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.parent-header-row {
    background-color: #f1f5f9;
}

.parent-header {
    font-weight: 600;
    color: #4a5568;
    padding: 0.5rem 0.75rem;
}

.total-row {
    background-color: #f8fafc;
    font-weight: 500;
}

.total-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* New Client Table Styles */
#new-clients-table th,
#new-clients-table td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

#new-clients-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    text-align: left;
}

#new-clients-table tr:hover {
    background-color: #f1f5f9;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .insight-card {
        margin-bottom: 1rem;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
        min-width: 0;
    }
    
    .view-toggle {
        margin-left: 0;
        margin-top: 1rem;
    }
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #4a5568;
}

.tab-button:hover {
    color: #3b82f6;
}

.tab-button.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Secondary Tabs */
.secondary-tabs {
    margin-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.secondary-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* New Clients Lists */
.new-clients-list {
    display: none;
}

.new-clients-list.active {
    display: block;
}

.section-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background-color: #f8fafc;
    padding: 1rem;
    border-radius: 0.25rem;
}

.summary-item {
    flex: 1;
    min-width: 180px;
    text-align: center;
}

.summary-label {
    font-size: 0.875rem;
    color: #4a5568;
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
}

/* Growth Analysis */
.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Positive/Negative Values */
.positive {
    color: #28a745;
}

.negative {
    color: #dc3545;
}

.neutral {
    color: #6c757d;
}

/* Action buttons */
.actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    background-color: #4a5568;
    color: white;
    text-decoration: none;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
}

.btn:hover {
    background-color: #2d3748;
}

.btn:last-child {
    margin-right: 0;
}
