/* ── Wrapper ─────────────────────────────────────────────────── */

.mmg-wa-wrapper {
    position: fixed;
    z-index: 9999;
}

/* ── Botón flotante ──────────────────────────────────────────── */

.mmg-wa-btn {
    width:  var(--mmg-wa-btn-size, 60px);
    height: var(--mmg-wa-btn-size, 60px);
    border-radius: 50%;
    border: none;
    background: var(--mmg-wa-btn-color, #25D366);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    box-shadow: var(--mmg-wa-shadow, 0 4px 16px 0 rgba(37,211,102,0.45));
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.mmg-wa-btn:hover {
    background: var(--mmg-wa-btn-hover, #1da851);
    transform: scale(1.08);
    box-shadow: var(--mmg-wa-shadow-hover, 0 6px 22px 0 rgba(37,211,102,0.55));
}

.mmg-wa-btn:focus-visible {
    outline: 3px solid #25D366;
    outline-offset: 3px;
}

.mmg-wa-svg {
    width:  var(--mmg-wa-icon-size, 34px);
    height: var(--mmg-wa-icon-size, 34px);
    fill: #fff;
    display: block;
}

.mmg-wa-svg--sm {
    width:  20px;
    height: 20px;
    fill: var(--mmg-wa-card-wa-color, #25D366);
    display: block;
}

.mmg-wa-svg--header {
    width:  20px;
    height: 20px;
    fill: var(--mmg-wa-header-color, #fff);
    display: block;
    flex-shrink: 0;
}

/* ── Modal ───────────────────────────────────────────────────── */

.mmg-wa-modal {
    position: absolute;
    width: var(--mmg-wa-modal-width, 340px);
    min-height: var(--mmg-wa-modal-min-height, 280px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

/* Variantes de posición */
[data-position="bottom-right"] .mmg-wa-modal {
    bottom: calc(var(--mmg-wa-btn-size, 60px) + 12px);
    right: 0;
    transform-origin: bottom right;
    transform: scale(0.94) translateY(10px);
}
[data-position="bottom-left"] .mmg-wa-modal {
    bottom: calc(var(--mmg-wa-btn-size, 60px) + 12px);
    left: 0;
    transform-origin: bottom left;
    transform: scale(0.94) translateY(10px);
}
[data-position="top-right"] .mmg-wa-modal {
    top: calc(var(--mmg-wa-btn-size, 60px) + 12px);
    right: 0;
    transform-origin: top right;
    transform: scale(0.94) translateY(-10px);
}
[data-position="top-left"] .mmg-wa-modal {
    top: calc(var(--mmg-wa-btn-size, 60px) + 12px);
    left: 0;
    transform-origin: top left;
    transform: scale(0.94) translateY(-10px);
}

.mmg-wa-modal.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0) !important;
}

/* ── Encabezado del modal ────────────────────────────────────── */

.mmg-wa-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--mmg-wa-header-bg, #25D366);
    color: var(--mmg-wa-header-color, #fff);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

/* ── Controles (tabs + search) ───────────────────────────────── */

.mmg-wa-controls {
    padding: 12px 12px 4px;
    border-bottom: 1px solid #f0f0f0;
}

/* ── Tabs de país — reset completo para anular estilos del tema ─ */

.mmg-wa-wrapper .mmg-wa-tabs {
    display: flex;
    gap: 6px;
    margin: 0 0 10px;
    padding: 0;
}

.mmg-wa-wrapper .mmg-wa-tabs .mmg-wa-tab {
    /* Reset de estilos de botón del tema/WP */
    all: unset;
    box-sizing: border-box;

    flex: 1;
    display: inline-block;
    text-align: center;
    padding: 7px 10px;
    border: 1.5px solid var(--mmg-wa-tab-border, #e0e0e0);
    border-radius: var(--mmg-wa-tab-radius, 8px);
    background: var(--mmg-wa-tab-inactive-bg, #f5f5f5);
    color: var(--mmg-wa-tab-inactive-color, #555);
    font-size: var(--mmg-wa-tab-font-size, 13px);
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-transform: none;
    letter-spacing: normal;
}

.mmg-wa-wrapper .mmg-wa-tabs .mmg-wa-tab:hover {
    border-color: var(--mmg-wa-tab-active-bg, #25D366);
    color: var(--mmg-wa-tab-active-bg, #25D366);
    background: var(--mmg-wa-tab-inactive-bg, #f5f5f5);
}

.mmg-wa-wrapper .mmg-wa-tabs .mmg-wa-tab.is-active {
    background: var(--mmg-wa-tab-active-bg, #25D366);
    border-color: var(--mmg-wa-tab-active-bg, #25D366);
    color: var(--mmg-wa-tab-active-color, #fff);
    font-weight: 600;
}

/* ── Buscador ────────────────────────────────────────────────── */

.mmg-wa-search-wrap {
    margin-bottom: 10px;
}

.mmg-wa-search {
    width: 100%;
    padding: var(--mmg-wa-search-pad-v, 8px) var(--mmg-wa-search-pad-h, 12px);
    border: 1.5px solid var(--mmg-wa-search-border, #e0e0e0);
    border-radius: var(--mmg-wa-search-radius, 8px);
    font-size: var(--mmg-wa-search-font-size, 13px);
    box-sizing: border-box;
    outline: none;
    color: var(--mmg-wa-search-color, #333);
    background: var(--mmg-wa-search-bg, #fff);
    transition: border-color 0.15s;
}

.mmg-wa-search::placeholder {
    color: var(--mmg-wa-search-placeholder, #bbb);
}

.mmg-wa-search:focus {
    border-color: var(--mmg-wa-search-border-focus, #25D366);
}

/* ── Lista de tiendas ────────────────────────────────────────── */

.mmg-wa-list {
    list-style: none;
    margin: 0;
    padding: 6px 0 8px;
    max-height: var(--mmg-wa-modal-max-height, 400px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mmg-wa-list::-webkit-scrollbar {
    width: 4px;
}
.mmg-wa-list::-webkit-scrollbar-track {
    background: transparent;
}
.mmg-wa-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* ── Card de tienda ──────────────────────────────────────────── */

.mmg-wa-item.no-phone .mmg-wa-card {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.mmg-wa-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}

.mmg-wa-item:last-child .mmg-wa-card {
    border-bottom: none;
}

.mmg-wa-card:hover {
    background: var(--mmg-wa-card-hover, #f0faf4);
}

.mmg-wa-card__img {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: var(--mmg-wa-card-img-radius, 8px);
    overflow: hidden;
    background: #f0f0f0;
}

.mmg-wa-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mmg-wa-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mmg-wa-card__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--mmg-wa-card-name-color, #1a1a1a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.mmg-wa-card__loc {
    font-size: 11px;
    color: var(--mmg-wa-card-loc-color, #777);
    display: block;
}

.mmg-wa-card__dir {
    font-size: 11px;
    color: var(--mmg-wa-card-dir-color, #bbb);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.mmg-wa-card__action {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0faf4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.mmg-wa-card:hover .mmg-wa-card__action {
    background: #d4f5e2;
}

/* ── Card contacto general (dentro del listado) ──────────────── */

.mmg-wa-card--general {
    background: linear-gradient(135deg, #edfff5 0%, #f0faf4 100%);
    border-bottom-color: #c3e6cb;
}

.mmg-wa-item--general:first-child .mmg-wa-card--general {
    border-top: 1px solid #d4f0e2;
}

.mmg-wa-card--general:hover {
    background: linear-gradient(135deg, #d4f5e2 0%, #e8f8f0 100%) !important;
}

.mmg-wa-card--general .mmg-wa-card__name {
    color: #1a5c35;
}

.mmg-wa-card--general .mmg-wa-card__loc {
    color: #3d8b5e;
}

.mmg-wa-card__icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.mmg-wa-svg--general {
    width: 26px;
    height: 26px;
    fill: #fff;
    display: block;
}

/* ── Empty state ─────────────────────────────────────────────── */

.mmg-wa-empty {
    padding: 20px 16px;
    text-align: center;
    color: #aaa;
    font-size: 13px;
    margin: 0;
}
