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

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --card-background: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

.search-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

#searchInput {
    flex: 1;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-primary, .btn-secondary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--background);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--card-background);
    color: var(--text-primary);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group select {
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.results-section {
    margin-top: 2rem;
}

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

.results-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
}

.results-count {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-weight: 600;
}

.chart-container-wrapper {
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-container.main-chart {
    width: 100%;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.chart {
    width: 100%;
    height: 500px;
}

.data-table-container {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.data-table-container h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table-wrapper {
    overflow-x: auto;
}

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

thead {
    background: var(--background);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--background);
}

.empty-state {
    background: transparent !important;
}

.empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-message svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-message p {
    font-size: 1.125rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .search-bar {
        flex-direction: column;
    }

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

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Loading state */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.nav-link {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.nav-link.active {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    font-weight: 600;
}

/* Homepage Styles */
.homepage-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 4rem 0;
}

.homepage-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.homepage-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 4rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.action-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.action-card {
    background: var(--card-background);
    padding: 3rem 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
    cursor: pointer;
}

.action-card-link:hover .action-card {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border-color: var(--primary-color);
}

.action-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.action-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.action-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

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

.stat-item {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* View Toggle Styles */
.view-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 0.5rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.toggle-btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.toggle-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-lg);
}

.filter-group input[type="date"] {
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-group input[type="number"] {
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    transition: all 0.2s;
}

.filter-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Analysis Mode Section */
.analysis-mode-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.analysis-mode-section .filter-group {
    max-width: 300px;
}

.analysis-mode-section label {
    color: white;
    font-size: 1rem;
}

.analysis-mode-section select {
    background: white;
    font-weight: 600;
}

/* Advanced Filters for Funding Rounds */
.advanced-filters {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
}

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

.filter-row:last-child {
    margin-bottom: 0;
}

.quick-date-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-quick-date {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-quick-date:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.btn-quick-date:active {
    transform: translateY(0);
}

/* Summary Statistics */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    color: white;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Search Page Specific Styles */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-size-selector label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.page-size-selector select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-background);
    font-size: 0.875rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-acquired {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.status-ipo {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-closed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* JSON Display Styles */
.json-data-container {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.json-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.json-display {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-primary);
    max-height: 600px;
    overflow-y: auto;
}

.json-display::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-display::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Responsive Design Updates */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .homepage-header h1 {
        font-size: 2.5rem;
    }

    .homepage-actions {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

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

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

    .pagination-controls {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .table-wrapper {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.5rem;
    }
}

