/* Colores de marca: los tokens --marca-* los define, con la paleta de la empresa,
   templates/_marca_head.html (COLORES de constantes.py). Esta
   hoja solo los usa. */
:root {
    --app-radius: 12px;
    --app-space-1: 0.5rem;
    --app-space-2: 0.75rem;
    --app-space-3: 1rem;
}

html, body {
    -webkit-text-size-adjust: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* Main page spacing */
main.container {
    padding-left: var(--app-space-2);
    padding-right: var(--app-space-2);
}

/* Forms */
label {
    display: block;
}

.form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    border: 2px solid #ccc;
    padding: 20px;
}

/* Menu cards */
.menu-item {
    display: inline-block;
    width: 250px;
    margin: 10px;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    color: #111;
    border-radius: 10px;
    overflow: hidden;
}

.menu-item-background {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.menu-item span {
    display: block;
    line-height: 20px;
}

/* Legacy helpers */
.campo-titulo {
    text-align: left;
    font-weight: normal;
}

.campo-valor {
    text-align: right;
    font-weight: bold;
}

.tabla-reparacion {
    margin: 0 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.content-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    text-align: center;
}

.contador {
    font-size: 2em;
    color: #ff0000;
    font-weight: bold;
}

/* Buttons */
.btn:not(.btn-close) {
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn:not(.btn-link):not(.btn-close) {
    border: 0;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.btn:not(.btn-link):not(.btn-close):not(:disabled):hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
}

.btn-primary {
    background-image: linear-gradient(180deg, var(--marca-primario-claro) 0%, var(--marca-primario) 100%);
}

.btn-success {
    background-image: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
}

.btn-secondary {
    background-image: linear-gradient(180deg, #64748b 0%, #475569 100%);
}

.btn-danger {
    background-image: linear-gradient(180deg, var(--marca-peligro) 0%, var(--marca-peligro-oscuro) 100%);
}

.btn:focus-visible {
    outline: 3px solid rgba(var(--marca-primario-rgb), 0.35);
    outline-offset: 1px;
}

.btn-custom {
    width: 100%;
    font-size: 1rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    line-height: 1.4;
}

.btn-home {
    width: 100%;
    font-size: 1.05rem;
    padding: 0.95rem 0.8rem;
    line-height: 1.25;
}

/* Tables */
.table-compact td,
.table-compact th {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    padding-left: 6px;
    padding-right: 6px;
    vertical-align: middle;
    font-size: 0.85rem;
}

.table-compact button {
    padding: 2px 4px;
}

.table th,
.table td {
    vertical-align: middle;
}

/* Mobile first */
@media (max-width: 576px) {
    main.container {
        padding-left: var(--app-space-1);
        padding-right: var(--app-space-1);
        margin-top: 0.75rem !important;
    }

    header.container-fluid {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    .btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.65rem 0.85rem;
    }

    .btn-custom {
        font-size: 0.98rem;
    }

    .btn-home {
        min-height: 56px;
        font-size: 1.05rem;
        padding: 0.9rem 0.75rem;
    }

    .card {
        border-radius: var(--app-radius) !important;
    }

    .tabla-reparacion {
        margin-left: 8px;
        margin-right: 8px;
    }

    .table {
        font-size: 0.88rem;
    }

    .table td,
    .table th {
        padding: 0.4rem 0.45rem;
    }
}

/* ---- Bottom Nav ---- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: var(--marca-primario);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 0 env(safe-area-inset-bottom, 8px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.18);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 8px;
    transition: color 0.15s ease;
}

.bottom-nav-item i {
    font-size: 1.3rem;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: #fff;
}

.bottom-nav-item.active {
    color: var(--marca-acento);
}

/* Insignia de avisos nuevos sobre la campana (avisos-sound.js la muestra/oculta) */
.nav-bell {
    position: relative;
    display: inline-flex;
    line-height: 1;
}
.nav-badge {
    position: absolute;
    top: -3px;
    right: -6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #b22222;
    border: 2px solid var(--marca-primario);
    box-sizing: border-box;
}
.nav-badge[hidden] {
    display: none;
}
/* Sacudida/pulso breve al llegar un aviso nuevo */
.nav-badge--pulse {
    animation: navBadgePulse 0.6s ease-in-out 4;
}
@keyframes navBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.7); }
}

/* El banner de avisos del home usa .d-block (!important); aseguramos que el
   atributo hidden gane cuando no hay avisos sin leer. */
#home-avisos-banner[hidden] {
    display: none !important;
}

/* Gate de entrada a Inicio: overlay que fuerza un toque para desbloquear el audio
   de avisos y, de paso, muestra el proximo destino. */
.audio-gate {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(2px);
}
.audio-gate-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 1.4rem 1.25rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    text-align: center;
}
.audio-gate-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--marca-primario);
    margin-bottom: 0.6rem;
}
.audio-gate-tipo {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1d4ed8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.audio-gate-empresa {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    margin-top: 0.15rem;
}
.audio-gate-localidad {
    font-size: 0.98rem;
    color: #334155;
    margin-top: 0.2rem;
}
.audio-gate-merc {
    font-size: 0.92rem;
    color: #0f172a;
    font-weight: 600;
    margin-top: 0.35rem;
}
.audio-gate-hora {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 0.3rem;
}
.audio-gate-btn {
    margin-top: 1.2rem;
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background: var(--marca-primario);
    box-shadow: 0 4px 12px rgba(var(--marca-primario-rgb), 0.3);
    cursor: pointer;
}
.audio-gate-btn:active {
    transform: translateY(1px);
}

body.has-bottom-nav {
    /* Barra inferior (72px) y, encima, el aviso de red (de 80 a 112px desde abajo):
       al final del scroll nada queda debajo del aviso. */
    padding-bottom: 120px;
}

/* ---- PWA: indicador de red + banner de cache ---- */
.network-indicator {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--marca-peligro);
    color: #fff;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    display: none;
    pointer-events: none;
}

.network-indicator.state-flaky {
    background: var(--marca-acento);
    color: #111;
}

.network-indicator.state-comprobando {
    background: #495057;
}

body:not(.has-bottom-nav) .network-indicator {
    bottom: 16px;
}

.cache-banner {
    background: linear-gradient(180deg, #fff3cd 0%, #ffe69c 100%);
    color: #664d03;
    border-bottom: 1px solid #ffd966;
    padding: 6px 12px;
    font-size: 0.85rem;
    text-align: center;
    font-weight: 500;
    display: none;
}
