/* ============================================================
   TURFE v5.1 — Local e data na mesma linha, fonte maior
   ============================================================ */

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

:root {
    --sidebar-w: 220px;
    --font-dados: 10px;
    --font-header: 10px;
    --font-label: 11px;
    --font-titulo: 13px;
    --font-programa: 12px;      /* AUMENTADO: era 11px */
    --font-programa-data: 11px;   /* AUMENTADO: era 9px */
    --pad-celula: 2px 4px;
    --pad-header: 3px 4px;
    --h-linha: 18px;
    --color-sidebar: #2d2d2d;
    --color-sidebar-ativo: #404040;
    --color-header-tab: #1a3a5c;
    --color-bg: #e8e8e8;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #666666;
    --color-border: #b0b0b0;
    --color-border-light: #d0d0d0;
    --color-zebra: #f5f5f5;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: var(--font-dados);
    line-height: 1.2;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    background-color: var(--color-sidebar);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 10;
    border-right: 1px solid #555;
}

.sidebar-header {
    padding: 6px 8px;
    border-bottom: 1px solid #555;
    flex-shrink: 0;
    background: #1a1a1a;
}

.brand {
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-logo { font-size: 20px; line-height: 1; }

.brand-text h1 {
    font-size: var(--font-titulo);
    font-weight: 700;
    line-height: 1.2;
}

.brand-text span {
    font-size: 9px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 4px;
}

.nav-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.tab {
    flex: 1;
    padding: 3px 6px;
    background: #404040;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ddd;
    font-size: var(--font-label);
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    text-align: center;
}

.tab:hover:not(:disabled) { background: #505050; }

.tab--active {
    background: #e94560 !important;
    border-color: #e94560 !important;
    color: #fff !important;
}

.tab--disabled { opacity: 0.4; cursor: not-allowed; }

.filtro-rapido {
    margin-bottom: 4px;
    flex-shrink: 0;
}

.filtro-rapido input {
    width: 100%;
    padding: 3px 6px;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #fff;
    font-size: var(--font-label);
}

.filtro-rapido input::placeholder { color: #888; }
.filtro-rapido input:focus { outline: none; border-color: #e94560; }

/* Lista de Programas */
.lista-programas {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lista-programas::-webkit-scrollbar { width: 4px; }
.lista-programas::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

/* ============================================================
   CARD DE PROGRAMA — Local e data na MESMA LINHA
   ============================================================ */
.card-programa {
    display: flex;
    flex-direction: row;          /* MUDANÇA: era column, agora row */
    align-items: center;            /* Alinha verticalmente ao centro */
    gap: 4px;                     /* Espaço entre local e data */
    padding: 4px 6px;             /* Aumentado levemente */
    background: #383838;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    transition: 0.15s;
    text-align: left;
    position: relative;
    flex-shrink: 0;
    flex-wrap: wrap;              /* Permite quebrar se não couber */
}

.card-programa:hover {
    background: #484848;
    border-color: #555;
}

.card-programa--selecionado {
    background: #4a2030 !important;
    border-color: #e94560 !important;
}

/* Nome do hipódromo — fonte maior, na mesma linha */
.programa-hipodromo {
    font-size: var(--font-programa);    /* 12px — AUMENTADO 2pts */
    font-weight: 700;                  /* Mais peso para destacar */
    color: #eee;
    line-height: 1.2;
    white-space: nowrap;               /* Não quebra linha */
}

/* Data — fonte maior, ao lado do local, com separador */
.programa-data {
    font-size: var(--font-programa-data);  /* 11px — AUMENTADO 2pts */
    color: #bbb;                           /* Mais visível que #aaa */
    font-weight: 500;
    white-space: nowrap;
}

/* Separador visual entre local e data */
.programa-data::before {
    content: '•';                          /* Bullet como separador */
    color: #666;
    margin-right: 4px;
    font-size: 9px;
}

.sidebar-footer {
    padding: 4px 8px;
    border-top: 1px solid #555;
    text-align: center;
    flex-shrink: 0;
    background: #1a1a1a;
}

.contador {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
}

/* ============================================================
   CONTEÚDO PRINCIPAL
   ============================================================ */
.conteudo {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    min-width: 0;
}

.content-header { flex-shrink: 0; }

.content-header__placeholder {
    background: #ddd;
    border: 1px dashed #bbb;
    border-radius: 3px;
    padding: 4px 8px;
    text-align: center;
    color: #888;
    font-size: var(--font-label);
}

/* ============================================================
   PAINÉIS
   ============================================================ */
.painel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.painel--pareos { flex-shrink: 0; }
.painel--retrospecto { flex-shrink: 0; }

.painel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 6px;
    background: linear-gradient(180deg, #2a4a6a 0%, #1a3a5c 100%);
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    border-bottom: 1px solid #0a2a4c;
}

.painel__titulo {
    display: flex;
    align-items: center;
    gap: 4px;
}

.painel__icon { font-size: 14px; }

.painel__titulo h2 {
    font-size: var(--font-titulo);
    font-weight: 700;
}

.painel__subtitulo {
    font-size: 9px;
    color: #ccc;
    margin-left: 4px;
    padding-left: 4px;
    border-left: 1px solid #4a6a8a;
}

.painel__toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 2px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.painel__toggle svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.painel--colapsado .painel__toggle svg { transform: rotate(-90deg); }

.painel__body { padding: 2px; }
.painel--colapsado .painel__body { display: none; }

/* ============================================================
   TABELAS
   ============================================================ */
.tabela-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
}

.tabela-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-dados);
    table-layout: auto;
}

.tabela-wrapper thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.tabela-wrapper th {
    background: linear-gradient(180deg, #3a5a7a 0%, #2a4a6a 100%);
    color: #ffffff;
    padding: var(--pad-header);
    text-align: left;
    font-weight: 700;
    font-size: var(--font-header);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    border-right: 1px solid #4a6a8a;
    border-bottom: 1px solid #1a3a5c;
    line-height: 1.2;
}

.tabela-wrapper th:last-child { border-right: none; }

.tabela-wrapper td {
    padding: var(--pad-celula);
    border-right: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
    vertical-align: middle;
    white-space: nowrap;
    line-height: var(--h-linha);
    height: var(--h-linha);
}

.tabela-wrapper td:last-child { border-right: none; }

.tabela-wrapper tbody tr:nth-child(even) { background-color: var(--color-zebra); }
.tabela-wrapper tbody tr:hover { background-color: #e0e8f0; }

.linha-clicavel { cursor: pointer; }
.linha-clicavel:hover { background-color: #d0e0f0 !important; }
.linha-clicavel td:first-child { font-weight: 700; color: #1a3a5c; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.badge--bolsa {
    background: #fff8e1;
    color: #c77700;
    border: 1px solid #ffe0b2;
}

.badge--raia {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    letter-spacing: 0.5px;
    padding: 1px 3px;
}

.badge--numero {
    background: #1a3a5c;
    color: #ffffff;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    font-size: 9px;
}

/* ============================================================
   ÁREA DE ANÁLISE
   ============================================================ */
.area-analise {
    margin-top: 2px;
    padding: 4px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    background: #f0f0f0;
}

.btn-analise {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(180deg, #e94560 0%, #c73e54 100%);
    color: #ffffff;
    border: 1px solid #b03045;
    border-radius: 3px;
    padding: 3px 10px;
    font-size: var(--font-label);
    font-weight: 700;
    cursor: pointer;
    transition: 0.15s;
    line-height: 1.2;
}

.btn-analise:hover { background: linear-gradient(180deg, #f05570 0%, #d74e64 100%); }
.btn-analise::before { content: '📊'; font-size: 12px; }

/* ============================================================
   ESTADOS VAZIO
   ============================================================ */
.estado-vazio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    color: var(--color-text-muted);
    gap: 4px;
}

.estado-vazio--large {
    padding: 30px 20px;
    min-height: 120px;
}

.estado-vazio__icon { font-size: 32px; line-height: 1; opacity: 0.5; }
.estado-vazio h3 { font-size: var(--font-label); color: var(--color-text-secondary); font-weight: 600; }
.estado-vazio p { font-size: var(--font-dados); max-width: 300px; line-height: 1.4; }

/* Responsividade */
@media (max-width: 768px) {
    .sidebar { width: 100%; position: relative; top: auto; left: auto; bottom: auto; height: auto; max-height: 40vh; }
    .conteudo { margin-left: 0; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.painel, .card-programa { animation: fadeIn 0.2s ease; }
