:root {
    --color-primary: #ffbe00;
    --color-bg: #ffffff;
    --color-surface: #f8f9fa;
    --color-text: #000000;
    --color-text-secondary: #666666;
    --color-border: #e0e0e0;
    --color-hover: #fff5d6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    --color-primary: #ffbe00;
    --color-bg: #000000;
    --color-surface: #1a1a1a;
    --color-text: #ffffff;
    --color-text-secondary: #999999;
    --color-border: #333333;
    --color-hover: #2a2a2a;
    --shadow: 0 2px 8px rgba(255, 255, 255, 0.05);
    --shadow-lg: 0 4px 16px rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Botão de tema fixo */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

#theme-toggle:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.theme-icon {
    width: 24px;
    height: 24px;
    color: var(--color-text);
}

.theme-icon.hidden { display: none; }

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    color: var(--color-text-secondary);
    padding: 8px 0 18px 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 24px;
}

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

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

.breadcrumb .separator { color: var(--color-text-secondary); }

.header-breadcrumb {
    padding: 0;
    border: none;
    margin: 0;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-bottom: 2px solid var(--color-primary);
    margin-bottom: 30px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.home-link {
    display: inline-block;
    padding: 8px 12px;
    border: 2px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.home-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.header-content h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--color-text-secondary);
    font-size: 1.1em;
}

.theme-toggle {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--color-primary);
    transform: scale(1.1);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2.2em;
    line-height: 1;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}

.stat-label {
    color: var(--color-text-secondary);
    font-size: 0.9em;
    margin-top: 5px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 10px;
}

.tab {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

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

.tab.active {
    background: var(--color-primary);
    color: #000000;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.loading.show {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Content Sections */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 2em;
    margin-bottom: 10px;
    color: var(--color-text);
}

.section-header p {
    color: var(--color-text-secondary);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 25px;
    overflow: visible;
}

.chart-container h3 {
    font-size: 1.3em;
    margin-bottom: 20px;
    color: var(--color-text);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.info-tip {
    position: relative;
    display: inline-block;
    font-size: 0.85em;
    color: var(--color-text-secondary);
    opacity: 0.7;
    cursor: help;
}

.info-tip::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 125%;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95em;
    line-height: 1.4;
    white-space: normal;
    min-width: 220px;
    max-width: 320px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.info-tip:hover::after {
    opacity: 1;
}

.chart-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chart-controls select,
.chart-controls label {
    background: var(--color-surface);
    color: var(--color-text);
}

.chart-container canvas {
    max-height: 400px;
}

.chart-container #worldMap {
    width: 100%;
    height: 520px;
    border-radius: 12px;
}

.chart-container.wide {
    grid-column: span 2;
}

.country-label {
    background: rgba(0,0,0,0.6);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
}

[data-theme="dark"] .country-label {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
}

/* Insights Grid */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.insight-card {
    background: var(--color-surface);
    border-left: 4px solid var(--color-primary);
    border-radius: 8px;
    padding: 20px;
}

.insight-card h4 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: var(--color-text);
}

.leader-info {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1.2;
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 12px 20px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1em;
    transition: all 0.3s ease;
}

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

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

.btn-secondary {
    padding: 12px 24px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #000000;
}

/* Table */
.table-container {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 20px;
}

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

thead {
    background: var(--color-text);
    color: var(--color-bg);
}

[data-theme="dark"] thead {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-text);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    position: relative;
}

th:hover {
    background: var(--color-primary);
    color: #000000;
}

th.sortable::after {
    content: ' ⇅';
    opacity: 0.5;
}

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

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

.rank-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.rank-1, .rank-2, .rank-3 {
    background: var(--color-primary);
    color: #000000;
}

.rank-top10 {
    background: #d4edda;
    color: #155724;
}

[data-theme="dark"] .rank-top10 {
    background: #1a3a1a;
    color: #4ade80;
}

.rank-top50 {
    background: #cce5ff;
    color: #004085;
}

[data-theme="dark"] .rank-top50 {
    background: #1a2a3a;
    color: #60a5fa;
}

.rank-other {
    background: var(--color-surface);
    color: var(--color-text-secondary);
}

/* Comparison */
.comparison-controls {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.model-selector {
    position: relative;
    margin-bottom: 20px;
}

.model-selector input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 1em;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: var(--color-hover);
}

.selected-models {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.selected-model {
    background: var(--color-primary);
    color: #000000;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.selected-model button {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
}

.comparison-content {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

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

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

.table-simple thead {
    background: var(--color-surface);
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.table-simple th,
.table-simple td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    white-space: nowrap;
}

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

.stats-detailed {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 25px;
}

.stats-table {
    margin-top: 20px;
}

.stat-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.stat-row-label {
    font-weight: 600;
    color: var(--color-text);
}

.stat-row-value {
    color: var(--color-text-secondary);
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.category-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 25px;
}

.category-card h3 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
}

.category-list {
    list-style: none;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.category-item:last-child {
    border-bottom: none;
}

.category-rank {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.2em;
    min-width: 40px;
}

.category-model {
    flex: 1;
    padding: 0 15px;
    font-weight: 600;
    color: var(--color-text);
}

/* Footer */
.footer {
    margin-top: 60px;
    padding: 30px 0;
    border-top: 2px solid var(--color-border);
    text-align: center;
    color: var(--color-text-secondary);
}

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

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

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 6px 10px;
    border: 2px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.85em;
    font-weight: 600;
}

#companies-section .category-card {
    max-height: 420px;
    overflow: auto;
}

#companies-section .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 8px;
}

#companies-section .category-card h3 {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

#companies-section .count-tag {
    /* opcional: ajustar espaçamento do contador */
    margin-left: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8em;
    }

    .charts-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

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

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filters {
        flex-direction: column;
    }

    .filters input {
        width: 100%;
        min-width: 100%;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 10px 8px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}
[data-theme="dark"] .company-label {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
}

.company-label {
    background: rgba(0,0,0,0.6);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 12px;
}
