/* Importació i definició de la tipografia Roboto per defecte */
.rh-graella-wrapper,
.rh-graella-wrapper * {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

.rh-graella-wrapper {
    max-width: 960px;
    margin: 20px auto;
}

/* --- Pestanyes Navegació per Dies --- */
.rh-tabs-container {
    display: flex;
    flex-wrap: nowrap; /* Força 1 sola línia */
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
    overflow-x: auto; /* Activa el desplaçament horitzontal si falta espai */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Scroll suau en dispositius iOS */
    scrollbar-width: thin; /* Scrollbar prim per Firefox */
    scrollbar-color: #fe6800 #f1f1f1;
}

/* Personalització del scrollbar per a Chrome/Safari/Edge */
.rh-tabs-container::-webkit-scrollbar {
    height: 5px;
}
.rh-tabs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.rh-tabs-container::-webkit-scrollbar-thumb {
    background: #fe6800;
    border-radius: 4px;
}

.rh-tab-btn {
    flex: 1 1 0px; /* Reparteix l'espai per igual en pantalles de PC */
    min-width: fit-content;
    white-space: nowrap; /* Evita que el text del dia es pateixi en dues línies */
    background-color: #f8f9fa;
    color: #000000; /* Text NEGRE en repòs */
    border: 1px solid #e9ecef;
    border-bottom: none;
    outline: none;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease-in-out;
}

.rh-tab-btn:hover {
    background-color: #fe6800; /* Fons taronja corporatiu en hover */
    color: #ffffff; /* Text BLANC al passar el punter */
    border-color: #fe6800;
}

.rh-tab-btn.active {
    background-color: #fe6800;
    color: #ffffff;
    border-color: #fe6800;
    font-weight: 700;
    box-shadow: 0 -2px 6px rgba(254, 104, 0, 0.15);
}

.rh-tab-btn.is-today {
    position: relative;
}

.rh-tab-btn.is-today::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: #2e7d32;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

.rh-tab-btn:hover.is-today::after,
.rh-tab-btn.active.is-today::after {
    background-color: #ffffff;
}

/* --- Seccions de Dia --- */
.rh-dia-seccio {
    display: none;
}

.rh-dia-seccio.active {
    display: block;
    animation: rhFadeIn 0.3s ease-in-out;
}

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

.rh-dia-titol {
    display: none; 
    background-color: #212529;
    color: #ffffff;
    padding: 12px 20px;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 15px 0;
    border-left: 5px solid #fe6800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 0 4px 4px 0;
}

.rh-llista-programes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rh-sense-programes {
    padding: 24px;
    background-color: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    color: #6c757d;
    text-align: center;
    font-style: italic;
    font-size: 0.95rem;
}

/* --- Targeta de Programa --- */
.rh-programa-card {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px 20px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.rh-hora-badge {
    min-width: 145px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.rh-hora {
    font-weight: 700;
    font-size: 0.92rem;
    color: #fe6800;
    background: #fff4ec;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #fe6800;
}

.rh-info-programa {
    margin-left: 20px;
    flex-grow: 1;
}

.rh-titol-programa {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #212529;
}

.rh-desc-programa {
    margin: 0;
    font-size: 0.92rem;
    color: #495057;
    line-height: 1.5;
}

/* Indicador EN DIRECTE */
.rh-live-badge {
    display: none;
    background-color: #fe6800;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: rhPulsar 1.5s infinite;
}

/* --- RESSALTAT EN DIRECTE --- */
.rh-programa-card.is-live {
    background-color: #ffffff;
    border: 2px solid #fe6800;
    box-shadow: 0 4px 18px rgba(254, 104, 0, 0.22);
    transform: scale(1.01);
}

.rh-programa-card.is-live::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background-color: #fe6800;
}

.rh-programa-card.is-live .rh-hora {
    background-color: #fe6800;
    color: #ffffff;
}

.rh-programa-card.is-live .rh-live-badge {
    display: inline-block;
}

.rh-programa-card {
  background-color: #E5E5E5;
}


@keyframes rhPulsar {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Adaptacions Responsive (Mòbil i tauletes petites) */
@media (max-width: 768px) {
    .rh-tab-btn {
        flex: 0 0 auto;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 650px) {
    .rh-programa-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .rh-info-programa {
        margin-left: 0;
        margin-top: 12px;
    }
}
