/* Esplora mobile — liquid glass parity desktop (#explore-wrap) ≤900px */

@media (max-width: 900px) {
  .mt-dashboard #view-explore {
    position: relative;
    background: var(--mt-bg) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 !important;
  }

  .mt-dashboard #view-explore::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(ellipse 95% 55% at 100% -8%, rgba(124, 92, 246, 0.16), transparent 58%),
      radial-gradient(ellipse 75% 50% at -8% 32%, rgba(167, 139, 250, 0.11), transparent 52%),
      radial-gradient(ellipse 65% 42% at 50% 108%, rgba(102, 71, 224, 0.07), transparent 55%);
  }

  #explore-wrap {
    position: relative;
    z-index: 1;
    padding: 0 14px 36px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #explore-wrap .mt-glass {
    background: var(--mt-glass-bg-strong);
    backdrop-filter: blur(28px) saturate(195%);
    -webkit-backdrop-filter: blur(28px) saturate(195%);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--mt-radius-lg);
    box-shadow:
      0 12px 36px rgba(31, 38, 68, 0.11),
      0 4px 14px rgba(124, 92, 246, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.96),
      inset 0 -18px 32px rgba(124, 92, 246, 0.06);
    position: relative;
    overflow: hidden;
    isolation: isolate;
  }

  #explore-wrap .mt-glass > * {
    position: relative;
    z-index: 1;
  }

  #explore-wrap > .mt-explore-hero-grid {
    display: flex !important;
    flex-direction: column;
    gap: 14px;
    margin: 14px 0 0;
  }

  #explore-wrap .mt-hero {
    padding: 22px 18px 20px;
  }

  #explore-wrap .mt-hero-wave {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 280px;
    height: 280px;
    z-index: 0;
    pointer-events: none;
  }

  #explore-wrap .mt-hero-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
  }

  #explore-wrap .mt-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mt-text-tertiary);
    margin-bottom: 4px;
  }

  #explore-wrap .mt-hero-name {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--mt-text-primary);
    line-height: 1.15;
  }

  #explore-wrap .mt-hero-insight {
    font-size: 13px;
    color: var(--mt-text-secondary);
    margin-top: 8px;
    line-height: 1.45;
  }

  #explore-wrap .mt-hero-insight b {
    color: var(--mt-text-primary);
    font-weight: 600;
  }

  #explore-wrap .mt-scope-tag {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    color: var(--mt-text-secondary);
    white-space: normal;
  }

  #explore-wrap .mt-explore-rail {
    padding: 18px 16px;
  }

  #explore-wrap .mt-explore-rail-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mt-text-tertiary);
    margin-bottom: 10px;
  }

  #explore-wrap .mt-explore-view-toggle {
    flex-direction: row;
    gap: 8px;
  }

  #explore-wrap .mt-explore-view-btn {
    flex: 1;
    justify-content: center;
    padding: 11px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.72);
    -webkit-tap-highlight-color: transparent;
  }

  #explore-wrap .mt-explore-view-btn.active {
    background: linear-gradient(135deg, rgba(124, 92, 246, 0.22), rgba(124, 92, 246, 0.08));
    border-color: rgba(124, 92, 246, 0.28);
    color: var(--mt-purple-deep);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 4px 14px rgba(124, 92, 246, 0.12);
  }

  /* Contenuto embed */
  #explore-iframe-wrap.mt-explore-body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--mt-glass-bg-strong);
    backdrop-filter: blur(28px) saturate(195%);
    -webkit-backdrop-filter: blur(28px) saturate(195%);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--mt-radius-lg);
    box-shadow:
      0 12px 36px rgba(31, 38, 68, 0.11),
      0 4px 14px rgba(124, 92, 246, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.96),
      inset 0 -18px 32px rgba(124, 92, 246, 0.06);
    height: auto !important;
    min-height: 0 !important;
  }

  #explore-iframe-wrap #iframe-explore {
    width: 100% !important;
    border: none !important;
    display: block !important;
    height: 520px !important;
    min-height: 400px !important;
    border-radius: 0 0 var(--mt-radius-lg) var(--mt-radius-lg);
  }

  /* Embed interno — griglia card su mobile */
  .mt-explore-embed .profiles-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .mt-explore-embed .explore-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 14px 0 !important;
    margin-bottom: 10px !important;
  }

  .mt-explore-embed .mt-explore-search {
    max-width: none;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .mt-explore-embed .mt-explore-search input {
    font-size: 16px;
  }

  /* Barra filtri mobile — pulsante + chip attivi */
  .mt-explore-embed .mt-explore-filter-mobile-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mt-explore-embed .mt-explore-filter-sheet {
    display: block;
  }

  .mt-explore-embed .explore-filter-desktop-slot {
    display: none !important;
  }

  .mt-explore-embed .mt-explore-filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-start;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--mt-text-primary);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(124, 92, 246, 0.08);
  }

  .mt-explore-embed .mt-explore-filters-btn.has-filters {
    border-color: rgba(124, 92, 246, 0.35);
    background: linear-gradient(135deg, rgba(124, 92, 246, 0.16), rgba(124, 92, 246, 0.06));
    color: var(--mt-purple-deep);
  }

  .mt-explore-embed .mt-explore-filter-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--mt-purple);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
  }

  .mt-explore-embed .mt-explore-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .mt-explore-embed .mt-explore-active-chips:empty {
    display: none;
  }

  .mt-explore-embed .mt-explore-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(124, 92, 246, 0.22);
    background: rgba(124, 92, 246, 0.1);
    color: var(--mt-purple-deep);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mt-explore-embed .mt-explore-chip-label {
    color: var(--mt-text-tertiary);
    font-weight: 500;
  }

  .mt-explore-embed .mt-explore-chip-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
  }

  .mt-explore-embed .mt-explore-chip-x {
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
    margin-left: 2px;
  }

  /* Bottom sheet filtri */
  .mt-explore-embed .mt-explore-filter-sheet {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
    visibility: hidden;
  }

  .mt-explore-embed .mt-explore-filter-sheet.is-open {
    pointer-events: auto;
    visibility: visible;
  }

  .mt-explore-embed .mt-explore-filter-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 12, 28, 0.42);
    opacity: 0;
    transition: opacity 0.22s ease;
  }

  .mt-explore-embed .mt-explore-filter-sheet.is-open .mt-explore-filter-sheet-backdrop {
    opacity: 1;
  }

  .mt-explore-embed .mt-explore-filter-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(88dvh, 640px);
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 -12px 40px rgba(31, 38, 68, 0.18);
    transform: translateY(105%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mt-explore-embed .mt-explore-filter-sheet.is-open .mt-explore-filter-sheet-panel {
    transform: translateY(0);
  }

  .mt-explore-embed .mt-explore-filter-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 10px;
    flex-shrink: 0;
  }

  .mt-explore-embed .mt-explore-filter-sheet-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--mt-text-primary);
  }

  .mt-explore-embed .mt-explore-filter-sheet-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: var(--mt-text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mt-explore-embed .explore-filter-mobile-slot {
    flex: 1;
    overflow-y: auto;
    padding: 4px 18px 12px;
    -webkit-overflow-scrolling: touch;
  }

  .mt-explore-embed .explore-filter-mobile-slot .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .mt-explore-embed .explore-filter-mobile-slot .filter-field {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .mt-explore-embed .explore-filter-mobile-slot .filter-field-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mt-text-tertiary);
  }

  .mt-explore-embed .explore-filter-mobile-slot .filter-select {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px 36px 12px 14px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(124, 92, 246, 0.14);
    color: var(--mt-text-primary);
    flex-shrink: 1;
  }

  .mt-explore-embed .explore-filter-mobile-slot .filter-reset-btn--inline {
    display: none;
  }

  .mt-explore-embed .mt-explore-filter-sheet-footer {
    display: flex;
    gap: 10px;
    padding: 12px 18px 18px;
    border-top: 1px solid rgba(124, 92, 246, 0.1);
    flex-shrink: 0;
  }

  .mt-explore-embed .mt-explore-filter-reset,
  .mt-explore-embed .mt-explore-filter-apply {
    flex: 1;
    min-height: 48px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mt-explore-embed .mt-explore-filter-reset {
    background: rgba(217, 66, 90, 0.1);
    color: #D9425A;
    border: 1px solid rgba(217, 66, 90, 0.22);
  }

  .mt-explore-embed .mt-explore-filter-apply {
    background: linear-gradient(135deg, #7C5CF6, #6647E0);
    color: #fff;
    box-shadow: 0 6px 18px rgba(124, 92, 246, 0.28);
  }

  body.explore-filter-sheet-open {
    overflow: hidden !important;
  }

  .mt-explore-embed .results-info {
    padding: 0 14px !important;
  }

  .mt-explore-embed .grid-view.active {
    padding: 0 14px 14px !important;
  }

  .mt-explore-embed .mt-explore-map-card {
    height: 380px !important;
    margin: 0 14px 14px;
    border-radius: var(--mt-radius-md);
  }

  .mt-explore-embed .map-view.active {
    padding-bottom: 14px;
  }
}
