/* =========================
   1. VARIABLES Y RESET
========================= */
:root {
    --yellow: #FFD200;
    --dark: #333333;
    --gray: #777777;
    --white: #ffffff;
    --bg-light: #f7f7f7;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 15px 35px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-light);
    color: var(--dark);
    line-height: 1.6;
    padding-top: 90px;
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
}

/* =========================
   2. HEADER
========================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    z-index: 1000;
    padding: 10px 0;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.logo img {
    height: 55px;
    width: auto;
    display: block;
}

.menu {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 35px;
}

.menu a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    font-size: 16px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.menu a:hover {
    color: var(--yellow);
    transform: translateY(-2px);
}

.btn-primary {
    background-color: rgba(0, 0, 0, 0.78);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    border: 2px solid rgba(0, 0, 0, 0.65);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.18);
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary:hover {
    background-color: var(--yellow);
    color: #000;
    border-color: var(--yellow);
    box-shadow: 0 6px 20px rgba(255, 210, 0, 0.35);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--dark);
    padding: 10px 18px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--yellow);
    background: #fff9d6;
}

/* =========================
   HEADER MÓVIL / HAMBURGUESA
========================= */
.menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border: none;
    background: rgba(0, 0, 0, 0.82);
    border-radius: 12px;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.18);
    flex-shrink: 0;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #fff;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* =========================
   3. HERO SUCURSALES
========================= */
.hero-sucursales {
    padding: 70px 0 55px;
    background:
        linear-gradient(rgba(255,255,255,0.82), rgba(255,255,255,0.82)),
        url("imagenes/mercado.webp");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-content {
    max-width: 760px;
    text-align: left;
}

.hero-sucursales h1 {
    font-size: 56px;
    line-height: 1.1;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--dark);
}

.hero-sucursales > .container > .hero-content > p {
    font-size: 18px;
    color: #5f5f5f;
    margin-bottom: 28px;
}

.nearest-branch-box {
    display: none;
    position: relative;
    max-width: 760px;
    margin-top: 24px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    border-left: 6px solid var(--yellow);
}

.nearest-branch-card {
    display: flex;
    align-items: center;
    gap: 22px;
}

.nearest-branch-image {
    width: 170px;
    height: 130px;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.nearest-branch-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nearest-branch-info {
    flex: 1;
}

.nearest-branch-info h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: var(--dark);
    line-height: 1.2;
}

.nearest-branch-info .branch-name {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--dark);
    line-height: 1.2;
}

.nearest-branch-info p {
    font-size: 16px;
    color: #555;
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.nearest-branch-info .distance {
    font-weight: 700;
    color: var(--dark);
}

.branch-actions {
    margin-top: 14px;
}

.close-nearest-branch {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f1f1f1;
    color: #333;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.25s ease;
}

.close-nearest-branch:hover {
    background: var(--yellow);
    transform: scale(1.05);
}

/* =========================
   4. BUSCADOR
========================= */
.search-box {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.search-box input {
    width: 520px;
    max-width: 100%;
    height: 58px;
    border: 1px solid #dddddd;
    border-radius: 40px;
    padding: 0 22px;
    font-size: 16px;
    outline: none;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 8px 25px rgba(0,0,0,0.04);
}

.search-box input:focus {
    border-color: var(--yellow);
    box-shadow: 0 8px 25px rgba(255, 210, 0, 0.18);
}

.search-box button {
    height: 58px;
    padding: 0 32px;
    border: none;
    border-radius: 40px;
    background: var(--yellow);
    color: #000;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255, 210, 0, 0.35);
}

#noResultsMessage {
    margin-bottom: 18px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* =========================
   SCROLL LISTA
========================= */
.sucursales-list::-webkit-scrollbar {
    width: 8px;
}

.sucursales-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sucursales-list::-webkit-scrollbar-thumb {
    background: #d6d6d6;
    border-radius: 10px;
}

.sucursales-list::-webkit-scrollbar-thumb:hover {
    background: #bdbdbd;
}

/* =========================
   IMÁGENES SUCURSALES
========================= */
.nearest-branch-image {
    width: 240px;
    height: 210px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.nearest-branch-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sucursal-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 12px;
}

.sucursal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================
   5. SECCIÓN SUCURSALES
========================= */
.sucursales-section {
    padding: 50px 0 80px;
}

.sucursales-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 40px;
    align-items: start;
}

.sucursales-list h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--dark);
}

/* =========================
   6. TARJETAS DE SUCURSAL
========================= */
.sucursal-card {
    background: white;
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    animation: fadeInCard 0.5s ease forwards;
}

.sucursal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.sucursal-card.active {
    border: 2px solid var(--yellow);
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
}

.sucursal-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.sucursal-card p {
    font-size: 15px;
    color: #5f5f5f;
    margin-bottom: 4px;
    line-height: 1.5;
}

.sucursal-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-start;
}

.sucursal-card button {
    background: var(--yellow);
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 15px;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sucursal-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(255, 210, 0, 0.28);
}

.distance {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-top: 8px;
}

/* =========================
   ANIMACIONES
========================= */
@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   7. MAPA
========================= */
.map-container {
    height: 600px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
    background: #e9e9e9;
    position: sticky;
    top: 115px;
}

.map-placeholder {
    width: 100%;
    height: 100%;
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-size: 20px;
    font-weight: 500;
    text-align: center;
    padding: 20px;
}

#map {
    width: 100%;
    height: 100%;
}

/* =========================
   MARCADORES PERSONALIZADOS
========================= */
.custom-branch-marker {
    background: transparent;
    border: none;
}

.marker-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    border: 3px solid #FFD200;
    transition: all 0.25s ease;
    overflow: hidden;
}

.marker-wrapper img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

/* =========================
   FOOTER
========================= */
.footer {
    background: linear-gradient(180deg, #2b2b2b 0%, #1f1f1f 100%);
    color: var(--white);
    padding-top: 60px;
    margin-top: 80px;
}

.footer-container {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.footer-logo {
    width: 140px;
    margin-bottom: 18px;
}

.footer-brand p,
.footer-contact p,
.footer-links ul li a,
.footer-social a {
    color: rgba(255, 255, 255, 0.78);
    font-size: 15px;
    line-height: 1.8;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer h4 {
    font-size: 18px;
    margin-bottom: 18px;
    color: var(--yellow);
    position: relative;
}

.footer h4::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: var(--yellow);
    border-radius: 10px;
    margin-top: 8px;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-links a:hover,
.footer-social a:hover {
    color: var(--yellow);
    transform: translateX(4px);
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
    color: #fff;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background: var(--yellow);
    color: #000;
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
}

/* =========================
   TABLET
========================= */
@media (max-width: 1024px) {
    .sucursales-grid {
        grid-template-columns: 1fr;
    }

    .map-container {
        position: static;
        top: auto;
        height: 450px;
    }

    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

/* =========================
   MÓVIL
========================= */
@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden;
    }

    body {
        padding-top: 82px;
    }

    .container {
        width: 92%;
    }

    .header {
        padding: 8px 0;
    }

    .nav {
        height: 60px;
    }

    .logo img {
        height: 42px;
    }

    .menu-toggle {
        display: flex;
    }

    .menu {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 6px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        padding: 12px;
        border-radius: 18px;
        box-shadow: 0 12px 30px rgba(0,0,0,0.12);
        z-index: 1001;
    }

    .menu.active {
        display: flex;
    }

    .menu a {
        display: block;
        width: 100%;
        padding: 14px 16px;
        border-radius: 12px;
        font-size: 15px;
    }

    .menu a:hover {
        background: #fff8cc;
        transform: none;
    }

    .hero-sucursales {
        padding: 45px 0 35px;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-sucursales h1 {
        font-size: 32px;
        line-height: 1.15;
        margin-bottom: 12px;
    }

    .hero-sucursales > .container > .hero-content > p {
        font-size: 16px;
        margin-bottom: 22px;
    }

    .search-box {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-box input,
    .search-box button,
    .btn-primary {
        width: 100%;
    }

    .nearest-branch-box {
        max-width: 100%;
        padding: 18px;
        border-radius: 18px;
    }

    .nearest-branch-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .nearest-branch-image {
        width: 100%;
        height: 190px;
    }

    .nearest-branch-info .branch-name {
        font-size: 22px;
    }

    .sucursales-section {
        padding: 35px 0 55px;
    }

    .sucursales-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .sucursales-list h2 {
        font-size: 24px;
        margin-bottom: 18px;
    }

    .map-container {
        position: static;
        top: auto;
        height: 360px;
        order: -1;
    }

    .sucursal-card {
        padding: 14px;
        margin-bottom: 16px;
    }

    .sucursal-image {
        height: 180px;
    }

    .sucursal-card h3 {
        font-size: 17px;
    }

    .sucursal-card p {
        font-size: 14px;
    }

    .sucursal-card button {
        width: 100%;
        margin-top: 10px;
    }

    .footer {
        padding-top: 50px;
        margin-top: 60px;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 28px;
        text-align: center;
    }

    .footer-logo {
        width: 120px;
        margin: 0 auto 16px;
    }

    .footer h4::after {
        margin: 8px auto 0;
    }

    .footer-brand p,
    .footer-contact p,
    .footer-links ul li a,
    .footer-social a {
        font-size: 14px;
        line-height: 1.7;
    }

    .social-icons {
        justify-content: center;
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .footer-links ul li {
        margin-bottom: 8px;
    }

    .footer-bottom {
        margin-top: 30px;
        padding: 18px 0;
    }

    .footer-bottom p {
        font-size: 13px;
        line-height: 1.5;
    }
}

/* =========================
   EXTRA PEQUEÑO
========================= */
@media (max-width: 480px) {
    .logo img {
        height: 38px;
    }

    .menu-toggle {
        width: 42px;
        height: 42px;
    }

    .hero-sucursales h1 {
        font-size: 28px;
    }

    .map-container {
        height: 300px;
        border-radius: 18px;
    }

    .nearest-branch-image {
        height: 170px;
    }

    .footer-logo {
        width: 105px;
    }

    .footer h4 {
        font-size: 17px;
    }

    .footer-brand p,
    .footer-contact p,
    .footer-links ul li a,
    .footer-social a {
        font-size: 13px;
    }

    .social-icons a {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}