:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --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);
}

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

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

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.header-nav {
    margin-top: 1.5rem;
}

.header-nav a {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.header-nav a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

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

.date {
    font-size: 0.95rem;
    opacity: 0.8;
}

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

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

h2 {
    color: var(--primary);
    font-size: 1.875rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

h3 {
    color: var(--text);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.intro ul {
    margin-left: 1.5rem;
    margin-top: 1rem;
}

.intro li {
    margin-bottom: 0.5rem;
}

.attribution {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.attribution h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.attribution ul {
    margin-left: 1.5rem;
}

.attribution li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.attribution a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Data Notes */
.data-notes ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.data-notes li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0 0 0;
    border-bottom: 2px solid var(--border);
}

.tab-button {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-button:hover {
    color: var(--text);
    background: var(--bg);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    color: white;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.95rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Charts */
.chart-container {
    position: relative;
    height: 500px;
    margin-top: 1.5rem;
}

.chart-container-small {
    position: relative;
    height: 300px;
    margin-top: 1rem;
}

.dual-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.chart-half {
    position: relative;
}

.chart-half canvas {
    max-height: 350px;
}

/* Quadrant Grid */
.quadrant-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.quadrant-detail {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.quadrant-detail h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.quadrant-details {
    margin-top: 2rem;
}

.quadrant-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.quadrant-card h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.model-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.model-item {
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
    transition: transform 0.2s;
}

.model-item:hover {
    transform: translateX(4px);
}

.model-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.model-vendor {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.model-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.model-stat {
    display: flex;
    flex-direction: column;
}

.model-stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.model-stat-value {
    color: var(--text);
    font-weight: 600;
}

/* Quadrant Stats */
.quadrant-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quadrant-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--card-bg);
    border-radius: 4px;
}

.quadrant-stat-item .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.quadrant-stat-item .stat-value {
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Insights */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.insight-card {
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.insight-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.insight-text {
    color: var(--text);
    line-height: 1.5;
}

/* Tier Legends */
.tier-legends {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
}

.legend-group h4 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.tier-indicator {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: inline-block;
}

/* Cost Tier Colors */
.cost-very-low { background: #10b981; }
.cost-low { background: #84cc16; }
.cost-medium { background: #f59e0b; }
.cost-high { background: #f97316; }
.cost-very-high { background: #ef4444; }

/* Context Tier Colors */
.context-small { background: #fca5a5; }
.context-medium { background: #fde047; }
.context-large { background: #a78bfa; }
.context-very-large { background: #60a5fa; }
.context-ultra { background: #34d399; }

/* Output/Input Multiple Tier Colors */
.multiple-equal { background: #10b981; }      /* <=1x - Equal or cheaper output (best for users) */
.multiple-low { background: #84cc16; }        /* <2x - Low markup */
.multiple-medium { background: #fde047; }     /* 2-5x - Standard industry practice */
.multiple-high { background: #f97316; }       /* 5-10x - High markup */
.multiple-very-high { background: #ef4444; }  /* 10x+ - Very high markup */

/* Table */
.table-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.table-controls input,
.table-controls select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.table-controls input {
    flex: 1;
    min-width: 250px;
}

.table-controls input:focus,
.table-controls select:focus {
    outline: none;
    border-color: var(--primary);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

th.sortable:hover {
    background: var(--primary-dark);
}

.sort-indicator {
    margin-left: 0.5rem;
    opacity: 0.5;
}

th.sort-asc .sort-indicator::after {
    content: ' ▲';
    opacity: 1;
}

th.sort-desc .sort-indicator::after {
    content: ' ▼';
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

tbody tr.vendor-group-start {
    border-top: 2px solid var(--primary);
    background: linear-gradient(to bottom, rgba(37, 99, 235, 0.05) 0%, transparent 100%);
}

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

tbody tr.vendor-group-start:hover {
    background: linear-gradient(to bottom, rgba(37, 99, 235, 0.08) 0%, var(--bg) 100%);
}

td {
    padding: 1rem;
}

td.vendor-cell {
    font-weight: 600;
    color: var(--primary);
}

.quadrant-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

/* Footer */
footer {
    background: var(--text);
    color: white;
    padding: 2rem;
    text-align: center;
}

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

footer a:hover {
    text-decoration: underline;
}

.disclaimer {
    margin-top: 1rem;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.875rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    main {
        padding: 1rem;
    }

    section {
        padding: 1.5rem;
    }

    .chart-container {
        height: 350px;
    }

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

    .dual-chart {
        grid-template-columns: 1fr;
    }

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

    .tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Info and Warning Boxes */
.info-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.info-box h3 {
    color: #1e40af;
    margin-top: 0;
    margin-bottom: 1rem;
}

.info-box h4 {
    color: #1e3a8a;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.info-box ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.info-box li {
    margin: 0.5rem 0;
}

.warning-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.warning-box h3 {
    color: #92400e;
    margin-top: 0;
    margin-bottom: 1rem;
}

.warning-box ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.warning-box li {
    margin: 0.5rem 0;
}

.emphasis {
    font-weight: 600;
    color: #78350f;
    margin-top: 1rem;
}
