/* Observable Framework Inspired Styles */

:root {
    /* Match Observable Framework colors */
    --primary-color: #0066cc;
    --primary-hover: #0052a3;
    --secondary-color: #6366f1;
    --background-color: #ffffff;
    --surface-color: #f8fafc;
    --border-color: #d1d5db;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Observable theme variables */
    --theme-foreground: #111827;
    --theme-foreground-alt: #6b7280;
    --theme-foreground-muted: #9ca3af;
    --theme-background: #ffffff;
    --theme-background-alt: #f9fafb;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--theme-foreground);
    background-color: var(--theme-background);
    font-size: 14px;
    margin: 0;
    padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Navigation */
.navbar {
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
}

.brand-logo {
    height: 32px;
    width: 32px;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.nav-mobile-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.nav-mobile-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
}

/* Main content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.container {
    max-width: 1152px;  /* Observable Framework default */
    margin: 0 auto;
    padding: 0 24px;    /* Observable uses 24px padding */
}

/* Page header - Observable style */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--theme-foreground);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--theme-foreground-alt);
    margin: 0;
    line-height: 1.5;
}

/* Cards */
.card {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.card-title {
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    color: var(--text-secondary);
}

/* Grid layouts */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

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

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

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

.table th {
    background: var(--surface-color);
    font-weight: 600;
    color: var(--text-primary);
}

.table tr:hover {
    background: var(--surface-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
    text-decoration: none;
}

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

.btn-secondary:hover {
    background: var(--border-color);
    text-decoration: none;
}

/* Upgrade CTA */
.upgrade-cta {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upgrade-cta-icon {
    font-size: 1.25rem;
}

.upgrade-cta-content {
    flex: 1;
    color: #0c4a6e;
}

.upgrade-cta-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.upgrade-cta-text {
    font-size: 0.875rem;
}

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

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map container */
.map-container {
    height: 500px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Chart container */
.chart-container {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

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

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

/* Footer */
.footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.footer-section h4 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.footer-section p {
    color: var(--text-secondary);
    margin-bottom: 0;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-bottom p {
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .nav-mobile-toggle {
        display: flex;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 1rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-container {
        padding: 2rem 1rem 1rem;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}