/* ===========================================
   LLM Pricing Page Styles
   =========================================== */

/* Container */
.llm-pricing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.llm-pricing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.llm-pricing-header-left {
    display: flex;
    flex-direction: column;
}

.llm-pricing-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.llm-pricing-subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin: 6px 0 0 0;
    font-weight: 400;
    line-height: 1.4;
}

.llm-pricing-header .last-updated {
    color: #64748b;
    font-size: 0.9rem;
}

/* Filter Section */
.llm-filter-section {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
}

.llm-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.llm-search-input {
    width: 100%;
    padding: 12px 16px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.2s;
}

.llm-search-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.llm-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    width: 20px;
    height: 20px;
}

.llm-filter-select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    min-width: 160px;
    transition: border-color 0.2s;
}

.llm-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Models Table */
.models-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 20px;
    padding: 20px;
    background: #f1f5f9;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

.header-item {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.models-list {
    max-height: 600px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.model-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 20px;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.2s;
    align-items: center;
}

.model-row:hover {
    background-color: #f8fafc;
}

.model-row:last-child {
    border-bottom: none;
}

.model-row:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    background-color: #eff6ff;
}

.rank {
    font-weight: 600;
    color: #475569;
}

.model-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.model-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    overflow: hidden;
}

.model-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.model-name {
    font-weight: 500;
    color: #0f172a;
}

.cost {
    font-weight: 600;
    color: #059669;
    font-size: 1.1rem;
}

/* Model Detail Modal */
.model-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.model-detail-overlay.active {
    opacity: 1;
    visibility: visible;
}

.model-detail-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.model-detail-overlay.active .model-detail-content {
    transform: translateY(0);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detail-company {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
}

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

.company-logo img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

.detail-date {
    color: #64748b;
    font-size: 0.9rem;
}

.detail-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: #0f172a;
}

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

.stat-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 5px;
}

.stat-title {
    color: #64748b;
    font-size: 0.9rem;
}

.sub-statistics {
    margin-bottom: 30px;
}

.sub-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.sub-stat-title {
    color: #64748b;
}

.sub-stat-value {
    font-weight: 600;
    color: #0f172a;
}

.cost-analysis h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #0f172a;
}

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

.analysis-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.analysis-row {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.analysis-row:last-child {
    margin-bottom: 0;
    color: #64748b;
    font-size: 0.9rem;
}

.detail-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f1f5f9;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.detail-close-btn:hover {
    background: #e2e8f0;
}

/* Loading and Empty States */
.llm-loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.llm-no-results {
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-style: italic;
}

/* Company Logo Colors */
.company-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.company-badge.openai {
    background: #e0f2fe;
    color: #0369a1;
}

.company-badge.google {
    background: #dcfce7;
    color: #15803d;
}

.company-badge.anthropic {
    background: #fef3c7;
    color: #b45309;
}

.company-badge.meta {
    background: #e0e7ff;
    color: #4338ca;
}

.company-badge.deepseek {
    background: #f3e8ff;
    color: #7c3aed;
}

/* Dark Mode */
body.dark-mode .llm-pricing-header {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-mode .llm-pricing-header h1 {
    color: #f1f5f9;
}

body.dark-mode .llm-pricing-subtitle {
    color: #94a3b8;
}

body.dark-mode .llm-pricing-header .last-updated {
    color: #94a3b8;
}

body.dark-mode .llm-search-input,
body.dark-mode .llm-filter-select {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

body.dark-mode .llm-search-input:focus,
body.dark-mode .llm-filter-select:focus {
    border-color: #60a5fa;
}

body.dark-mode .llm-search-icon {
    color: #94a3b8;
}

body.dark-mode .models-table-container {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-mode .table-header {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}

body.dark-mode .model-row {
    border-color: #334155;
}

body.dark-mode .model-row:hover {
    background: #334155;
}

body.dark-mode .model-row:focus {
    background-color: #1e3a5f;
}

body.dark-mode .rank {
    color: #cbd5e1;
}

body.dark-mode .model-name {
    color: #f1f5f9;
}

body.dark-mode .model-logo {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
}

body.dark-mode .cost {
    color: #34d399;
}

body.dark-mode .model-detail-content {
    background: #1e293b;
}

body.dark-mode .detail-title {
    color: #f1f5f9;
}

body.dark-mode .detail-company,
body.dark-mode .detail-date {
    color: #94a3b8;
}

body.dark-mode .stat-card,
body.dark-mode .analysis-item {
    background: #334155;
    border-color: #475569;
}

body.dark-mode .stat-value {
    color: #34d399;
}

body.dark-mode .stat-title {
    color: #94a3b8;
}

body.dark-mode .sub-stat-item {
    border-color: #475569;
}

body.dark-mode .sub-stat-title {
    color: #94a3b8;
}

body.dark-mode .sub-stat-value {
    color: #f1f5f9;
}

body.dark-mode .cost-analysis h3 {
    color: #f1f5f9;
}

body.dark-mode .detail-close-btn {
    background: #334155;
    color: #94a3b8;
}

body.dark-mode .detail-close-btn:hover {
    background: #475569;
}

/* Responsive Design */
@media (max-width: 768px) {
    .llm-pricing-container {
        padding: 15px;
    }

    .llm-pricing-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px 20px;
    }

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

    .llm-filter-section {
        flex-direction: column;
        gap: 10px;
    }

    .llm-search-wrapper {
        min-width: unset;
        width: 100%;
    }

    .llm-filter-select {
        width: 100%;
        min-width: unset;
    }

    .table-header,
    .model-row {
        grid-template-columns: 60px 1fr auto;
        gap: 10px;
        padding: 15px;
    }

    .model-detail-overlay {
        padding: 10px;
    }

    .model-detail-content {
        padding: 20px;
        margin: 10px;
    }

    .detail-title {
        font-size: 1.4rem;
    }

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

    .analysis-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .table-header,
    .model-row {
        grid-template-columns: 50px 1fr;
        gap: 8px;
    }

    .cost {
        display: none;
    }

    .model-row::after {
        content: attr(data-cost);
        font-size: 0.85rem;
        color: #059669;
        font-weight: 600;
        grid-column: 2;
    }
}

/* 7-column layout for expanded table */
.table-header,
.model-row {
    grid-template-columns: 60px 1.6fr 120px 90px 110px 110px 160px;
    gap: 12px;
}

@media (max-width: 900px) {
    .table-header,
    .model-row {
        grid-template-columns: 50px 1fr 100px 80px 90px;
    }
    /* hide latency + category on mid screens */
    .table-header > :nth-child(6),
    .table-header > :nth-child(7),
    .model-row    > :nth-child(6),
    .model-row    > :nth-child(7) { display: none; }
}

/* Cost Calculator Link Section */
.cost-calculator {
    margin-top: 32px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border-radius: 12px;
    border: 1px solid #e0e7ff;
    text-align: center;
}

.cost-calculator .note {
    font-size: 1rem;
    color: #475569;
    margin: 0;
}

.cost-calculator a {
    color: #6366f1;
    font-weight: 600;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.cost-calculator a:hover {
    background: #6366f1;
    color: white;
}

/* Dark mode */
body.dark-mode .cost-calculator {
    background: linear-gradient(135deg, #1e293b 0%, #312e81 100%);
    border-color: #4338ca;
}

body.dark-mode .cost-calculator .note {
    color: #cbd5e1;
}

body.dark-mode .cost-calculator a {
    color: #a5b4fc;
}

body.dark-mode .cost-calculator a:hover {
    background: #6366f1;
    color: white;
}