:root {
    color-scheme: light dark;
    --bg: #f4f5f7;
    --panel: #ffffff;
    --text: #1f2430;
    --muted: #6b7280;
    --brand: #d92d20;
    --line: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161c;
        --panel: #1e2129;
        --text: #f2f3f5;
        --muted: #9aa0ab;
        --line: #2b2f3a;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.descubre-header {
    padding: 16px 20px 20px;
    max-width: 900px;
    margin: 0 auto;
}

.descubre-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 22px;
}

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

.descubre-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.descubre-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.descubre-brand-text small {
    font-weight: 700;
    font-size: 0.62rem;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.descubre-header-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.descubre-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.descubre-hero-text h1 {
    margin: 0 0 6px;
    font-size: 1.5rem;
    line-height: 1.15;
}

.text-brand {
    color: var(--brand);
}

.descubre-hero-text p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    max-width: 34ch;
}

.descubre-hero-art {
    flex-shrink: 0;
    font-size: 2.8rem;
    line-height: 1;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

.descubre-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 16px;
}

.descubre-search-icon {
    flex-shrink: 0;
    opacity: 0.6;
    font-size: 0.9rem;
}

.descubre-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
}

.descubre-search input::placeholder {
    color: var(--muted);
}

.descubre-ubicacion {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--muted);
}

.descubre-ubicacion strong {
    color: var(--brand);
    font-weight: 700;
}

.descubre-ubicacion-btn {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    padding: 2px 0;
}

.btn-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 8px 8px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

@media (max-width: 400px) {
    .descubre-header-actions {
        gap: 6px;
    }
    .btn-header {
        gap: 4px;
        padding: 6px 10px 6px 6px;
        font-size: 0.7rem;
    }
    .btn-header-icon {
        width: 18px;
        height: 18px;
        font-size: 0.68rem;
    }
}

.btn-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.btn-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.btn-header-download .btn-header-icon {
    background: #2563eb;
}

.btn-header-download:hover {
    border-color: #2563eb;
}

.btn-header-registrar .btn-header-icon {
    background: var(--brand);
}

.btn-header-registrar:hover {
    border-color: var(--brand);
}

.descubre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    padding: 16px 20px 48px;
    max-width: 1100px;
    margin: 0 auto;
}

.restaurante-card {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.restaurante-card[hidden] {
    display: none;
}

.restaurante-distancia {
    position: absolute;
    top: 8px;
    right: 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted);
}

.restaurante-logo-link {
    flex-shrink: 0;
    display: block;
}

.restaurante-logo {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--bg);
    display: block;
}

.restaurante-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.restaurante-nombre-link {
    text-decoration: none;
    color: inherit;
}

.restaurante-nombre {
    margin: 0;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.restaurante-acciones {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.restaurante-acciones .btn {
    padding: 5px 10px;
    font-size: 0.78rem;
}

.restaurante-fav {
    align-self: flex-end;
    flex-shrink: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 2px;
    color: var(--muted);
}

.restaurante-fav.is-favorito {
    color: var(--brand);
}

.descubre-sin-resultados {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 32px 0;
}

.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}

.descubre-vacio {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
}

.descubre-footer {
    text-align: center;
    color: var(--muted);
    padding: 16px;
    font-size: 0.85rem;
    margin-bottom: 56px; /* deja lugar al nav fijo de abajo */
}

.descubre-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: var(--panel);
    border-top: 1px solid var(--line);
    z-index: 500;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.descubre-bottomnav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 10px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.descubre-bottomnav-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.descubre-bottomnav-item.is-active {
    color: var(--brand);
}

.ubicacion-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    /* opacity/visibility en vez de display:none: asi el contenedor del mapa
       nunca colapsa a 0x0 y Leaflet lo puede medir bien apenas se abre,
       sin necesitar timeouts para "esperar" a que se vea. */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
}

.ubicacion-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.ubicacion-modal {
    background: var(--panel);
    border-radius: 16px;
    padding: 18px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ubicacion-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ubicacion-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.ubicacion-modal-cerrar {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}

.ubicacion-modal input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
}

.ubicacion-modal-mapa {
    width: 100%;
    height: 280px;
    border-radius: 12px;
    z-index: 0;
}

.ubicacion-modal-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.ubicacion-modal-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ubicacion-modal-acciones .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (min-width: 900px) {
    .descubre-header {
        padding: 32px 20px 28px;
        max-width: 1100px;
    }

    .descubre-hero-text h1 {
        font-size: 2.4rem;
    }

    .descubre-hero-text p {
        font-size: 1.05rem;
        max-width: 46ch;
    }

    .descubre-hero-art {
        font-size: 4.5rem;
    }

    .descubre-topbar {
        margin-bottom: 28px;
    }

    .btn-header {
        font-size: 0.92rem;
        padding: 10px 18px 10px 10px;
    }

    .btn-header-icon {
        width: 26px;
        height: 26px;
    }

    .descubre-grid {
        max-width: 1400px;
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 16px;
        padding: 16px 40px 64px;
    }

    .restaurante-card {
        padding: 14px 18px;
        border-radius: 14px;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .restaurante-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    }

    .restaurante-logo {
        width: 68px;
        height: 68px;
        border-radius: 12px;
    }

    .restaurante-nombre {
        font-size: 1.02rem;
    }

    .restaurante-acciones .btn {
        padding: 6px 12px;
        font-size: 0.82rem;
    }
}

.descubre-avisos {
    margin: 12px 16px 0;
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.descubre-avisos-titulo {
    margin: 0 0 4px;
    font-weight: 700;
    font-size: 0.95rem;
}

.descubre-avisos-texto {
    margin: 0 0 10px;
    font-size: 0.82rem;
    color: var(--muted);
}

.descubre-avisos-form {
    display: flex;
    gap: 8px;
}

.descubre-avisos-form input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}

.descubre-avisos-form .btn {
    white-space: nowrap;
}

.descubre-avisos-estado {
    margin: 10px 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
}

.descubre-pedido-banner {
    margin: 12px 16px 0;
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.descubre-pedido-titulo {
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 0.95rem;
}

.descubre-pedido-lista {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.descubre-pedido-lista li {
    padding: 2px 0;
}

.descubre-pedido-total {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.descubre-pedido-banner .btn {
    width: 100%;
    text-align: center;
}
