/*
 * Routlys - Identidade Visual (refatorada — magenta brand)
 * Tokens canônicos: app/static/css/tokens.css (importar ANTES deste arquivo)
 * Documentação: design-system/README.md
 *
 * Este :root mantém os nomes legados (--emerald-*, --gold-*, --bg-primary etc.)
 * como ALIASES para os tokens novos. Permite refatorar sem reescrever as ~1800
 * linhas de regras existentes. Componentes novos devem usar os tokens canônicos
 * (--brand-primary, --bg-base, --text-primary).
 */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Aliases de superfície (legado → canônico) */
    --bg-primary: var(--bg-base);
    --bg-secondary: #07010F;
    --bg-card: var(--bg-elevated);

    /* Aliases de brand: o que era emerald agora é magenta */
    --emerald-primary: var(--brand-primary);
    --emerald-secondary: var(--brand-dark);
    --emerald-dark: var(--brand-dark);

    /* Aliases gold: rosa claro do brand assume o papel de "destaque secundário" */
    --gold-primary: var(--brand-light);
    --gold-secondary: var(--brand-light);
    --gold-light: var(--brand-light);

    /* Gradientes — paleta Tailwind do site routlys.com:
       --gradient-primary é o gradient duplo (roxo→cyan), igual "classe mundial"
       --gradient-mixed é o gradient triplo (roxo→fuchsia→cyan), igual "quilômetros" */
    --gradient-primary: var(--gradient-brand-cool);   /* roxo → cyan */
    --gradient-accent: linear-gradient(135deg, var(--brand-primary), var(--brand-light));
    --gradient-mixed: var(--gradient-brand);          /* roxo → fuchsia → cyan */

    /* Aliases de texto */
    --text-light: var(--text-primary);
    --text-gray: var(--text-secondary);
    /* --text-muted já existe no tokens.css */

    /* Sombras (legado mapeia para tokens novos) */
    --shadow: var(--shadow-md);
    /* --shadow-glow já existe no tokens.css com cor brand (reduzido pra 0.18) */
    --shadow-gold: 0 2px 12px rgba(168, 85, 247, 0.12);

    /* Bordas legadas — antes magenta puro 0.3 em ~25 elementos (saturava demais).
       Agora branco quase imperceptível (como a landing). Magenta fica reservado
       pra hover/focus/active. */
    --border-emerald: rgba(255, 255, 255, 0.08);
    --border-emerald-strong: rgba(147, 51, 234, 0.28);  /* uso explícito quando necessário */
    --border-gold: rgba(255, 255, 255, 0.08);
}

/* Utilitário: aplicar gradient text só onde realmente faz sentido (logos,
   destaques inline). Por padrão, h1/h2/stat-value usam cor sólida. */
.text-gradient {
    background: var(--gradient-mixed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.5rem;
    color: var(--text-light);
    /* gradient text só via .text-gradient utility — h1 puro fica legível */
}

h2 {
    font-size: 1.75rem;
    color: var(--text-light);
}

h3 {
    font-size: 1.25rem;
    color: var(--text-gray);
}

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

/* Header */
.header {
    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-emerald);
    position: sticky;
    top: 0;
    z-index: 10000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo-img {
    height: 44px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(147, 51, 234, 0.25));
}

.header-tagline {
    align-self: center;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border-subtle);
    line-height: 1.2;
}

@media (max-width: 768px) {
    .header-logo-img { height: 36px; }
    .header-tagline { display: none; }
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    border: 1px solid var(--border-gold);
}

.logo-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-subtle);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--border-emerald);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    font-family: var(--font-display);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    /* sólido roxo (igual btn-primary do site routlys.com — não tem gradient) */
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(147, 51, 234, 0.30);
}

.btn-primary:hover {
    background: var(--brand-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(147, 51, 234, 0.45);
}

.btn-secondary {
    background: transparent;
    color: var(--text-light);
    border: 2px solid var(--emerald-primary);
}

.btn-secondary:hover {
    background: rgba(147, 51, 234, 0.1);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-light);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--emerald-primary);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.2);
}

.form-textarea {
    min-height: 150px;
    resize: vertical;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.tab {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.05);
}

.tab.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Shift Tabs (Seletor de Turno) */
.shift-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.shift-tab {
    padding: 0.6rem 1rem;
    border: 2px solid var(--border-emerald);
    background: transparent;
    color: var(--text-gray);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.shift-tab:hover {
    color: var(--text-light);
    background: rgba(147, 51, 234, 0.1);
    border-color: var(--emerald-primary);
}

.shift-tab.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--emerald-primary);
    box-shadow: var(--shadow-glow);
}

/* Map Container */
.map-container {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#map {
    width: 100%;
    height: 100%;
}

/* Stats Cards */
.stat-card {
    /* fundo neutro sólido — N cards na tela com tint magenta saturavam */
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    /* cor lavender neutra — N stat-values rosa empilhados pesavam demais */
    color: var(--text-light);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-gray);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-display);
}

.badge-success {
    background: rgba(147, 51, 234, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-info {
    background: rgba(147, 51, 234, 0.2);
    color: var(--brand-light);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--emerald-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 30, 46, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 1000;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(147, 51, 234, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* Result Panel */
.result-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid var(--border-emerald);
}

.result-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Team Card */
.team-card {
    background: rgba(147, 51, 234, 0.05);
    border: 1px solid var(--border-emerald);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.team-name {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--gold-primary);
}

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

.member-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    color: var(--text-gray);
    font-size: 0.9rem;
}

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

/* Route Step */
.route-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    border: 1px solid var(--border-gold);
}

.step-content {
    flex: 1;
}

.step-name {
    font-weight: 600;
    color: var(--text-light);
}

.step-address {
    font-size: 0.875rem;
    color: var(--text-gray);
}

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-light);
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-emerald);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload:hover {
    border-color: var(--emerald-primary);
    background: rgba(147, 51, 234, 0.05);
}

.file-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--brand-light);
}

.file-upload-text {
    color: var(--text-gray);
}

.file-upload-text strong {
    color: var(--brand-light);
}

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--emerald-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--emerald-secondary);
}

/* Section Divider */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--emerald-primary), transparent);
    margin: 2rem 0;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tab-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ================================================
   Panel Toggle Buttons & Side Panels
   ================================================ */

/* Tabs Row - contains tabs + panel buttons */
.tabs-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tabs-row .tabs {
    flex: 1;
    margin-bottom: 0;
}

/* Panel Toggle Buttons Container */
.panel-toggle-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Individual Panel Toggle Button (Economia, CO2, Comparativos)
   Igual ao btn-primary do site: roxo sólido, sem borda, sem gradient. */
.panel-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(147, 51, 234, 0.30);
    color: white;
}

.panel-toggle-btn:hover {
    background: var(--brand-light);
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(147, 51, 234, 0.45);
}

.panel-toggle-btn.active {
    background: var(--brand-dark);
    box-shadow: 0 4px 14px rgba(126, 34, 206, 0.45);
}

.panel-toggle-btn.active svg {
    transform: rotate(180deg);
}

.panel-toggle-btn svg {
    transition: transform 0.3s ease;
}

/* Container shift when panel is open */
#main-container {
    transition: margin-left 0.4s ease, margin-right 0.4s ease;
}

#main-container.panel-open-right {
    margin-right: 510px;
}

#main-container.panel-open-left {
    margin-left: 510px;
}

/* Side Panel (Dashboard & CO2) */
.side-panel {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
    border-left: 1px solid var(--border-emerald);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    z-index: 9000;
    transition: right 0.4s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-panel.open {
    right: 0;
}

/* Left Side Panel */
.side-panel-left {
    right: auto;
    left: -520px;
    border-left: none;
    border-right: 1px solid var(--border-emerald);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5);
    transition: left 0.4s ease;
}

.side-panel-left.open {
    left: 0;
    right: auto;
}

/* Left Toggle Buttons */
.panel-toggle-left {
    order: -1;
}

.panel-toggle-left-btn svg {
    transform: rotate(0deg);
}

/* Side Panel Header */
.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-emerald);
}

.side-panel-header h2 {
    font-size: 1.25rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
}

.side-panel-header h2 svg {
    color: var(--brand-light);
}

/* Panel Filter Indicator */
.panel-filter-indicator {
    margin-top: 0.5rem;
}

.filter-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--brand-soft);
    border: 1px solid var(--brand-soft-strong);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.filter-badge strong {
    color: var(--brand-light);
}

.filter-badge.source-badge {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    font-weight: 600;
}

/* Comparison Filters Info */
.comparison-filters-info {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comparison-filters-info .filter-info-label {
    color: var(--text-gray);
    margin-right: 0.5rem;
}

.comparison-filters-info .filter-info-value {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    color: #60a5fa;
    margin-right: 0.35rem;
    font-size: 0.7rem;
}

/* Panel Close Button */
.panel-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.panel-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    color: var(--error);
}

/* Side Panel Content */
.side-panel-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Dashboard Sections */
.dashboard-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-subtle);
}

.dashboard-section h3 {
    font-size: 1rem;
    color: var(--gold-primary);
    margin-bottom: 1rem;
    font-family: var(--font-display);
    font-weight: 600;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 220px;
    width: 100%;
}

.chart-container canvas {
    max-height: 100%;
}

/* Savings Cards - Dashboard */
.savings-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.saving-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
}

.saving-card:hover {
    transform: translateX(5px);
    border-color: var(--emerald-primary);
}

.saving-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.saving-km .saving-icon {
    background: rgba(147, 51, 234, 0.15);
    color: var(--brand-light);
}

.saving-time .saving-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

.saving-fuel .saving-icon {
    background: rgba(168, 85, 247, 0.15);
    color: var(--gold-primary);
}

.saving-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem;
}

.saving-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-light);
}

.saving-unit {
    font-size: 1rem;
    color: var(--text-gray);
    font-weight: 500;
}

.saving-label {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Projection Info */
.projection-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.projection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.projection-item.highlight {
    /* magenta + rosa juntos saturavam ao lado de outras 3 projections.
       agora usamos magenta → azul-céu sutil (igual gradient principal) */
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.10), rgba(168, 216, 234, 0.06));
    border-color: var(--brand-soft-strong);
}

.projection-label {
    font-size: 0.875rem;
    color: var(--text-gray);
}

.projection-value {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-light);
}

.projection-item.highlight .projection-value {
    font-size: 1.25rem;
    background: var(--gradient-mixed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Optimization Technology Card */
.optimization-tech-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1rem;
}

.tech-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.tech-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 110px;
}

.tech-value {
    color: var(--brand-light);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
}

.tech-bar-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 0 0.75rem;
    overflow: hidden;
}

.tech-bar {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--emerald-primary), var(--gold-primary));
    transition: width 0.6s ease;
}

/* ================================================
   CO2 Panel Specific Styles
   ================================================ */

/* CO2 Comparison Cards */
.co2-comparison {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.co2-card {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
}

.co2-card:hover {
    transform: translateY(-2px);
}

.co2-before {
    border-color: rgba(239, 68, 68, 0.3);
}

.co2-before .co2-icon {
    color: var(--error);
}

.co2-before .co2-value {
    color: var(--error);
}

.co2-after {
    border-color: rgba(16, 217, 160, 0.3);
}

.co2-after .co2-icon {
    color: var(--success);
}

.co2-after .co2-value {
    color: var(--success);
}

.co2-icon {
    margin-bottom: 0.5rem;
}

.co2-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.co2-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.co2-sublabel {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.co2-arrow {
    color: var(--success);
    flex-shrink: 0;
}

/* CO2 Savings Card — exceção verde do design system magenta:
   o contexto de "economia" e "redução de CO2" pede verde universal */
.co2-savings-card {
    background: linear-gradient(135deg, rgba(16, 217, 160, 0.18), rgba(16, 217, 160, 0.05));
    border: 2px solid var(--success);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 0 30px rgba(16, 217, 160, 0.18);
}

.co2-savings-icon {
    color: var(--success);
    flex-shrink: 0;
}

.co2-savings-content {
    flex: 1;
}

.co2-savings-value {
    display: block;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--success), #5BE3BD);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.co2-savings-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

.co2-savings-percent {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--success);
    color: #0E0218;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Eco Equivalents */
.eco-equivalents {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.eco-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

.eco-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.eco-content {
    flex: 1;
}

.eco-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
}

.eco-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-gray);
}

/* ═══════════════════════════════════════════════════════════════
   COMPARISON PANEL STYLES
   ═══════════════════════════════════════════════════════════════ */

/* Comparison Warning */
.comparison-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px dashed var(--border-subtle);
}

.comparison-warning .warning-icon {
    color: var(--warning);
    margin-bottom: 1rem;
}

.comparison-warning h3 {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.comparison-warning p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.warning-modules {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.warning-module-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    color: var(--warning);
    font-size: 0.85rem;
}

.warning-module-item svg {
    flex-shrink: 0;
}

/* Comparison Cards */
.comparison-cards {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.compare-card {
    flex: 1;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    text-align: center;
    transition: all 0.3s ease;
}

.compare-card:hover {
    border-color: var(--border-emerald);
    transform: translateY(-2px);
}

.compare-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.compare-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.compare-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-gray);
}

.compare-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.compare-card-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.compare-vs {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.5rem;
}

/* Winner Highlight */
.comparison-winner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    /* gradient sutil magenta→azul-céu, coerente com o resto */
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.10), rgba(168, 216, 234, 0.06));
    border: 1px solid var(--brand-soft-strong);
    border-radius: 12px;
}

.winner-icon {
    font-size: 2.5rem;
}

.winner-content {
    display: flex;
    flex-direction: column;
}

.winner-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.winner-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-light);
}

.winner-savings {
    font-size: 0.85rem;
    color: var(--text-gray);
}

/* Comparison Metrics */
.comparison-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.metric-row.highlight {
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid var(--border-emerald);
}

.metric-label {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-gray);
}

.metric-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
    min-width: 60px;
    text-align: center;
}

.metric-vs {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 0.75rem;
}

.metric-savings {
    color: var(--brand-light);
}

.metric-percent {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    #main-container.panel-open-right {
        margin-right: 460px;
    }

    #main-container.panel-open-left {
        margin-left: 460px;
    }

    .side-panel {
        width: 450px;
        right: -470px;
    }
}

@media (max-width: 1200px) {
    #main-container.panel-open-right {
        margin-right: 0;
    }

    #main-container.panel-open-left {
        margin-left: 0;
    }

    .side-panel {
        width: 100%;
        right: -100%;
    }

    .side-panel-left {
        left: -100%;
    }
}

/* ═══════════════════════════════════════════════════════════════
   MODAL DE SELEÇÃO
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--border-emerald);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-light);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-light);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-gray);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════════════════════════════
   TELA DO MOTORISTA (FULLSCREEN)
   ═══════════════════════════════════════════════════════════════ */
.driver-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 10001;
}

.driver-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.driver-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-emerald);
}

.driver-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-light);
}

.driver-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.driver-map-container {
    flex: 1;
    position: relative;
}

#driver-map {
    width: 100%;
    height: 100%;
}

.driver-stops-panel {
    width: 380px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-emerald);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.driver-stats {
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.driver-stat-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(147, 51, 234, 0.1);
    border-radius: 8px;
    border: 1px solid var(--border-emerald);
}

.driver-stat-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-light);
}

.driver-stat-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

.driver-stops-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.driver-stop-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--emerald-primary);
    transition: all 0.3s ease;
}

.driver-stop-item:hover {
    background: rgba(147, 51, 234, 0.08);
}

.driver-stop-item.pickup-home {
    border-left-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.1);
}

.driver-stop-number {
    width: 32px;
    height: 32px;
    background: var(--emerald-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.driver-stop-item.pickup-home .driver-stop-number {
    background: #8B5CF6;
}

.driver-stop-info {
    flex: 1;
}

.driver-stop-name {
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.driver-stop-address {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.driver-stop-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: #8B5CF6;
    color: white;
    border-radius: 4px;
    margin-top: 0.5rem;
    display: inline-block;
}

/* Destino Final (Fábrica) */
.driver-stop-item.destination {
    border-left-color: var(--gold-primary);
    background: rgba(168, 85, 247, 0.1);
}

.driver-stop-item.destination .driver-stop-number {
    background: var(--gold-primary);
    font-size: 1rem;
}

/* Trip Separator */
.driver-trip-separator {
    text-align: center;
    padding: 0.75rem;
    color: var(--text-gray);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Destination Separator */
.driver-destination-separator {
    text-align: center;
    padding: 1rem 0.75rem;
    margin: 1rem 0;
    border-top: 2px dashed var(--gold-primary);
    border-bottom: 2px dashed var(--gold-primary);
    background: rgba(168, 85, 247, 0.1);
}

.driver-destination-separator span {
    color: var(--gold-primary);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Destination Badge */
.destination-badge {
    background: var(--gold-primary) !important;
    color: var(--brand-dark) !important;
    font-weight: 600;
}

/* Responsivo - Tela do Motorista */
@media (max-width: 900px) {
    .driver-content {
        flex-direction: column;
    }

    .driver-stops-panel {
        width: 100%;
        height: 45%;
        border-left: none;
        border-top: 1px solid var(--border-emerald);
    }

    .driver-map-container {
        height: 55%;
    }
}

@media (max-width: 600px) {
    .driver-header {
        padding: 0.75rem 1rem;
    }

    .driver-title {
        font-size: 1rem;
    }

    .driver-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .driver-stat-item {
        padding: 0.5rem;
    }

    .driver-stat-value {
        font-size: 1rem;
    }

    .driver-stop-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .driver-stop-number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}
