/**
 * comercio-directorio.css
 * Municipalidad de Mendiolaza — Directorio de comercios
 * Variables: --mc-green #237f33 | --mc-dgreen #005533 | lime #9CC11B
 * Cargado solo en páginas con [directorio_comercios]
 */

/* ── Wrap general ── */
.mdir-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 64px;
}

/* ── Controles (búsqueda + filtros + toggle) ── */
.mdir-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #f3faf3;
    border: 1px solid #d8ead8;
    border-radius: 12px;
}

/* Buscador */
.mdir-search-wrap {
    position: relative;
    flex: 1 1 220px;
}
.mdir-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #888;
    pointer-events: none;
}
.mdir-input {
    width: 100%;
    padding: 10px 14px 10px 42px !important; /* !important para pisar estilos de Blocksy en inputs */
    border: 1px solid #c8e0c8;
    border-radius: 8px;
    font-size: .95rem;
    background: #fff;
    color: #222;
    outline: none;
    box-sizing: border-box !important;
    transition: border-color .15s, box-shadow .15s;
}
.mdir-input:focus {
    border-color: var(--mc-green, #237f33);
    box-shadow: 0 0 0 3px rgba(35,127,51,.12);
}

/* Filtros */
.mdir-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.mdir-select {
    padding: 10px 14px;
    border: 1px solid #c8e0c8;
    border-radius: 8px;
    font-size: .9rem;
    background: #fff;
    color: #222;
    cursor: pointer;
    outline: none;
    transition: border-color .15s;
}
.mdir-select:focus {
    border-color: var(--mc-green, #237f33);
}

/* Toggle grilla / mapa */
.mdir-view-toggle {
    display: flex;
    gap: 4px;
    margin-left: auto;
}
.mdir-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid #c8e0c8;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s, border-color .15s;
}
.mdir-toggle-btn svg {
    width: 18px;
    height: 18px;
    color: #666;
}
.mdir-toggle-btn--active,
.mdir-toggle-btn:hover {
    background: var(--mc-green, #237f33);
    border-color: var(--mc-green, #237f33);
}
.mdir-toggle-btn--active svg,
.mdir-toggle-btn:hover svg {
    color: #fff;
}

/* Contador */
.mdir-count {
    font-size: .875rem;
    color: #777;
    margin: 0 0 16px;
}

/* Spinner */
.mdir-spinner {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}
/* Evita que display:flex pise el atributo hidden */
.mdir-spinner[hidden] { display: none !important; }
.mdir-spinner-ring {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #d8ead8;
    border-top-color: var(--mc-green, #237f33);
    border-radius: 50%;
    animation: mdir-spin .7s linear infinite;
}
@keyframes mdir-spin { to { transform: rotate(360deg); } }

/* ── Grid de tarjetas ── */
.mdir-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ── Tarjeta ── */
.mdir-card {
    background: #fff;
    border: 1px solid #d8ead8;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s, transform .18s;
}
.mdir-card:hover {
    box-shadow: 0 6px 24px rgba(0,80,20,.1);
    transform: translateY(-2px);
}

/* Imagen / thumb */
.mdir-card-thumb-link { display: block; }
.mdir-card-img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    background: #f0f7f0;
    padding: 16px;
    box-sizing: border-box;
    display: block;
}
.mdir-card-img--empty {
    height: 160px;
    background: linear-gradient(135deg, #e8f5e8, #d8efd8);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mdir-card-initial {
    font-size: 3rem;
    font-weight: 800;
    color: var(--mc-green, #237f33);
    opacity: .4;
    line-height: 1;
}

/* Cuerpo */
.mdir-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}
.mdir-card-rubro {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--mc-green, #237f33);
    background: #f0f7f0;
    border-radius: 4px;
    padding: 2px 8px;
    align-self: flex-start;
}
.mdir-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}
.mdir-card-title a {
    color: var(--mc-dgreen, #005533);
    text-decoration: none;
}
.mdir-card-title a:hover { text-decoration: underline; }
.mdir-card-dir {
    font-size: .82rem;
    color: #777;
    margin: 0;
}
.mdir-card-barrio {
    font-weight: 600;
    color: #555;
}
.mdir-card-excerpt {
    font-size: .85rem;
    color: #555;
    margin: 0;
    line-height: 1.5;
    flex: 1;
}
.mdir-card-ver {
    display: inline-block;
    margin-top: 6px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--mc-green, #237f33);
    text-decoration: none;
}
.mdir-card-ver:hover {
    color: var(--mc-dgreen, #005533);
    text-decoration: underline;
}

/* Empty state */
.mdir-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 48px 0;
    font-size: 1rem;
}

/* ── Mapa ── */
.mdir-map-wrap {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #d8ead8;
    margin-bottom: 32px;
}
#mdir-map {
    height: 480px;
    width: 100%;
    z-index: 0;
}

/* ── Popup Leaflet ── */
.mdir-popup {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 200px;
    max-width: 240px;
}
.mdir-popup-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border: 1px solid #d8ead8;
    border-radius: 8px;
    background: #f3faf3;
    padding: 4px;
    box-sizing: border-box;
    flex-shrink: 0;
}
.mdir-popup-img--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--mc-green, #237f33);
    opacity: .5;
}
.mdir-popup-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.mdir-popup-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--mc-dgreen, #005533);
    line-height: 1.2;
    display: block;
}
.mdir-popup-rubro {
    font-size: .72rem;
    color: var(--mc-green, #237f33);
    font-weight: 600;
    display: block;
}
.mdir-popup-dir {
    font-size: .75rem;
    color: #666;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mdir-popup-link {
    font-size: .8rem;
    font-weight: 600;
    color: var(--mc-green, #237f33);
    text-decoration: none;
    margin-top: 4px;
    display: inline-block;
}
.mdir-popup-link:hover { text-decoration: underline; }

/* ── Single comercio ── */
.mcom-single-wrap  { padding-bottom: 64px; }

/* Hero */
.mcom-single-hero  {
    background: var(--mc-dgreen, #005533);
    padding: calc(var(--theme-header-height, 72px) + 81px) 24px 44px;
}
.mcom-single-hero-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 40px;
}
.mcom-single-hero-text { flex: 1; min-width: 0; }
.mcom-back-link {
    display: inline-block;
    color: rgba(255,255,255,.75);
    font-size: .875rem;
    text-decoration: none;
    margin-bottom: 14px;
}
.mcom-back-link:hover { color: #fff; text-decoration: underline; }
.mcom-single-title {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.2;
}
.mcom-single-rubro {
    display: inline-block;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-radius: 4px;
    padding: 3px 10px;
    margin-bottom: 6px;
}
.mcom-single-barrio {
    color: rgba(255,255,255,.75);
    font-size: .9rem;
    margin: 6px 0 0;
}

/* Logo dentro del hero */
.mcom-single-logo-wrap {
    flex-shrink: 0;
    width: 160px;
    height: 160px;
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.mcom-single-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.mcom-single-logo-initial {
    font-size: 4rem;
    font-weight: 800;
    color: var(--mc-green, #237f33);
    line-height: 1;
}

/* Info bar del single */
.mcom-infobar       { background: #f3faf3; border-bottom: 1px solid #d8ead8; }
.mcom-infobar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px 36px;
}
.mcom-info-item { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: #333; }
.mcom-info-item a { color: var(--mc-green, #237f33); text-decoration: none; }
.mcom-info-item a:hover { text-decoration: underline; }
.mcom-info-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--mc-green, #237f33); }

/* Cuerpo del single */
.mcom-single-body    { max-width: 960px; margin: 0 auto; padding: 36px 24px 0; }
.mcom-single-desc    { font-size: 1.05rem; line-height: 1.75; color: #333; }
.mcom-map-embed      { margin-top: 36px; }
.mcom-map-embed h2   {
    font-size: 1.1rem; font-weight: 700; color: var(--mc-dgreen, #005533);
    margin: 0 0 12px; padding-bottom: 6px;
    border-bottom: 2px solid #9CC11B; display: inline-block;
}
#mcom-single-map     { height: 340px; border-radius: 10px; overflow: hidden; border: 1px solid #d8ead8; }

.mcom-single-back    { margin-top: 40px; padding-top: 20px; border-top: 1px solid #e8ede8; }
.mcom-back-link--dark { color: var(--mc-green, #237f33); }
.mcom-back-link--dark:hover { color: var(--mc-dgreen, #005533); }

/* ── Perfil autogestionable [mi_comercio] ── */
.mcom-login-wrap     { max-width: 420px; margin: 32px auto; }
.mcom-aviso          { background: #f3faf3; border: 1px solid #d8ead8; border-radius: 10px; padding: 24px; max-width: 600px; margin: 32px auto; }
.mcom-aviso p        { margin: 0; color: #444; }

.mcom-perfil         { max-width: 680px; margin: 0 auto; }
.mcom-perfil-header  { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.mcom-titulo         { font-size: 1.5rem; font-weight: 800; color: var(--mc-dgreen, #005533); margin: 0; }
.mcom-link-ficha     { font-size: .85rem; color: var(--mc-green, #237f33); text-decoration: none; }
.mcom-link-ficha:hover { text-decoration: underline; }

.mcom-msg {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: .95rem;
}
.mcom-msg--ok    { background: #e8f5e8; border: 1px solid #c8e0c8; color: #1a5c28; }
.mcom-msg--error { background: #fdecea; border: 1px solid #f5c6c2; color: #8b1a1a; }

.mcom-field       { margin-bottom: 22px; }
.mcom-field--logo { }
.mcom-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.mcom-logo-area     { display: flex; align-items: flex-start; gap: 20px; }
.mcom-logo-preview  { width: 100px; height: 100px; object-fit: contain; border: 1px solid #d8ead8; border-radius: 8px; background: #f9fdf9; padding: 8px; box-sizing: border-box; }
.mcom-logo-placeholder { width: 100px; height: 100px; background: #f0f7f0; border: 1px dashed #c8e0c8; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: #aaa; }
.mcom-logo-actions  { display: flex; flex-direction: column; gap: 8px; }
.mcom-file-hidden   { position: absolute; clip: rect(0 0 0 0); width: 1px; height: 1px; overflow: hidden; }
.mcom-hint { font-size: .78rem; color: #888; margin: 0; }

.mcom-input,
.mcom-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #c8e0c8;
    border-radius: 8px;
    font-size: .95rem;
    color: #222;
    background: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
.mcom-input:focus,
.mcom-textarea:focus {
    border-color: var(--mc-green, #237f33);
    box-shadow: 0 0 0 3px rgba(35,127,51,.12);
}
.mcom-textarea { resize: vertical; }

.mcom-actions { margin-top: 28px; }
.mcom-btn {
    display: inline-block;
    padding: 11px 28px;
    border-radius: 24px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    font-family: inherit;
}
.mcom-btn--primary {
    background: var(--mc-green, #237f33);
    color: #fff;
    border-color: var(--mc-green, #237f33);
}
.mcom-btn--primary:hover {
    background: var(--mc-dgreen, #005533);
    border-color: var(--mc-dgreen, #005533);
}
.mcom-btn--outline {
    background: #fff;
    color: var(--mc-green, #237f33);
    border-color: var(--mc-green, #237f33);
}
.mcom-btn--outline:hover {
    background: var(--mc-green, #237f33);
    color: #fff;
}
.mcom-nota { font-size: .82rem; color: #999; margin-top: 24px; }

/* ── Botón WhatsApp en hero ── */
.mcom-cta-wa {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 12px 24px;
    background: #25D366;
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    border-radius: 28px;
    text-decoration: none;
    transition: background .15s, transform .1s;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.mcom-cta-wa:hover {
    background: #1ebe57;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}
.mcom-cta-wa svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Galería de fotos (4 thumbnails) ── */
.mcom-gallery       { margin-top: 36px; }
.mcom-gallery h2    {
    font-size: 1.1rem; font-weight: 700; color: var(--mc-dgreen, #005533);
    margin: 0 0 14px; padding-bottom: 6px;
    border-bottom: 2px solid #9CC11B; display: inline-block;
}
.mcom-gallery-grid  {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.mcom-gallery-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #d8ead8;
    cursor: pointer;
    position: relative;
    background: #f0f7f0;
}
.mcom-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .2s;
}
.mcom-gallery-thumb:hover img { transform: scale(1.04); }
.mcom-gallery-thumb-label {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.45);
    color: #fff;
    font-size: .7rem;
    padding: 4px 8px;
    text-align: center;
}

/* ── Lightbox ── */
.mcom-lb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.mcom-lb-img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 48px rgba(0,0,0,.6);
}
.mcom-lb-close {
    position: absolute;
    top: 16px; right: 20px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.mcom-lb-close:hover { background: rgba(255,255,255,.3); }

/* Fotos en el form [mi_comercio] */
.mcom-fotos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 8px;
}
.mcom-foto-item { display: flex; flex-direction: column; gap: 8px; }
.mcom-foto-label-text {
    font-size: .78rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.mcom-foto-preview-wrap {
    aspect-ratio: 4/3;
    border: 1px dashed #c8e0c8;
    border-radius: 8px;
    overflow: hidden;
    background: #f3faf3;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: border-color .15s;
}
.mcom-foto-preview-wrap:hover { border-color: var(--mc-green, #237f33); }
.mcom-foto-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcom-foto-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    color: #aaa; font-size: .78rem; text-align: center; padding: 8px;
}
.mcom-foto-placeholder svg { width: 28px; height: 28px; opacity: .5; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .mdir-grid { grid-template-columns: repeat(2, 1fr); }
    .mcom-single-hero-inner { flex-direction: column-reverse; align-items: flex-start; gap: 20px; }
    .mcom-single-logo-wrap { width: 120px; height: 120px; align-self: center; }
}
@media (max-width: 600px) {
    .mdir-grid           { grid-template-columns: 1fr; }
    .mdir-view-toggle    { margin-left: 0; }
    #mdir-map            { height: 380px; }
    #mcom-single-map     { height: 260px; }
    .mcom-single-title   { font-size: 1.5rem; }
    .mcom-gallery-grid   { grid-template-columns: repeat(2, 1fr); }
    .mcom-fotos-grid     { grid-template-columns: 1fr; }
}
