/* Estilos mínimos para la página de Markets */

#markets-overview { margin-bottom: 1.5rem; }

#markets-placeholder {
    padding: 2rem;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.03);
}

/* Grid y tarjetas */
.grid {
    display: block;
    width: 100%;
    gap: 14px;
}

.card {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.03);
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
    width: 100%;
    margin-bottom: 14px;
}

.card-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}

.card-header { cursor: pointer; }

.card-title{
    margin:0;
    font-size:1rem;
    font-weight:700;
    color:#e6e6e6;
}

.card-meta{
    font-size:0.85rem;
    color:#bdbdbd;
}

/* Contenedor a la derecha de la cabecera: fecha y badge */
.card-rightmeta{
    display:flex;
    align-items:center;
    gap:10px;
    justify-content:flex-end;
}

.card-date{
    font-size:0.9rem;
    color:#cfcfcf;
    white-space:nowrap;
}

/* Wrapper that agrupa la zona derecha (fecha + badge + arrow) */
.card-rightwrap{
    display:flex;
    align-items:center;
    gap:12px;
}

.card-body{
    margin-top:10px;
    overflow: hidden;
    transition: all 0.15s ease;
}

.card.collapsed .card-body{
    display: none; /* hide entirely when collapsed */
}

.toggle-arrow{
    margin-left:12px;
    color:#9fbf9f;
    cursor:pointer;
    user-select:none;
}

.market-link{
    color:#9fbf9f;
    text-decoration:none;
    font-weight:600;
}

.runner-row{ display:flex; justify-content:space-between; padding:6px 0; border-bottom: 1px solid rgba(255,255,255,0.02);} 
.runner-name{ color:#e6e6e6 }
.runner-right{ color:#cfcfcf }

/* Table for runners */
.runners-table{
    width:100%;
    border-collapse: collapse;
    margin-top:6px;
}
.runners-table thead th{
    text-align:center;
    font-size:0.85rem;
    color:#bdbdbd;
    padding:8px 6px;
    border-bottom:1px solid rgba(255,255,255,0.03);
}
.runners-table tbody td{
    padding:8px 6px;
    font-size:0.95rem;
    color:#e6e6e6;
    vertical-align:middle;
    text-align:center; /* center all column contents */
}
.runners-table tbody td.num{ text-align:center; color:#cfcfcf; }
.runners-table tbody td.ev-positive{ color:#30a14e; font-weight:700; }
.runners-table tbody td.ev-negative{ color:#ff6b6b; font-weight:700; }

/* Highlight entire row when a selection is a WINNER */
.runners-table tbody tr.row-winner{ 
    background-color: rgba(48,161,78,0.06); /* very light green */
}

/* Ensure each cell also gets the light background to override other td rules */
.runners-table tbody tr.row-winner td{
    background-color: rgba(48,161,78,0.06);
}

/* Market id badge style */
.market-badge{
    display:inline-block;
    background: #ecab0f; /* mustard yellow */
    color: #1a1a1a; /* dark text */
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    margin-left: 8px;
}

/* Filtros */
.filters-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1rem 0 2rem 0;
}

.filter-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: #e0e0e0;
    font-weight: 600;
}

.filter-select {
    /* Estilo igualado al esquema de `historico` (colores, bordes y tamaños) */
    min-width: 220px;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-weight: 600;
}

.filter-select:focus {
    outline: none;
    border-color: #30a14e;
    box-shadow: 0 6px 18px rgba(48,161,78,0.12);
}

/* Hacer que el placeholder tenga color más suave */
.filter-select option[value=""] { color: #9a9a9a; }

/* Dropdown-style select (imitando historico) */
.dropdown-select {
    position: relative;
}

.dropdown-select-button {
    min-width: 220px;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: transparent;
    color: #e0e0e0;
    border: 1px solid #333;
    text-align: left;
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    /* Quitar el espacio entre botón y menú para evitar un gap donde el mouse se "pierde" */
    top: 100%;
    left: 0;
    right: 0;
    background: #0f0f0f;
    border: 1px solid #222;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 1100;
    max-height: 260px;
    overflow-y: auto;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-menu-item {
    padding: 12px 14px;
    color: #e0e0e0;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    cursor: pointer;
}

.dropdown-menu-item:hover,
.dropdown-menu-item.selected {
    background: #16321f; /* verde oscuro parecido al historico */
    color: #30a14e;
}

/* scrollbar más discreto */
.dropdown-menu::-webkit-scrollbar { width: 10px; }
.dropdown-menu::-webkit-scrollbar-thumb { background: #222; border-radius: 6px; }
.dropdown-menu::-webkit-scrollbar-track { background: transparent; }

/* Botones de filtro que imitan el estilo de los items del dropdown */
.filters-buttons { display:flex; gap:8px; align-items:center; }
.filter-button {
    padding: 10px 12px;
    border-radius: 6px;
    background: #0f0f0f;
    color: #e0e0e0;
    border: 1px solid rgba(255,255,255,0.02);
    cursor: pointer;
    font-weight: 600;
}
.filter-button:hover { background: #16321f; color: #30a14e; }
.filter-button.active { background: #16321f; color: #30a14e; border-color: #16321f; }

/* Textbox estilo coherente con otros controles */
.filter-textbox {
    min-width: 180px;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-weight: 600;
}

.filter-textbox:focus {
    outline: none;
    border-color: #30a14e;
    box-shadow: 0 6px 18px rgba(48,161,78,0.12);
}

/* Paginación de markets */
.markets-pagination{
    display:flex;
    align-items:center;
    gap:10px;
    justify-content:center;
    margin: 10px 0 18px 0;
}

.btn-page{
    background: linear-gradient(180deg,#16321f,#0f2416);
    color: #e6f5ea;
    border: 1px solid rgba(48,161,78,0.18);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    min-width: 78px;
}
.btn-page:hover{ background: linear-gradient(180deg,#1d4b2a,#13341f); }
.btn-page:disabled{ opacity: 0.45; cursor: default; }

.page-info{ color: #cfcfcf; font-weight:600; }

/* Small responsive tweak */
@media (max-width: 720px){
    .markets-pagination{ gap:8px; }
    .btn-page{ padding: 8px 10px; min-width: 64px; }
}

/* Botón flotante "Ir arriba" */
.btn-scroll-top{
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(180deg,#16321f,#0f2416);
    color: #e6f5ea;
    border: 1px solid rgba(48,161,78,0.18);
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 1200;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms ease, transform 200ms ease;
}
.btn-scroll-top.visible{ opacity: 1; transform: translateY(0); }
.btn-scroll-top:hover{ background: linear-gradient(180deg,#1d4b2a,#13341f); }
.btn-scroll-top:focus{ outline: none; box-shadow: 0 0 0 4px rgba(48,161,78,0.12); }

@media print{ .btn-scroll-top{ display:none !important; } }
