/* css/partials/pages.css
   Parte 2: novo dashboard, hero, charts, feed, performance, rpg cards,
   session analyser e estilos restantes.
*/

/* ===================================================================
 * DASHBOARD - SEÇÃO DE HERÓIS (HERO CARDS)
 * =================================================================== */
.dashboard-hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.hero-card {
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 20px rgba(139,105,20,0.2), inset 0 1px 0 rgba(255,255,255,0.5);
    border: 3px solid #8b6914;
    transition: all 0.3s ease;
}

.hero-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(139,105,20,0.3), inset 0 1px 0 rgba(255,255,255,0.5);
    border-color: #d4af37;
}

/* Variantes de Hero Cards */
.hero-card.primary {
    background: linear-gradient(135deg, #d4a856 0%, #c99845 100%);
    color: #1a0f0a;
    border: 3px solid #8b6914;
    text-shadow: 1px 1px 2px rgba(255, 215, 0, 0.2);
}

.hero-card.primary .hero-icon {
    background: rgba(255, 215, 0, 0.2);
    color: #3d2817;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-card.primary .hero-label {
    color: #3d2817;
    font-weight: 600;
}

.hero-card.primary .hero-value {
    color: #1a0f0a;
    font-size: 1.75rem;
    font-weight: 700;
}

.hero-card.primary .sub-values {
    color: #3d2817;
}

.hero-card.secondary {
    border-left: 4px solid #2ecc71;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border-color: #8b6914;
}

.hero-card.secondary .hero-icon {
    background: #e8f5e9;
    color: #2ecc71;
}

.hero-card.tertiary {
    background: linear-gradient(135deg, #8b6914 0%, #6b4f10 100%);
    color: #f5f0e8;
    border: 3px solid #d4af37;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.hero-card.tertiary .hero-icon {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.hero-card.tertiary .hero-label {
    color: #ebe4d8;
    font-weight: 600;
}

.hero-card.tertiary .hero-value {
    color: #ffd700;
    font-size: 1.75rem;
    font-weight: 700;
}

.hero-card.tertiary .sub-values {
    color: #ebe4d8;
}

.hero-card.info {
    border-left: 4px solid #d4af37;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
}

.hero-card.info .hero-icon {
    background: rgba(212, 175, 55, 0.2);
    color: #8b6914;
}

.hero-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: rgba(212, 175, 55, 0.15);
    color: #8b6914;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    border: 2px solid #8b6914;
}

.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #1a0f0a;
    margin-bottom: 4px;
    font-weight: 700;
}

.hero-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
    color: #1a0f0a;
}

.sub-values {
    font-size: 0.8rem;
    color: #3d2817;
    margin-top: 3px;
    line-height: 1.2;
}

/* ===================================================================
 * DASHBOARD - SEÇÃO DE GRÁFICOS
 * =================================================================== */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 3fr 1.4fr;
    gap: 24px;
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
}

.chart-card {
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(139,105,20,0.2), inset 0 1px 0 rgba(255,255,255,0.5);
    border: 3px solid #8b6914;
    height: 350px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
.chart-card:hover {
    box-shadow: 0 12px 30px rgba(139,105,20,0.3), inset 0 1px 0 rgba(255,255,255,0.5);
    border-color: #d4af37;
}

.chart-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #8b6914;
}

.chart-card h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #3d2817;
    text-shadow: 1px 1px 2px rgba(255, 215, 0, 0.1);
}

.chart-wrapper {
    flex-grow: 1;
    position: relative;
    min-height: 0;
}

/* Botões de Toggle para Gráficos */
.chart-toggle-btn,
.source-toggle-btn {
    background: none;
    border: 1px solid var(--cor-borda);
    color: var(--cor-texto-leve);
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.chart-toggle-btn:hover,
.source-toggle-btn:hover {
    border-color: var(--cor-primaria);
    color: var(--cor-primaria);
    background-color: rgba(59, 130, 246, 0.05);
}

.chart-toggle-btn.active,
.source-toggle-btn.active {
    background-color: var(--cor-primaria);
    border-color: var(--cor-primaria);
    color: white;
    font-weight: 600;
}

/* Select de Ano do Gráfico */
#year-filter-select {
    height: 32px;
    padding: 4px 8px;
    font-size: 0.85rem;
    border: 1px solid var(--cor-borda);
    border-radius: 4px;
    background-color: var(--cor-surface);
    color: var(--cor-texto);
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

#year-filter-select:hover {
    border-color: var(--cor-primaria);
}

#year-filter-select:focus {
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* ===================================================================
 * DASHBOARD - SEÇÃO INFERIOR (STATS E FEED)
 * =================================================================== */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 0.65fr 1.35fr;
    gap: 24px;
    align-items: start;
    width: 100%;
    max-width: 100%;
}
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--cor-borda);
    transition: all 0.3s ease;
}

.stat-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sombra-media);
    border-color: var(--cor-primaria);
}

.stat-mini-card .icon-box {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.icon-box.blue {
    background: #e3f2fd;
    color: #3498db;
}

.icon-box.green {
    background: #e8f5e9;
    color: #2ecc71;
}

.icon-box.red {
    background: #ffebee;
    color: #e74c3c;
}

.stat-mini-card .text-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-mini-card .number {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--cor-texto);
    line-height: 1;
}

.stat-mini-card .label {
    font-size: 0.8rem;
    color: var(--cor-texto-leve);
    font-weight: 500;
}

/* ===================================================================
 * DASHBOARD - CARD DE FEED DE ATIVIDADES
 * =================================================================== */
.activity-feed-card {
    background: var(--cor-surface);
    border-radius: var(--raio-borda);
    padding: 0;
    box-shadow: var(--sombra-suave);
    border: 1px solid var(--cor-borda);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Statistics page: no-data message highlight */
.stats-no-data {
    color: #b8860b; /* goldenrod-like yellow */
    background-color: rgba(184,134,11,0.06);
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}


/* Header com Tabs */
.card-header-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--cor-borda);
    padding: 0;
    background-color: var(--cor-surface);
    flex-wrap: wrap;
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

}

.card-header-tabs .feed-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    flex-wrap: wrap;
}

/* Tab Buttons */
.feed-tab-btn {
    background: none;
    border: none;
    padding: 14px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cor-texto-leve);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.feed-tab-btn:hover {
    color: var(--cor-primaria);
    background-color: rgba(59, 130, 246, 0.05);
}

.feed-tab-btn.active {
    color: var(--cor-primaria);
    border-bottom-color: var(--cor-primaria);
    font-weight: 600;
    background-color: rgba(59, 130, 246, 0.05);
}

/* Feed Controls */
.feed-controls input,
.feed-controls select,
.feed-controls button {
    height: 32px;
    border: 1px solid var(--cor-borda);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--cor-texto);
    background-color: var(--cor-surface);
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feed-controls input[type="date"] {
    width: 130px;
}

.feed-controls select {
    padding: 4px 8px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23606266' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px;
    padding-right: 28px;
}

.feed-controls button {
    width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-controls input:focus,
.feed-controls select:focus,
.feed-controls button:focus {
    outline: none;
    border-color: var(--cor-primaria);
    background-color: #fff;
}

.feed-controls button:hover {
    border-color: var(--cor-primaria);
    color: var(--cor-primaria);
    background-color: rgba(59, 130, 246, 0.05);
}

.feed-controls button.clear-btn {
    color: #e74c3c;
}

.feed-controls button.clear-btn:hover {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
}

/* Feed Content */
.feed-content-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.feed-list {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px;
}

.feed-list.active {
    display: flex;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.feed-item:hover {
    background-color: #fafafa;
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    background: #f0f2f5;
    color: var(--cor-secundaria);
}

.feed-icon.boss {
    background: #f3e5f5;
    color: #9b59b6;
}

.feed-icon.hunt {
    background: #e3f2fd;
    color: #3498db;
}

.feed-icon.split {
    background: #e8f5e9;
    color: #2ecc71;
}

.feed-icon.financial {
    background: #fff3e0;
    color: #f39c12;
}

.feed-icon.sale {
    background: #e8eef7;
    color: #3b82f6;
}

.feed-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.feed-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--cor-texto);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-date {
    font-size: 0.8rem;
    color: var(--cor-texto-leve);
}

.feed-value {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.feed-value.success {
    color: #2ecc71;
}

.feed-value.danger {
    color: #e74c3c;
}

/* ===================================================================
 * RESPONSIVIDADE
 * =================================================================== */
@media (max-width: 1200px) {
    .dashboard-hero-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-hero-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .hero-card {
        padding: 16px;
        gap: 12px;
    }
    
    .card-header-tabs {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-header-tabs > div:first-child {
        width: 100%;
        overflow-x: auto;
    }
    
    .feed-tab-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .card-header-tabs .feed-controls {
        width: 100%;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .dashboard-charts-grid {
        gap: 16px;
    }
    
    .chart-card {
        height: 280px;
        padding: 16px;
    }
    
    .stats-column {
        gap: 12px;
    }
    
    .stat-mini-card {
        padding: 12px;
        gap: 10px;
    }
}/* Ajuste para o conteúdo do feed não pular layout */
.feed-content-wrapper {
    min-height: 200px;
}

/* Split de Solo (Amarelo / Ouro) */
.feed-icon.solo-hunt {
    background: #fff8e1; /* Fundo Amarelo Claro */
    color: #1e293b;      /* Ícone Laranja/Dourado */
}


.sub-values {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9); /* Para o card primary */
    margin-top: 4px;
    font-weight: 500;
}

.hero-card:not(.primary) .sub-values {
    color: var(--cor-texto-leve);
}

.chart-toggle-btn {
    background: transparent;
    border: 1px solid var(--cor-borda);
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 5px;
    color: var(--cor-texto-leve);
    transition: all 0.2s;
}

.chart-toggle-btn:hover {
    background: #f0f0f0;
}

.chart-toggle-btn.active {
    background: var(--cor-primaria);
    color: white;
    border-color: var(--cor-primaria);
}

.empty-feed {
    padding: 20px;
    color: #999;
    text-align: center;
    font-size: 0.9rem;
}
/* ===================================================================
 * FIM: NOVO DASHBOARD
 * =================================================================== */

 /* ===================================================================
 * INÍCIO: PERFORMANCE RPG CARDS (NOVO)
 * =================================================================== */
.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); /* Cria colunas que preenchem a tela */
    gap: 24px;
    align-items: start;
}

.rpg-card {
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border: 2px solid #8b6914;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

/* Estilo VENCEDOR */
.rpg-card.winner {
    border-color: #28a745;
    box-shadow: 0 10px 25px rgba(40, 167, 69, 0.15);
    transform: translateY(-5px);
    z-index: 2;
}

.rpg-card.winner .rpg-card-header {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
}

.rpg-card.winner .rpg-card-header .text-muted {
    color: rgba(255,255,255, 0.8) !important;
}

.winner-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #FFD700; /* Ouro */
    color: #856404;
    padding: 5px 15px;
    font-size: 0.75rem;
    font-weight: 800;
    border-bottom-left-radius: 12px;
    box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rpg-card-header {
    background: #f8f9fc;
    padding: 20px;
    border-bottom: 1px solid #e3e6f0;
    text-align: center;
}

.profit-highlight {
    font-size: 2rem;
    font-weight: 800;
    margin: 10px 0;
    color: #2c3e50;
}
.rpg-card.winner .profit-highlight { color: #fff; }

.rpg-sub-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.player-rpg-row {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}
.player-rpg-row:last-child { border-bottom: none; }

.player-rpg-name {
    font-weight: 700;
    color: #4e73df;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.rpg-stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: #fafbfc;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #f1f1f1;
}

.rpg-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.rpg-stat-icon { font-size: 1.1rem; margin-bottom: 4px; }
.rpg-stat-value { font-weight: 700; font-size: 0.9rem; color: #333; }
.rpg-stat-label { font-size: 0.7rem; text-transform: uppercase; color: #aaa; font-weight: 600; }

/* Cores Semânticas RPG */
.color-gold { color: #f6c23e; }
.color-dmg { color: #e74a3b; }
.color-heal { color: #36b9cc; }
.color-supp { color: #858796; }

/* Responsividade Mobile */
@media (max-width: 768px) {
    .performance-grid { grid-template-columns: 1fr; }
}
/* ===================================================================
 * FIM: PERFORMANCE RPG CARDS
 * =================================================================== */

 
 /* --- ESTILOS DO SESSION ANALYSER (RPG THEME) --- */

/* Força o modal a aparecer quando ativo, sobrescrevendo estilos inline */
#split-details-modal.active {
    display: flex !important; /* Essencial para corrigir o bug do botão */
    opacity: 1;
    visibility: visible;
}

/* Card Principal */
.solo-session-card {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2d3748;
}

/* Cabeçalho */
.solo-header {
    display: flex;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.solo-icon-box {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.solo-title h5 {
    margin: 0;
    font-weight: 700;
    color: #2d3748;
    font-size: 1.2rem;
}

.solo-meta {
    font-size: 0.85rem;
    color: #718096;
    background: #edf2f7;
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 5px;
    display: inline-block;
}

/* GRID DE ESTATÍSTICAS (O Segredo do Alinhamento) */
.solo-stats-grid {
    display: grid;
    /* Use auto-fit to allow cards to wrap responsively without overflow */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

/* Responsividade para telas menores */
@media (max-width: 992px) {
    .solo-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 576px) {
    .solo-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Cards de Estatística */
.stat-card {
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border: 1px solid #8b6914;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 90px;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* Variações de Cor dos Cards */
.stat-card.xp { border-bottom: 3px solid #ecc94b; }
.stat-card.dmg { border-bottom: 3px solid #f56565; }
.stat-card.heal { border-bottom: 3px solid #4299e1; }
.stat-card.loot { background-color: #f0fff4; border-color: #c6f6d5; border-bottom: 3px solid #48bb78; }
.stat-card.supplies { background-color: #fff5f5; border-color: #fed7d7; border-bottom: 3px solid #f56565; }
.stat-card.balance-pos { background-color: #ebf8ff; border-color: #bee3f8; border-bottom: 3px solid #4299e1; }
.stat-card.balance-neg { background-color: #fffaf0; border-color: #feebc8; border-bottom: 3px solid #ed8936; }

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: #a0aec0;
    margin-bottom: 6px;
    display: block;
}

.stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: #2d3748;
    /* allow values to wrap/scale instead of forcing horizontal overflow */
    white-space: normal;
    word-break: break-word;
}

/* Cores de Texto */
.text-xp { color: #d69e2e; }
.text-dmg { color: #e53e3e; }
.text-heal { color: #3182ce; }
.text-loot { color: #2f855a; }
.text-waste { color: #c53030; }
.text-profit { color: #2b6cb0; }
.text-loss { color: #c05621; }

/* Layout das Tabelas (Lado a Lado) */
.solo-tables-container {
    display: flex;
    gap: 20px;
}

@media (max-width: 768px) {
    .solo-tables-container { flex-direction: column; }
}

.table-panel {
    flex: 1 1 0;
    min-width: 0; /* allow flex children to shrink and avoid overflow */
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border: 1px solid #8b6914;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Ensure tables inside panels can shrink without forcing modal width */
.table-panel .table-scroll-area { min-width: 0; }

/* When displayed inside the split details modal, style adjustments to avoid horizontal overflow */
#split-details-modal .solo-stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
#split-details-modal .solo-tables-container { gap: 12px; }

.table-panel-header {
    padding: 10px 15px;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.table-panel-header.monsters { background-color: #2d3748; color: #fff; }
.table-panel-header.items { background-color: #ecc94b; color: #744210; }

.table-scroll-area {
    max-height: 300px;
    overflow-y: auto;
}

.rpg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.rpg-table tr:nth-child(even) { background-color: #f7fafc; }
.rpg-table td { padding: 8px 12px; border-bottom: 1px solid #edf2f7; }
.rpg-table td.qty-col { text-align: right; font-weight: 700; font-family: 'Consolas', monospace; width: 80px; }

/* ===================================================================
 * STATISTICS - TABELA DE VENDAS MELHORADA
 * =================================================================== */

.statistics-table {
    width: 100%;
    border-collapse: collapse;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    font-size: 0.95rem;
    margin-top: 12px;
}

.statistics-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
}

.statistics-table thead th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    color: #ecf0f1;
}

.statistics-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: all 0.2s ease;
}

.statistics-table tbody tr:hover {
    background-color: #ecf0f1 !important;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.statistics-table tbody td {
    padding: 14px 12px;
    vertical-align: middle;
    color: #2c3e50;
}

/* Coluna de Item com Imagem */
.statistics-table tbody td:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: #2c3e50;
}

.statistics-table img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: #ecf0f1;
    object-fit: contain;
    padding: 2px;
    flex-shrink: 0;
}

/* Coluna de Faturamento - Destaque em Verde */
.statistics-table tbody td:nth-child(2) {
    font-weight: 700;
    font-size: 1.1rem;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.08);
    text-align: center;
}

/* Coluna de Quantidade */
.statistics-table tbody td:nth-child(3) {
    font-weight: 600;
    color: #34495e;
    background: rgba(52, 73, 94, 0.05);
    text-align: center;
}

/* Coluna de Preço Médio */
.statistics-table tbody td:nth-child(4) {
    font-weight: 600;
    color: #2980b9;
    text-align: center;
}

/* Coluna de Faixa de Preço */
.statistics-table tbody td:nth-child(5) {
    font-weight: 600;
    font-size: 0.95rem;
    color: #7f8c8d;
    text-align: center;
}

/* Coluna de Último Preço */
.statistics-table tbody td:nth-child(6) {
    font-weight: 700;
    color: #e67e22;
    background: rgba(230, 126, 34, 0.08);
    text-align: center;
}

/* Coluna de Média de Dias */
.statistics-table tbody td:nth-child(7) {
    font-weight: 600;
    color: #8e44ad;
    text-align: center;
}

/* Responsividade para Telas Pequenas */
@media (max-width: 1024px) {
    .statistics-table {
        font-size: 0.9rem;
    }
    
    .statistics-table thead th,
    .statistics-table tbody td {
        padding: 12px 10px;
    }
    
    .statistics-table img {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 768px) {
    .statistics-table {
        font-size: 0.85rem;
    }
    
    .statistics-table thead th,
    .statistics-table tbody td {
        padding: 10px 8px;
    }
    
    .statistics-table img {
        width: 24px;
        height: 24px;
    }
    
    .statistics-table tbody td:nth-child(2),
    .statistics-table tbody td:nth-child(6) {
        background: none !important;
    }
}

/* Estilos para Item Details Container */
#stats-item-details-container {
    margin-top: 32px;
    animation: slideUp 0.3s ease;
}

#stats-item-details-container.hidden {
    display: none;
}

/* Item Details Section - Layout Principal */
.item-details-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header da Análise Detalhada */
.item-details-header {
    background: linear-gradient(135deg, #8b6914 0%, #a87e1c 100%);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(139, 105, 20, 0.2);
    margin-bottom: 12px;
}

/* Header Content - Flex para alinhar imagem e título */
.item-details-header .header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Image do Item */
.item-details-header .item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
    display: none;
}

.item-details-header .item-image:hover {
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
    transform: scale(1.05);
}

.item-details-header h2 {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Seção de Estatísticas */
.item-details-stats {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Sobrescrever o dashboard-cards para item details */
.item-details-stats .dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.item-details-stats .card {
    background: linear-gradient(135deg, var(--cor-surface) 0%, rgba(255, 255, 255, 0.8) 100%);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.item-details-stats .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.item-details-stats .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.item-details-stats .card:hover::before {
    transform: scaleX(1);
}

.item-details-stats .card-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.75rem;
}

.item-details-stats .card-icon i {
    color: #fff;
    font-size: 1.75rem;
}

.item-details-stats .card-info {
    flex: 1;
}

.item-details-stats .card-title {
    font-size: 0.85rem;
    color: var(--cor-texto-leve);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.item-details-stats .card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--cor-texto);
    margin: 0;
    word-break: break-word;
}

/* Seção do Gráfico de Distribuição */
.item-details-chart-section {
    background: var(--cor-surface);
    border: 1px solid var(--cor-borda);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cor-texto);
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Price Distribution Chart */
.price-distribution-container {
    padding: 20px 0;
}

.price-range-bar {
    position: relative;
    height: 120px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 32px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.price-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-line {
    width: 2px;
    height: 30px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    margin-bottom: 8px;
    border-radius: 1px;
}

.price-marker.min .marker-line,
.price-marker.max .marker-line {
    background: #bdc3c7;
    opacity: 0.6;
}

.marker-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--cor-texto-leve);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.marker-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cor-texto);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.price-marker.avg .marker-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.price-marker.last .marker-value {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    border: none;
}

.price-marker.last-is-close-to-max {
    flex-direction: column-reverse;
}

.price-marker.last-is-close-to-max .marker-line {
    margin-bottom: 0;
    margin-top: 8px;
}

/* Preço Fixo - Sem Variação */
.price-range-bar.price-fixed {
    background: linear-gradient(180deg, rgba(39, 174, 96, 0.05) 0%, rgba(34, 153, 84, 0.08) 100%);
    border: 1px solid rgba(39, 174, 96, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.fixed-price-indicator {
    width: 100%;
    text-align: center;
    animation: slideUp 0.4s ease-out;
}

.fixed-price-indicator::before {
    content: '✓';
    display: block;
    font-size: 2rem;
    color: #27ae60;
    margin-bottom: 12px;
    opacity: 0.8;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Melhorias no Filter Form */
.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.filter-form .form-group {
    display: flex;
    flex-direction: column;
}

.filter-form .form-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.filter-form .form-group select,
.filter-form .form-group input {
    padding: 10px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.filter-form .form-group select:focus,
.filter-form .form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.filter-form .button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-form .button-group .period-btn {
    flex: 1;
    min-width: 80px;
}

#mode-unavailable {
    display: none;
    color: #e74c3c;
    margin-top: 6px;
    font-size: 0.9rem;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
    border-radius: 4px;
}

#mode-unavailable.show {
    display: block;
}
/* Animação para os cards de análise detalhada */
@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-animate {
    animation: cardAppear 0.5s ease-out forwards;
}

/* Media queries para telas menores */
@media (max-width: 768px) {
    .item-details-header {
        padding: 16px;
    }
    
    .item-details-header .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .item-details-header .item-image {
        width: 64px;
        height: 64px;
    }
    
    .item-details-header h2 {
        font-size: 1.35rem;
    }
    
    .item-details-stats .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .item-details-chart-section {
        padding: 16px;
    }
    
    .price-range-bar {
        padding: 16px;
        height: 100px;
    }
}

/* ===================================================================
 * PERFORMANCE - Solo results background & spacing tweaks
 * Applies only when a Solo analysis was requested (class added dynamically)
 * =================================================================== */
/* Card wrapper: slightly warm off-white, more padding and subtle border when data-perf-type=solo */
#performance-results-container[data-perf-type="solo"] > * {
    background: #fffefb !important;
    color: #1f1f1f !important;
    padding: 22px !important;
    border-radius: 10px !important;
    border: 1px solid #ececec !important;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06) !important;
}

/* Force wrapper to neutralize inline backgrounds from bundle */
.solo-result-forced{
    background: #fffefb !important;
    padding: 18px !important;
    border-radius: 8px !important;
}
.solo-result-forced *{
    background: transparent !important;
    color: inherit !important;
}

/* Keep inner elements layout-compatible but ensure readable text */
#performance-results-container[data-perf-type="solo"] .info-box,
#performance-results-container[data-perf-type="solo"] .solo-card,
#performance-results-container[data-perf-type="solo"] table,
#performance-results-container[data-perf-type="solo"] .solo-stats {
    background: transparent !important;
    color: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure small labels/values are dark and slightly larger for readability */
#performance-results-container[data-perf-type="solo"] .stat-label,
#performance-results-container[data-perf-type="solo"] td.stat-label {
    color: #333 !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}
#performance-results-container[data-perf-type="solo"] .stat-value,
#performance-results-container[data-perf-type="solo"] td.stat-value {
    color: #0b5f3a !important;
    font-weight: 700 !important;
    font-size: 1.02rem !important;
}

/* Tables and cells readable */
#performance-results-container[data-perf-type="solo"] td,
#performance-results-container[data-perf-type="solo"] th {
    color: #222 !important;
}

/* Highlight the personagem name in Solo results */
#performance-results-container[data-perf-type="solo"] .solo-title h5,
#performance-results-container[data-perf-type="solo"] .char-name,
#performance-results-container[data-perf-type="solo"] .player-name,
#performance-results-container[data-perf-type="solo"] .solo-header h5,
#performance-results-container[data-perf-type="solo"] .card-title {
    color: #ffd700 !important; /* gold/yellow */
    text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}