/* Diseño de la tienda y sus paneles. Los controles, permisos, capas y rutas
   siguen definidos por la aplicación; esta hoja se carga después de design.css. */
:root {
    --apple-blue: #0066ff;
    --apple-black: #17243b;
    --apple-gray-bg: #f8fafc;
    --apple-text-sec: #596b82;
    --apple-border: #dbe4ef;
    --compro-borde: #e2e8f0;
    --compro-suave: #eff5ff;
    --compro-sombra: 0 2px 4px rgba(15, 23, 42, .02), 0 8px 24px rgba(15, 23, 42, .045);
    /* Reserva el alto del dock y su separación para las acciones flotantes. */
    --nav-height: 96px;
    --border-radius: 20px;
}

body { background: var(--apple-gray-bg); text-rendering: optimizeLegibility; }
::selection { background: #dbeafe; color: #17243b; }

.main-header {
    background: rgba(255, 255, 255, .91);
    border-color: #e2e8f0;
    padding-inline: clamp(16px, 3.5vw, 56px);
}
.main-header.es-desplazada { background: rgba(255, 255, 255, .97); }
.logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 8px 0;
    font-size: 24px;
    letter-spacing: -.8px;
    white-space: nowrap;
}
.logo-pro { border-radius: 8px; background: var(--apple-blue); box-shadow: none; }
.btn-header-register { min-height: 44px; padding-inline: 20px; border-radius: 14px; }
.btn-header-register:hover { background: #0052cc; }
.distributor-info { background: #f1f5f9; border: 1px solid #e2e8f0; box-shadow: none; }
.sn-header-btn { border-radius: 14px; background: #fff; }

/* El directorio conserva logos, textos y todas las acciones originales. */
#provider-modal.provider-explorer {
    padding: 42px 24px calc(144px + env(safe-area-inset-bottom));
}
.provider-explorer-content { max-width: 1160px; }
.provider-heading {
    align-items: flex-end;
    gap: 24px;
    padding-bottom: 26px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--compro-borde);
}
.provider-eyebrow {
    margin: 0 0 10px;
    color: #0052cc;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}
.provider-title { align-items: center; gap: 12px; }
#provider-modal.provider-explorer h1 {
    font-size: clamp(28px, 3.2vw, 36px);
    line-height: 1.2;
    font-weight: 750;
    letter-spacing: -.9px;
}
#provider-results {
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid var(--compro-borde);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
#provider-results:empty { padding: 0; border: 0; }
.provider-intro { margin-top: 10px; color: var(--apple-text-sec); font-size: 14px; line-height: 1.65; }
#provider-modal #provider-zone { margin-top: 12px; font-size: 13px; }
.provider-tools { padding: 10px 14px; border-radius: 14px; box-shadow: 0 2px 6px rgba(15, 23, 42, .03); }
.provider-tools label { min-height: 24px; font-size: 13px; font-weight: 600; }
.provider-tools input { width: 17px; height: 17px; }

#provider-list {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}
#provider-list .provider-choice {
    padding: 22px 18px 16px;
    border: 1px solid var(--compro-borde);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--compro-sombra);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}
#provider-list .provider-choice:active { transform: none; opacity: 1; }
#provider-list .provider-choice[hidden] { display: none; }
#provider-list .card-img-wrapper {
    width: 108px;
    height: 108px;
    max-width: 100%;
    padding: 14px;
    margin: 12px auto 18px;
    border: 1px solid #e5ebf3;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}
#provider-list .provider-enter img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
#provider-list .card-img-wrapper:has(img[src*="logo_avicola"]) { background: #fff9ec; border-color: #f4e6c8; }
#provider-list .card-img-wrapper:has(img[src*="logo_moncarnes"]) { background: #edf9f2; border-color: #d4ebdd; }
#provider-list .card-img-wrapper:has(img[src*="logo_eiriz"]) { background: #fff5ed; border-color: #f1dfcf; }
#provider-list .card-img-wrapper:has(img[src*="logo_navarro"]) { background: #fff1f4; border-color: #f0dce3; }
#provider-list .card-name {
    height: auto;
    min-height: 44px;
    max-height: none;
    font-size: 16px;
    line-height: 22px;
    font-weight: 700;
    letter-spacing: -.2px;
    overflow: visible;
    -webkit-line-clamp: unset;
}
#provider-list .provider-description {
    margin: 8px 0 18px;
    color: var(--apple-text-sec);
    font-size: 13px;
    line-height: 20px;
    height: 40px;
}
#provider-list .provider-favorite {
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    color: #64748b;
    background: transparent;
    box-shadow: none;
}
#provider-list .provider-favorite.active { color: var(--apple-blue); background: #eff5ff; }
#provider-list .provider-catalog { border-radius: 12px; font-weight: 650; box-shadow: none; }
.provider-catalog:hover { background: #0052cc; }
#provider-list .provider-actions { gap: 8px; }
#provider-list .provider-actions button { border-radius: 12px !important; }
#provider-list .provider-info,
#provider-list .provider-message { border-color: #dce6f5; color: #0052cc; background: #f8fbff; }
.provider-empty { grid-column: 1 / -1; padding: 28px; background: #fff; border: 1px solid var(--compro-borde); border-radius: 20px; }

/* El mismo dock para cada rol: data-nav y hidden siguen gobernando sus destinos. */
.bottom-nav {
    width: min(548px, calc(100% - 24px));
    height: 76px;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 7px;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 24px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 12px 38px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .03);
}
.bottom-nav .nav-item {
    min-width: 44px;
    min-height: 60px;
    padding: 6px 3px;
    gap: 5px;
    border-radius: 17px;
    color: #596b82;
    font-size: 12px;
    font-weight: 600;
}
.bottom-nav .nav-item.active { color: #0052cc; background: #edf4ff; }
.bottom-nav .nav-item svg { width: 23px; height: 23px; stroke-width: 1.9; }
.bottom-nav .nav-item[hidden] { display: none !important; }
.bottom-nav .nav-item:focus-visible { outline: 2px solid var(--apple-blue); outline-offset: -2px; }
.bag-footer { bottom: calc(var(--nav-height) + 12px + env(safe-area-inset-bottom)); }
#pila-flotantes { bottom: calc(var(--pila-base) + env(safe-area-inset-bottom)); }

/* Catálogo y cuenta comparten superficies e iconos con el directorio. */
.product-card { border-radius: 20px; border-color: var(--compro-borde); box-shadow: var(--compro-sombra); }
.card-img-wrapper { background: #f8fafc; border-radius: 14px; }
.card-name { font-weight: 650; }
.card-price { color: #17243b; font-variant-numeric: tabular-nums; }
.qty-control { border-radius: 12px; background: #eff5ff; }
.filter-sort-row { border-radius: 20px; background: rgba(255, 255, 255, .96); border-color: var(--compro-borde); box-shadow: var(--compro-sombra); }
.chip.active { background: #17243b; border-color: #17243b; }
.chip-marca.active { background: var(--apple-blue); border-color: var(--apple-blue); }
.account-avatar { border-radius: 23px; box-shadow: 0 8px 20px rgba(0, 102, 255, .16); }
.account-name { font-size: 23px; letter-spacing: -.5px; }
.account-view-container .profile-card { border: 1px solid var(--compro-borde); border-radius: 20px; overflow: hidden; }
.profile-row { border-color: #edf1f6; }
.profile-row:hover { background: #f8fbff; }
.profile-row-icon { width: 36px; height: 36px; border-radius: 11px; background: #eff5ff; color: #0052cc; }
.account-edit-btn { min-height: 44px; border-radius: 12px; }
.business-placeholder { background: #edf3fb; }
.input-apple { border-radius: 12px; }
.input-apple:focus { border-color: var(--apple-blue); box-shadow: 0 0 0 3px rgba(0, 102, 255, .1); }

/* El panel conserva su menú y las secciones permitidas para cada persona. */
.cp-shell {
    --cp-fondo: #f8fafc;
    --cp-lateral: #fff;
    --cp-superficie: #fff;
    --cp-borde: #e2e8f0;
    --cp-borde-suave: #f1f5f9;
    --cp-texto: #17243b;
    --cp-texto-2: #52647b;
    --cp-texto-3: #596b82;
    --cp-acento: #0066ff;
    --cp-radio: 18px;
    --cp-barra-inferior: 96px;
    --cp-sombra: var(--compro-sombra);
}
.cp-lateral { padding: 22px 14px; }
.cp-shell .cp-marca { font-size: 22px; margin-bottom: 10px; }
.cp-shell .cp-marca span { border-radius: 8px; }
.cp-shell .cp-nav-item { min-height: 50px; border-radius: 12px; font-weight: 600; }
.cp-shell .cp-nav-item svg { width: 32px; height: 32px; padding: 7px; border-radius: 9px; background: #f1f5f9; }
.cp-shell .cp-nav-item.es-activo { background: #edf4ff; color: #0052cc; box-shadow: none; }
.cp-shell .cp-nav-item.es-activo svg { background: #dbeafe; }
.cp-titulo,
.pv-titulos h2,
.pa-cabecera h2 { letter-spacing: -.5px; }
.pv-contenido { background: var(--cp-fondo); }
.cp-tarjeta,
.cp-shell .pv-kpi { border-radius: 18px; background: #fff; }
.cp-shell .pv-kpi { border: 1px solid var(--cp-borde); box-shadow: var(--compro-sombra); }
.pv-select,
.pv-buscador { border-radius: 11px; background: #fff; }
.pv-tabla th { background: #f1f5f9; color: #52647b; }
.pv-tabla td { border-color: #edf1f6; }
.pv-btn { border-radius: 11px; }

@media (hover: hover) and (pointer: fine) {
    #provider-list .provider-choice:hover { border-color: #b8d3ff; box-shadow: 0 5px 14px rgba(15, 23, 42, .03), 0 14px 30px rgba(0, 102, 255, .07); }
    .bottom-nav .nav-item:not(.active):hover { color: #0052cc; background: #f6f9ff; }
}

@media (max-width: 1050px) and (min-width: 701px) {
    #provider-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .cp-lateral { padding: 9px 12px; }
    .cp-shell .cp-marca { font-size: 17px; margin-bottom: 0; }
    /* «Volver» es un .cp-nav-item: sin esto heredaba los 50 px y la barra de arriba crecía. */
    .cp-shell .cp-volver { min-height: 44px; }
    .cp-shell .cp-volver svg { width: 24px; height: 24px; padding: 3px; }
    .cp-shell .cp-nav {
        left: calc(12px + env(safe-area-inset-left));
        right: calc(12px + env(safe-area-inset-right));
        bottom: calc(14px + env(safe-area-inset-bottom));
        max-width: 640px;
        margin-inline: auto;
        padding: 7px;
        border: 1px solid var(--cp-borde);
        border-radius: 22px;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
    }
    /* A partes iguales, «Mis establecimientos» no cabía a 375 px: cada sección
       parte del ancho de su nombre y el sobrante se reparte. */
    .cp-shell .cp-nav .cp-nav-item { flex: 1 1 auto; width: auto; min-height: 58px; border-radius: 14px; gap: 3px; font-size: 11.5px; }
    .cp-shell .cp-nav .cp-nav-item svg { width: 27px; height: 27px; padding: 4px; }
    .cp-shell .cp-principal { padding-bottom: calc(106px + env(safe-area-inset-bottom)); }
}
/* Teléfono en horizontal: la barra de arriba y la isla de secciones se comían
   un tercio del alto. Las dos bajan a lo justo para un dedo (44 px) y en la
   isla el icono va al lado del nombre, que en horizontal sobra ancho. */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .cp-lateral { padding: 4px 12px; }
    .cp-shell .cp-nav { bottom: calc(8px + env(safe-area-inset-bottom)); padding: 4px; border-radius: 18px; }
    .cp-shell .cp-nav .cp-nav-item { min-height: 44px; flex-direction: row; gap: 8px; font-size: 12.5px; }
    .cp-shell .cp-nav .cp-nav-item svg { width: 24px; height: 24px; padding: 3px; }
    .cp-shell .cp-principal { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
}

@media (max-width: 900px) {
    .main-header { gap: 10px; }
    .main-header .logo { font-size: 23px; }
    .guest-mode .main-header .logo { order: 0; }
    .guest-mode .main-header .distributor-info {
        order: 1;
        flex: 1 1 auto;
        width: auto;
        min-width: 44px;
        max-width: 200px;
        margin: 0;
        padding: 8px 10px;
        gap: 6px;
    }
    .guest-mode .distributor-info > div { min-width: 0; }
    .guest-mode .distributor-name {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
    }
    .guest-mode .main-header .btn-header-register {
        order: 2;
        flex: 0 0 auto;
        padding-inline: 14px;
        font-size: 13px;
        justify-content: center;
    }
}

@media (max-width: 700px) {
    #provider-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    #provider-modal.provider-explorer { padding: 30px 16px calc(144px + env(safe-area-inset-bottom)); }
    .provider-heading { flex-wrap: wrap; align-items: flex-start; gap: 16px; padding-bottom: 22px; margin-bottom: 22px; }
    .provider-tools { padding: 8px 12px; }
    #provider-list .provider-choice { padding: 16px 12px 12px; border-radius: 18px; }
    #provider-list .card-img-wrapper { width: 92px; height: 92px; padding: 12px; margin: 20px auto 14px; border-radius: 23px; }
    #provider-list .card-name { font-size: 14px; line-height: 20px; min-height: 40px; }
    #provider-list .provider-description { font-size: 12px; line-height: 18px; height: 36px; margin-bottom: 14px; }
    #provider-list .provider-catalog { font-size: 13px; padding-inline: 8px; }
    #provider-list .provider-actions { gap: 6px; }
    #provider-list .provider-actions button { font-size: 12px !important; }
    #provider-list .provider-favorite { top: 4px; right: 4px; }
}

@media (max-width: 420px) {
    /* El selector sigue disponible; cede su imagen para dar espacio al texto. */
    .guest-mode #provider-logo-header { display: none; }
}

@media (max-width: 380px) {
    .main-header { padding-inline: 12px; gap: 8px; }
    .main-header .logo { font-size: 21px; }
    .guest-mode .main-header .btn-header-register { padding-inline: 12px; font-size: 12px; }
    .guest-mode .main-header .distributor-info { padding-inline: 8px; }
    .bottom-nav { width: calc(100% - 16px); padding: 6px 4px; }
    .bottom-nav .nav-item { font-size: 11px; }
    #provider-list { gap: 10px; }
    #provider-list .provider-choice { padding-inline: 10px; }
    #provider-list .provider-message { flex-basis: 100%; }
    .provider-title { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    #provider-list .provider-choice { transition: none; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .bottom-nav,
    .cp-shell .cp-nav,
    .main-header { background: #fff; }
}
