:root {
    --primary: #d40f0f;
    --secondary: #990707;
    --topbar-h: 36px;
    --navbar-h: 70px;

    /* z-index scale (antes hardcodeado en cada regla) */
    --z-mega-panel: 2000;
    --z-mobile-menu: 3000;
    --z-navbar: 3500;
    --z-topbar: 4000;
    --z-logo: 5000;
}

/* =========================
   BASE
========================= */

body {
    padding-top: calc(var(--topbar-h) + var(--navbar-h));
    font-family: Inter, Arial, sans-serif;
    background: #f8f9fa;
}

/* =========================
   HEADER & NAVBAR
========================= */

/* TOP BAR */
.bg-dark.fixed-top {
    height: var(--topbar-h);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-topbar);
}

/* NAVBAR */
nav.navbar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    z-index: var(--z-navbar);
    min-height: var(--navbar-h);
    display: flex;
    align-items: center;
    background: var(--primary);
}

/* LINKS */
.navbar.bg-custom .nav-link {
    color: #fff !important;
    font-weight: 500;
}

.navbar.bg-custom .nav-link:hover {
    color: #000 !important;
}

/* =========================
   LOGO (ESTABLE)
========================= */

.logo-container {
    display: flex;
    align-items: center;
    min-height: var(--navbar-h);
    padding-left: 85px;
}

.logo-badge {
    position: absolute;
    left: 50px;
    top: 30px;
    z-index: var(--z-logo);
}

.logo-badge img {
    height: 100px;
    width: auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.25));
}

/* HAMBURGUESA */
.navbar-toggler {
    border: 0;
    box-shadow: none !important;
}

/* =========================
   MEGA MENU (ESCRITORIO)
========================= */

.mega-parent {
    position: relative;
}

.mega-panel {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: #fff;
    border-top: 3px solid var(--primary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: .2s ease;
    z-index: var(--z-mega-panel);
}

.mega-panel a {
    display: block;
    padding: 8px 0;
    padding-left: 15px;
    color: #222;
    text-decoration: none;
}

.mega-panel a:hover {
    color: var(--primary);
}

@media (min-width: 992px) {
    .mega-parent:hover .mega-panel {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* =========================
   HERO & COMPONENTS
========================= */

.hero-box {
    min-height: 640px;
    position: relative;
}

.hero-main-img {
    width: 100%;
    height: 640px;
    object-fit: cover;
    display: block;
    object-position: center 20%;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.4) 30%,
        rgba(0, 0, 0, 0) 60%
    );
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: #fff;
}

/* MATCH COMPONENTS */
.match-box {
    padding: 12px !important;
}

.match-shield {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* GRID NEWS */
.grid-news-img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    object-position: center 15%;
}

/* TITLES */
.section-title {
    font-size: 2rem;
    font-weight: bold;
    border-bottom: 2px solid #ddd;
    display: inline-block;
    margin-bottom: 20px;
}

/* =========================
   NEXT MATCH BAR
========================= */

.next-match-bar {
    width: 100%;
    background: var(--secondary);
    color: #fff;
    padding: 12px 0;
}

.next-match-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.match-teams-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.match-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.vs-mini {
    font-weight: 700;
}

.match-info {
    flex: 1;
    text-align: center;
    line-height: 1.2;
}

.match-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    opacity: 0.5;
}

.match-teams-text {
    font-size: 26px;
    font-weight: 600;
}

.team-home,
.team-away {
    display: inline;
}

.match-date {
    font-size: 18px;
    opacity: 0.9;
}

.match-cta {
    min-width: 140px;
    text-align: right;
}

.btn-match {
    background: #000;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    font-size: 18px;
    display: inline-block;
}

.btn-match:hover {
    color: #adababcb;
}

.article-custom a {
     text-decoration: none;
     color: #d40f0f;
}

/* =========================
   AGENDA
========================= */

/* CONTENEDOR GENERAL */
.schedule-table {
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 18px;
    padding: 14px 18px;
    margin-bottom: 14px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.schedule-table:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* CUANDO YA ESTÁ AÑADIDO */
.schedule-table.added {
    background: #f5f5f5;
    border-color: #dcdcdc;
    opacity: 0.92;
}

/* FECHA */
.date-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 28px 0 18px;
    color: #111;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* HORA */
.schedule-time {
    font-size: 0.9rem;
    font-weight: 700;
    color: #666;
    background: #f3f3f3;
    padding: 5px 12px;
    display: inline-block;
}

/* COMPETICIÓN */
.schedule-competition {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    padding: 5px 12px;
    letter-spacing: 0.3px;
}

/* EQUIPOS */
.schedule-teams {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111;
    line-height: 1.3;
}

/* VS */
.schedule-vs {
    color: #999;
    font-weight: 500;
    margin: 0 6px;
    font-size: 0.85rem;
}

/* PABELLÓN */
.schedule-pavilion {
    font-size: 1rem;
    color: #777;
    margin-top: 2px;
}

/* BOTÓN GOOGLE */
.btn-google {
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-google:hover {
    transform: scale(1.03);
}

/* BOTÓN AÑADIDO */
.schedule-table.added .btn-google {
    background: #dcdcdc;
    border-color: #dcdcdc;
    color: #555;
}

.dorsal-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    min-width: 50px;
    min-height: 50px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background-color: #000000;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    z-index: 2;
}

.news-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: center 20%;
}

.hover-shadow {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* Toggle desktop/mobile del bloque de partido */
.match-mobile {
    display: none;
}

/* =========================
   RESPONSIVE — breakpoint único: 768px
   (antes había 768 / 767 / 991 repartidos y duplicados)
========================= */

@media (max-width: 991px) {
    .navbar-collapse {
        position: fixed;
        top: calc(var(--topbar-h) + var(--navbar-h));
        left: 0;
        right: 0;
        max-height: calc(100vh - var(--topbar-h) - var(--navbar-h));
        overflow-y: auto;
        background: #fff;
        z-index: var(--z-mobile-menu);
        padding: 15px 20px;
        box-shadow: 0 10px 25px rgba(0,0,0,.08);
    }

    .navbar-nav .nav-link {
        color: #111 !important;
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }

    .navbar.bg-custom .nav-link {
        color: #111 !important;
    }

    .navbar.bg-custom .nav-link:hover {
        color: var(--primary) !important;
    }

    .logo-container {
        padding-left: 70px;
    }

    .logo-badge img {
        height: 70px;
    }

    .logo-badge {
        top: 25px;
        left: 20px;
    }

    .mega-panel {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none !important;
        border-top: none;
        display: none;
        padding-left: 15px;
        background: #fdfdfd;
    }

    .mega-parent.open .mega-panel {
        display: block !important;
    }

    .mega-panel a {
        border-bottom: 1px solid #f1f1f1;
    }
}

@media (max-width: 768px) {
    .hero-box {
        min-height: 390px;
    }

    .hero-main-img {
        height: 390px;
    }

    .match-title {
        font-size: 12px;
    }

    .next-match-bar-inner {
        flex-direction: column;
        text-align: center;
    }

    .match-logo {
        width: 70px;
        height: 70px;
        object-fit: contain;
    }

    .match-cta,
    .match-info {
        text-align: center;
    }

    .match-teams-text {
        font-size: 18px;
        line-height: 1.25;
    }

    .match-competition-round {
        font-size: 12px;
    }
    .team-home,
    .team-away {
        display: block;
    }

    .team-separator {
        display: none;
    }

    .team-away::before {
        content: "vs ";
    }

    .schedule-table {
        padding: 12px 14px;
        border-radius: 14px;
    }

    .schedule-teams {
        font-size: 1.2rem;
    }

    .schedule-competition {
        font-size: 0.85rem;
    }

    .btn-google {
        width: 100%;
        margin-top: 8px;
    }

    .news-img {
        height: 180px;
    }

    .match-desktop {
        display: none;
    }

    .match-mobile {
        display: block;
    }
}