/* ============================================
   PescaWiki v3 — Tiendas, especie destacada
   en popup, responsive mobile completo
   ============================================ */

/* ==================== TIENDAS ==================== */
.tiendas-hero {
    background: linear-gradient(135deg, #6a1b9a 0%, #8e24aa 50%, #ab47bc 100%) !important;
    position: relative;
    overflow: hidden;
}
.tiendas-hero::after {
    content: '🛒';
    position: absolute;
    right: -40px;
    bottom: -30px;
    font-size: 200px;
    opacity: 0.12;
    transform: rotate(-12deg);
}

.tiendas-filters .filtros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.tiendas-filters .form-group {
    margin-bottom: 0;
}

.tiendas-filters label {
    font-size: 12px;
    font-weight: 700;
    color: var(--c-profundo);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tiendas-filters select,
.tiendas-filters input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e3f2fd;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: white;
}
.tiendas-filters select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.tiendas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}

.tienda-card {
    position: relative;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.tienda-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    color: inherit;
}
.tienda-card.destacada {
    border: 2px solid #ffb300;
}

.tienda-badge-destacada {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tienda-img {
    height: 180px;
    background: linear-gradient(135deg, #ede7f6, #d1c4e9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.tienda-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tienda-placeholder { font-size: 70px; opacity: 0.4; }

.tienda-body { padding: 16px; }
.tienda-body h3 {
    color: var(--c-profundo);
    font-size: 17px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tienda-verificado {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #43a047;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 11px;
    font-weight: 700;
}

.tienda-ubicacion {
    font-size: 12px;
    color: var(--c-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tienda-direccion {
    font-size: 13px;
    color: var(--c-text);
    margin-bottom: 10px;
    line-height: 1.4;
}

.tienda-contacts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.tienda-contact {
    background: #f0f4f8;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--c-text);
}
.tienda-wa {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

/* ==================== TIENDA DETALLE ==================== */
.tienda-hero {
    position: relative;
    color: white;
    padding: 60px 24px;
    background: linear-gradient(135deg, #6a1b9a, #ab47bc);
    overflow: hidden;
}
.tienda-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    filter: blur(2px);
}
.tienda-hero-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
}
.tienda-hero h1 {
    font-size: clamp(26px, 4vw, 38px);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tienda-verificado-big {
    background: #43a047;
    color: white;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
}

.tienda-hero-loc {
    font-size: 15px;
    opacity: 0.92;
}

.tienda-detalle-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 28px;
    max-width: 1200px;
    margin: 0 auto;
}

.tienda-galeria {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.tienda-galeria-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    display: block;
}
.tienda-galeria-item:hover { transform: scale(1.04); }
.tienda-galeria-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tienda-contact-card .tienda-contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f8fbfe;
    border-radius: 10px;
    margin-bottom: 8px;
    text-decoration: none;
    color: var(--c-text);
    font-size: 14px;
    transition: all 0.2s;
}
.tienda-contact-card .tienda-contact-row:hover {
    background: #e3f2fd;
    transform: translateX(2px);
    color: var(--c-text);
}
.tienda-contact-card .tienda-contact-row.tienda-contact-wa {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

/* ==================== POPUP ESPECIE DESTACADA ==================== */
.popup-especie-destacada {
    background: linear-gradient(135deg, #fff, #f8fbfe);
    border-left: 5px solid;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(10, 61, 98, 0.08);
}

.ped-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ped-icon { font-size: 28px; }

.ped-header strong {
    display: block;
    font-size: 16px;
    color: var(--c-profundo);
}
.ped-header em {
    display: block;
    font-size: 12px;
    color: var(--c-muted);
    font-style: italic;
}

.ped-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.ped-img-placeholder {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
}

.ped-desc {
    font-size: 13px;
    color: var(--c-text);
    line-height: 1.5;
    margin-bottom: 10px;
}

.ped-meta {
    background: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 10px;
    color: var(--c-profundo);
}

.ped-link {
    display: inline-block;
    color: var(--c-agua);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 0;
    border-top: 1px solid #e3f2fd;
    width: 100%;
    text-align: center;
    margin-top: 6px;
}
.ped-link:hover { color: var(--c-profundo); }

/* ==================== ADMIN TABLE WRAP (para móvil) ==================== */
.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==================== MOBILE RESPONSIVE ==================== */

/* Toggle de filtros mobile - oculto por defecto */
.mobile-filters-toggle {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 15;
    padding: 10px 16px;
    background: white;
    border: none;
    border-radius: 25px;
    box-shadow: 0 4px 14px rgba(10, 61, 98, 0.2);
    font-size: 13px;
    font-weight: 700;
    color: var(--c-profundo);
    cursor: pointer;
    font-family: inherit;
}

@media (max-width: 768px) {
    /* === Mapa === */
    .mapa-wrapper {
        flex-direction: column;
        height: calc(100vh - 60px);
        position: relative;
    }
    
    .mobile-filters-toggle { display: block; }
    
    /* Sidebar pasa a overlay deslizable desde la izquierda */
    .mapa-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 88%;
        max-width: 340px;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
        margin: 0 !important;
    }
    .mapa-sidebar.mobile-open {
        transform: translateX(0);
    }
    .mapa-sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .mapa-container { width: 100%; height: 100%; }
    
    /* Overlay oscuro cuando sidebar está abierta */
    .mapa-sidebar.mobile-open::after {
        content: '';
        position: fixed;
        top: 0; left: 88%;
        right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
    }
    
    .map-controls-overlay {
        top: auto;
        bottom: 90px;
        left: 14px;
    }
    
    /* === Navegación === */
    .nav-container { padding: 0 16px; }
    .nav-toggle { display: flex; }
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        gap: 4px;
        box-shadow: var(--shadow-md);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }
    .nav-menu li { width: 100%; }
    .nav-menu a { display: block; padding: 14px 16px; }
    
    /* === Tiendas === */
    .tiendas-grid { grid-template-columns: 1fr; }
    .tiendas-filters .filtros-grid { grid-template-columns: 1fr 1fr; }
    .tienda-detalle-grid { grid-template-columns: 1fr; }
    .tienda-galeria { grid-template-columns: repeat(2, 1fr); }
    
    /* === Wiki / Listados === */
    .wiki-grid, .destacadas-grid, .capturas-grid, .competencias-list {
        grid-template-columns: 1fr;
    }
    .wiki-filters { padding: 16px; }
    .filter-group { flex-direction: column; align-items: flex-start; gap: 8px; }
    .filter-group label { min-width: auto; }
    
    /* === Especies detalle === */
    .especie-grid, .noticia-body-wrapper, .comp-detalle-grid { grid-template-columns: 1fr; }
    .galeria-thumbs { grid-template-columns: repeat(4, 1fr); }
    
    /* === Carnadas === */
    .carnada-item { flex-direction: column; }
    .carnada-img { width: 100%; height: 160px; }
    
    /* === Salón de la fama === */
    .podio-grid { grid-template-columns: repeat(2, 1fr); }
    .subespecies-grid { grid-template-columns: 1fr; }
    
    /* === Competencias === */
    .competencia-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .comp-fecha {
        width: auto;
        align-self: flex-start;
        flex-direction: row;
        gap: 6px;
        padding: 8px 14px;
    }
    .comp-cta { align-self: flex-end; }
    
    /* === Forms === */
    .form-row, .form-row-3, .admin-form .form-row, .admin-form .form-row-3 {
        grid-template-columns: 1fr !important;
    }
    .admin-grid-2-form, .admin-grid-2 { grid-template-columns: 1fr; }
    
    /* === Admin === */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 250px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .admin-sidebar.mobile-open { transform: translateX(0); }
    
    .admin-topbar {
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 50;
        gap: 10px;
    }
    .admin-topbar h1 { font-size: 18px; }
    .admin-content { padding: 14px; }
    
    .admin-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .admin-stat-card { padding: 14px; }
    .stat-icon-big { width: 44px; height: 44px; font-size: 22px; }
    .stat-number { font-size: 22px; }
    
    /* Tabla con scroll horizontal */
    .admin-table { font-size: 13px; }
    .admin-table th, .admin-table td { padding: 10px 8px; }
    
    /* === Hero secciones === */
    .wiki-hero, .salon-hero, .competencias-hero, .tiendas-hero {
        padding: 40px 18px;
    }
    
    /* === Auth === */
    .auth-card { padding: 28px 22px; }
    
    /* === Especies === */
    .especie-hero { padding: 40px 18px; }
    .radio-cards { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .rc-icon { font-size: 18px; }
    .rc-label { font-size: 11px; }
}

@media (max-width: 480px) {
    .tiendas-filters .filtros-grid { grid-template-columns: 1fr; }
    .podio-grid { grid-template-columns: 1fr; }
    .galeria-thumbs { grid-template-columns: repeat(3, 1fr); }
    .admin-stats-grid { grid-template-columns: 1fr; }
    
    .nav-brand { font-size: 16px; }
    .brand-icon { font-size: 22px; }
    
    .hero-stats { gap: 24px; }
    .hero-stat .n { font-size: 26px; }
    
    /* Popup más chico */
    .custom-popup .mapboxgl-popup-content { max-width: 90vw !important; }
    
    /* CTA de hero un poco más cerrado */
    .hero-cta { flex-direction: column; }
    .hero-cta .btn { width: 100%; justify-content: center; }
}

/* ============ Mobile-friendly form fields ============ */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="search"],
    input[type="password"],
    input[type="url"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px !important; /* Evita el zoom auto en iOS */
    }
}

/* Botón hamburguesa en admin para mobile */
.admin-mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--c-profundo);
    padding: 4px 10px;
}
@media (max-width: 768px) {
    .admin-mobile-menu-btn { display: inline-block; }
}
