/* Custom PWA Styles per Hotel Vera - LAYOUT FIXES */

/* ==========================================
   RESET E BASE
   ========================================== */

   * {
    box-sizing: border-box;
  }
  
  html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  body {
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  }
  
  /* ==========================================
     LAYOUT FIXES - RESPONSIVE
     ========================================== */
  
  /* Assicura che i container non escano mai */
  .max-w-6xl {
    max-width: 100%;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  /* Grid responsive fix */
  .md\:grid-cols-12 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  @media (min-width: 768px) {
    .md\:grid-cols-12 {
      grid-template-columns: repeat(12, minmax(0, 1fr));
    }
    
    .md\:col-span-4 {
      grid-column: span 4 / span 4;
    }
    
    .md\:col-span-8 {
      grid-column: span 8 / span 8;
    }
    
    .max-w-6xl {
      max-width: 72rem;
      padding-left: 1rem;
      padding-right: 1rem;
    }
  }
  
  /* ==========================================
     BUTTON E INPUT FIXES
     ========================================== */
  
  /* Navigation buttons - dimensioni fisse */
  #nav-pills button {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    display: block;
    margin-bottom: 0.5rem;
  }
  
  #nav-pills button:hover {
    background: #e2e8f0;
  }
  
  #nav-pills button.active {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
  }
  
  /* Assicura che tutti i 5 bottoni siano visibili */
  #nav-pills {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 1fr;
  }
  
  /* Input fields - text wrapping fix */
  input, textarea, .form-field {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
  }
  
  /* Prevent text overflow in cards */
  .bg-white {
    overflow: hidden;
  }
  
  .bg-white * {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  /* ==========================================
     CARDS E CONTENUTO FIXES
     ========================================== */
  
  /* Card content non deve mai uscire */
  .rounded-2xl {
    overflow: hidden;
  }
  
  .rounded-xl {
    overflow: hidden;
  }
  
  /* Grid interno alle cards */
  .grid.grid-cols-12 {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  
  .col-span-7 {
    grid-column: span 7 / span 7;
  }
  
  .col-span-4 {
    grid-column: span 4 / span 4;
  }
  
  .col-span-1 {
    grid-column: span 1 / span 1;
  }
  
  /* Text truncation per contenuti lunghi */
  .text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .text-wrap {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* ==========================================
     RESPONSIVE TYPOGRAPHY
     ========================================== */
  
  /* Font sizes responsive */
  @media (max-width: 640px) {
    .text-lg {
      font-size: 1rem;
      line-height: 1.5rem;
    }
    
    .text-xl {
      font-size: 1.125rem;
      line-height: 1.75rem;
    }
    
    .font-black {
      font-size: 0.875rem;
    }
  }
  
  /* ==========================================
     SPACING FIXES
     ========================================== */
  
  /* Padding responsive */
  .p-4 {
    padding: 0.75rem;
  }
  
  @media (min-width: 768px) {
    .p-4 {
      padding: 1rem;
    }
  }
  
  /* Gap responsive */
  .gap-4 {
    gap: 0.75rem;
  }
  
  @media (min-width: 768px) {
    .gap-4 {
      gap: 1rem;
    }
  }
  
  .gap-3 {
    gap: 0.5rem;
  }
  
  .gap-2 {
    gap: 0.25rem;
  }
  
  /* ==========================================
     MENU SECTION FIXES
     ========================================== */
  
  /* Menu grids - responsive */
  .bg-slate-50.border.rounded-2xl {
    padding: 0.75rem;
    overflow: hidden;
  }
  
  .bg-slate-50.border.rounded-2xl .grid {
    gap: 0.25rem;
  }
  
  .bg-slate-50.border.rounded-2xl input,
  .bg-slate-50.border.rounded-2xl .bg-white {
    font-size: 0.75rem;
    padding: 0.5rem;
    min-height: auto;
  }
  
  /* ==========================================
     MOBILE OPTIMIZATIONS
     ========================================== */
  
  @media (max-width: 767px) {
    /* Stack tutto su mobile */
    .md\:grid-cols-12 {
      grid-template-columns: 1fr;
    }
    
    .md\:col-span-4,
    .md\:col-span-8 {
      grid-column: span 1;
    }
    
    /* Menu cards più piccole su mobile */
    .bg-slate-50.border.rounded-2xl {
      padding: 0.5rem;
    }
    
    .grid.grid-cols-12 {
      grid-template-columns: 2fr 1fr;
      gap: 0.25rem;
    }
    
    .col-span-7 {
      grid-column: span 1;
    }
    
    .col-span-4 {
      grid-column: span 1;
    }
    
    /* Font più piccoli su mobile */
    .font-semibold {
      font-size: 0.75rem;
    }
    
    .text-sm {
      font-size: 0.6875rem;
    }
    
    .text-xs {
      font-size: 0.625rem;
    }
  }
  
  /* ==========================================
     HEADER FIXES
     ========================================== */
  
  header {
    position: sticky;
    top: 0;
    z-index: 30;
  }
  
  header .font-black {
    font-size: 0.875rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
  }
  
  @media (min-width: 768px) {
    header .font-black {
      font-size: 1rem;
    }
  }
  
  /* ==========================================
     INSTALL PROMPT FIXES
     ========================================== */
  
  #install-prompt {
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100vw - 2rem);
    margin: 0 auto;
  }
  
  #install-prompt.show {
    transform: translateY(0);
  }
  
  /* ==========================================
     LOADING E ANIMAZIONI
     ========================================== */
  
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .animate-pulse {
    animation: pulse 2s infinite;
  }
  
  .animate-fade-in {
    animation: fadeIn 0.5s ease-out;
  }
  
  /* ==========================================
     SCROLLBAR
     ========================================== */
  
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
  
  ::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
  
  * {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
  }
  
  /* ==========================================
     TRANSITIONS
     ========================================== */
  
  * {
    transition: all 0.2s ease;
  }
  
  button:active {
    transform: scale(0.98);
  }
  
  /* ==========================================
     FOCUS STATES
     ========================================== */
  
  input:focus,
  button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  }
  
  /* ==========================================
     UTILITIES
     ========================================== */
  
  .hidden {
    display: none !important;
  }
  
  .block {
    display: block;
  }
  
  .flex {
    display: flex;
  }
  
  .grid {
    display: grid;
  }
  
  .space-y-4 > * + * {
    margin-top: 1rem;
  }
  
  .space-y-3 > * + * {
    margin-top: 0.75rem;
  }
  
  .space-y-2 > * + * {
    margin-top: 0.5rem;
  }
  
  .space-y-1 > * + * {
    margin-top: 0.25rem;
  }
  
  /* ==========================================
     CARDS ATTIVITA E CONVENZIONI - FIXES
     ========================================== */
  
  /* Activity and Convention cards */
  .space-y-3 > * + * {
    margin-top: 0.75rem;
  }
  
  .bg-slate-50.border.rounded-xl {
    overflow: hidden;
    word-wrap: break-word;
  }
  
  /* Icon containers */
  .w-16.h-16 {
    min-width: 4rem;
    min-height: 4rem;
    flex-shrink: 0;
  }
  
  /* Badge containers */
  .bg-emerald-100, .bg-red-100, .bg-blue-100, .bg-purple-100 {
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  /* Button groups in cards */
  .flex.gap-2 {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .flex.gap-2 button {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
  }
  
  /* ==========================================
     MOBILE RESPONSIVE FIXES PER NUOVE SEZIONI
     ========================================== */
  
  @media (max-width: 767px) {
    /* Activity cards su mobile */
    .bg-slate-50.border.rounded-xl .flex.items-start {
      flex-direction: column;
      align-items: flex-start;
    }
    
    .w-16.h-16 {
      width: 3rem;
      height: 3rem;
      margin-bottom: 0.5rem;
    }
    
    /* Typography più piccola su mobile */
    .font-semibold.text-slate-900 {
      font-size: 0.875rem;
    }
    
    .text-sm.text-slate-600 {
      font-size: 0.75rem;
    }
    
    .text-sm.text-slate-500 {
      font-size: 0.75rem;
      line-height: 1.2;
    }
    
    /* Badges responsive */
    .bg-emerald-100.text-emerald-700,
    .bg-red-100.text-red-700,
    .bg-blue-100.text-blue-700,
    .bg-purple-100.text-purple-700 {
      font-size: 0.625rem;
      padding: 0.125rem 0.5rem;
    }
    
    /* Button stack su mobile */
    .flex.gap-2 {
      margin-top: 0.5rem;
    }
    
    .flex.gap-2 button {
      font-size: 0.6875rem;
      padding: 0.25rem 0.5rem;
    }
  }
  
  /* ==========================================
     DARK MODE PREVENTION (for consistency)
     ========================================== */
  
  * {
    color-scheme: light;
  }
  .legend-distance { font-size: .9rem; color: #6b7280; margin: .25rem 0 .5rem; }
  
  /* ==========================================
   CARD LAYOUT FIXES - ATTIVITA/CONVENZIONI
   ========================================== */

.card-row {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

.card-img {
  width: 80px;
  height: 80px;
  border-radius: 0.5rem;
  object-fit: cover;
  flex-shrink: 0;
}

.card-body {
  flex: 1;
  min-width: 0; /* Importante per text wrapping */
}

.card-top {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
  word-wrap: break-word;
  /* RIMOSSO margin-right che causava problemi */
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: #10b981;
  color: white;
  width: fit-content;
}

.badge.travel {
  background: #ef4444;
  color: white;
  max-width: calc(100vw - 140px); /* Evita overflow */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .card-row {
    padding: 0.75rem;
    gap: 0.75rem;
  }
  
  .card-img {
    width: 60px;
    height: 60px;
  }
  
  .card-title {
    font-size: 0.875rem;
  }
  
  .badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
  }
  
  .badge.travel {
    max-width: calc(100vw - 120px);
  }
}