@media (max-width: 1024px) {
  .container {
    padding: 0 1.2rem;
  }

  #navbar {
    padding: 1rem 0;
  }

  .nav-inner {
    gap: 0.9rem;
  }

  .nav-logo-name {
    font-size: 1.15rem;
  }

  .nav-logo-tagline {
    font-size: 0.54rem;
    letter-spacing: 0.16em;
  }

  .nav-links a {
    font-size: 0.78rem;
    padding: 0.42rem 0.68rem;
  }

  .nav-actions {
    gap: 0.4rem;
  }

  .nav-search-compact {
    min-width: 160px;
    max-width: 180px;
  }

  .nav-search-compact input {
    padding: 0.3rem 0.6rem;
    font-size: 0.76rem;
  }

  .lang-current-btn,
  .lang-btn {
    min-width: 50px;
    height: 34px;
    font-size: 0.72rem;
  }

  .hero-title,
  .display-xl {
    font-size: clamp(2.4rem, 5vw, 4rem);
  }

  .hero-subtitle {
    max-width: 100%;
  }

  .hero-ctas {
    padding-left: 0.4rem;
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-table {
    min-width: 1120px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  #navbar {
    padding: 0.85rem 0;
  }

  #navbar.scrolled {
    padding: 0.7rem 0;
  }

  .nav-inner {
    gap: 0.55rem;
  }

  .nav-logo {
    min-width: 0;
  }

  .nav-logo-name {
    font-size: 1rem;
  }

  .nav-logo-tagline {
    font-size: 0.5rem;
    letter-spacing: 0.15em;
  }

  .nav-links {
    display: none;
  }

  .nav-actions {
    gap: 0.32rem;
    flex-shrink: 0;
  }

  /* Positioning context on nav-inner so dropdown is anchored to full navbar width */
  .nav-inner {
    position: relative;
  }

  .nav-search-compact {
    display: none;
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    min-width: 0;
    max-width: none;
    z-index: 10050;
    padding: 0.16rem;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
  }

  .nav-search-compact.is-open {
    display: flex;
  }

  .nav-search-compact form {
    width: 100%;
  }

  .nav-search-compact input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
  }

  .nav-search-compact button {
    display: none;
  }

  .nav-search-toggle,
  .lang-current-btn,
  .nav-login-btn,
  .admin-gear-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .lang-current-btn {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
  }

  .lang-switcher-menu {
    right: 0;
    z-index: 10055;
  }

  .lang-btn {
    min-width: 46px;
    height: 34px;
    padding: 0 0.6rem;
    font-size: 0.7rem;
  }

  #savedBtn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    font-size: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  #savedBtn::before {
    content: "♡";
    font-size: 1rem;
    line-height: 1;
    color: currentColor;
  }

  .request-notification-dot {
    top: 4px;
    right: 4px;
    width: 9px;
    height: 9px;
  }

  .nav-menu-toggle {
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
  }

  .hero-content,
  .compact-hero-content {
    padding-top: 6.8rem;
    padding-bottom: 2rem;
  }

  .hero-title,
  .display-xl {
    font-size: clamp(2rem, 9vw, 2.9rem);
    line-height: 1.04;
  }

  .display-lg {
    font-size: clamp(1.7rem, 7vw, 2.35rem);
    line-height: 1.08;
  }

  .hero-subtitle,
  .body-lg {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .hero-subtitle {
    margin-bottom: 1.35rem;
  }

  .search-hero {
    max-width: 100%;
    margin-bottom: 1.5rem;
  }

  .search-hero input {
    padding: 0.85rem 0.95rem;
    font-size: 0.86rem;
  }

  .search-hero button {
    padding: 0.48rem 0.9rem;
    font-size: 0.74rem;
  }

  .hero-ctas {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
    padding-left: 0;
    margin-bottom: 1.75rem;
  }

  .hero-ctas .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 1rem 1.4rem;
  }

  .hero-scroll-indicator {
    display: none !important;
  }

  .grid-2,
  .grid-3,
  .events-grid,
  .dynamic-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    gap: 0.55rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .filter-btn {
    white-space: nowrap;
  }

  .event-card-body,
  .venue-card-body,
  .exp-card-body {
    padding: 1rem;
    min-height: auto;
  }

  .event-card-title,
  .venue-card-name,
  .exp-card-title {
    font-size: 1rem;
  }

  .card-description-clamp {
    min-height: auto;
  }

  .club-card-footer,
  .event-card-footer,
  .venue-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .club-card-actions {
    width: 100%;
    justify-content: stretch;
  }

  .club-card-actions .btn,
  .event-card-footer .btn,
  .venue-card-footer .btn {
    flex: 1;
    justify-content: center;
  }

  .request-modal,
  .detail-modal,
  .content-modal {
    width: calc(100vw - 20px);
    max-height: min(calc(100dvh - 20px), calc(100vh - 20px));
    padding: 1rem;
    z-index: 10060;
  }

  .request-summary {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    line-height: 1.45;
    font-size: 0.94rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .request-summary strong {
    display: inline;
    font-size: 1rem;
    margin-right: 0.2rem;
  }

  .request-summary span {
    display: inline;
  }

  .request-grid {
    grid-template-columns: 1fr;
  }

  .detail-modal-media img {
    max-height: 260px;
  }

  .detail-modal-copy p {
    max-height: 9.2em;
  }

  .mobile-menu {
    padding-top: 5.5rem;
  }

  .admin-shell {
    padding-top: 5.6rem;
  }

  .admin-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .request-alert-anchor {
    padding-right: 1.6rem;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-panel-header,
  .admin-panel-header-stack,
  .request-alert-strip,
  .request-alert-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .content-filter-bar,
  .content-filter-bar-stack,
  .admin-filter-wrap {
    width: 100%;
    min-width: 0;
  }

  .admin-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
  }

  .admin-panel,
  .admin-subpanel,
  .admin-actions-menu-wrap,
  .admin-table td:last-child {
    overflow: visible;
  }

  .admin-table {
    min-width: 980px;
  }

  .admin-owner-select {
    min-width: 160px;
  }

  .admin-cell-ellipsis,
  .admin-cell-clamp-1 {
    max-width: 100%;
  }

  .content-preview-card {
    grid-template-columns: 1fr;
  }

  .content-preview-card img {
    max-width: 100%;
  }

  .request-alert-list {
    gap: 0.65rem;
  }

  .request-alert-actions {
    width: 100%;
  }

  .request-alert-actions .btn {
    flex: 1 1 calc(50% - 0.4rem);
    justify-content: center;
  }

  .concierge-options {
    flex-direction: column;
    align-items: center;
  }

  .must-tabs {
    width: 100%;
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  #chatbot-panel {
    right: 10px;
    left: 10px;
    bottom: 68px;
    width: auto;
    height: auto;
    max-height: min(70dvh, 70vh);
    min-height: 320px;
    border-radius: 20px;
    overflow: hidden;
  }

  #chatbot-toggle {
    right: 10px;
    bottom: 10px;
    padding: 0.72rem 0.95rem;
    font-size: 0.78rem;
    max-width: calc(100vw - 20px);
  }

  .chatbot-header {
    padding: 0.9rem 0.95rem;
  }

  .chatbot-messages {
    max-height: min(42dvh, 42vh);
    padding: 0.9rem 0.95rem;
  }

  .chatbot-suggestions {
    padding: 0 0.95rem 0.85rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .chatbot-form {
    padding: 0.85rem 0.95rem 0.95rem;
  }

  .chatbot-form input {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .nav-search-compact {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }

  .nav-search-compact input {
    font-size: 0.76rem;
  }

  .nav-search-toggle,
  .lang-current-btn,
  .lang-btn,
  #savedBtn,
  .nav-login-btn,
  .admin-gear-btn {
    height: 36px;
  }

  .request-summary {
    font-size: 0.9rem;
  }

  .hero-title,
  .display-xl {
    font-size: clamp(1.85rem, 9vw, 2.5rem);
  }

  .section {
    padding: 3.6rem 0;
  }

  .admin-thumb {
    width: 56px;
    height: 56px;
  }
}

@media (max-width: 420px) {
  .container {
    padding: 0 0.85rem;
  }

  .nav-logo-name {
    font-size: 0.94rem;
  }

  .nav-logo-tagline {
    font-size: 0.46rem;
  }

  .nav-actions {
    gap: 0.24rem;
  }

  .nav-search-compact {
    left: 0.4rem;
    right: 0.4rem;
    width: auto;
  }

  .nav-search-compact input {
    padding: 0.52rem 0.65rem;
  }

  .request-summary {
    padding: 0.85rem 0.9rem;
    font-size: 0.88rem;
  }

  .request-summary strong {
    display: block;
    margin-bottom: 0.2rem;
  }

  .request-summary span {
    display: block;
  }

  .search-hero input {
    padding: 0.8rem 0.85rem;
  }

  .search-hero button {
    padding: 0.45rem 0.78rem;
  }

  .concierge-inner {
    padding: 2.3rem 1.15rem;
  }

  #chatbot-panel {
    right: 8px;
    left: 8px;
    bottom: 64px;
    max-height: min(68dvh, 68vh);
  }

  #chatbot-toggle {
    right: 8px;
    left: auto;
    bottom: 8px;
  }
}


/* V36 mobile admin + search refinements */
@media (max-width: 768px) {
  .hero-search-feedback {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
    border-radius: 16px;
  }

  .admin-form-intro {
    padding: 0.82rem 0.92rem;
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .content-modal {
    width: calc(100vw - 16px);
    max-width: none;
    padding: 0.95rem;
  }

  .popup-config-grid-stacked {
    grid-template-columns: 1fr;
  }

  .admin-table {
    min-width: 900px;
  }

  .admin-registry-table {
    min-width: 760px;
  }

  .admin-config-table {
    min-width: 760px;
  }

  .admin-subpanel-header .btn {
    width: 100%;
    justify-content: center;
  }
}


/* V37 mobile density */
@media (max-width: 768px) {
  .consent-check input,
  .admin-switch input,
  .field input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-height: 15px;
  }

  .request-actions {
    gap: 0.45rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.52rem 0.55rem;
  }

  .admin-tag-option span {
    min-height: 30px;
    font-size: 0.75rem;
  }
}

/* ── Hero background: ottimizzazione per schermi Retina mobile ─── */
/* Le foto landscape usate come sfondo in portrait vengono centrate
   al 30% verticale (mostra la parte alta dell'immagine, es. cielo/paesaggio)
   invece di center center che spesso taglia la parte migliore. */
@media (max-width: 768px) and (orientation: portrait) {
  .hero-bg[style*="background-image"] {
    background-position: center 30% !important;
  }
}

/* Retina 2x e 3x: forza qualità massima rendering background */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero-bg {
    image-rendering: -webkit-optimize-contrast;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
}
