/* ========================================
   MODAL DE BÚSQUEDA PROFESIONAL
   Diseño moderno y funcional para móviles
   ======================================== */

/* Overlay del modal */
.search-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
  }
  
  .search-modal-overlay.active {
    display: flex;
    flex-direction: column;
  }
  
  /* Contenedor principal del modal */
  .search-modal {
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Header del modal */
  .search-modal-header {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    padding: 1rem;
    border-bottom: 2px solid #e74c3c;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
  }
  
  .search-modal-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
  }
  
  /* Botón de cerrar */
  .search-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
  }
  
  .search-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }
  
  .search-modal-close:active {
    transform: scale(0.95);
  }
  
  .search-modal-close svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
    stroke-width: 2.5;
  }
  
  /* Contenedor del input */
  .search-modal-input-container {
    position: relative;
    flex: 1;
  }
  
  .search-modal-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 3rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    color: #2d3748;
  }
  
  .search-modal-input:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15), 0 4px 15px rgba(0, 0, 0, 0.15);
    background: #ffffff;
  }
  
  .search-modal-input::placeholder {
    color: #718096;
    font-weight: 500;
  }
  
  /* Icono de búsqueda */
  .search-modal-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
  }
  
  .search-modal-icon svg {
    width: 20px;
    height: 20px;
    stroke: #718096;
    stroke-width: 2.5;
  }
  
  /* Botón de limpiar */
  .search-modal-clear {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(231, 76, 60, 0.1);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
  }
  
  .search-modal-clear.visible {
    display: flex;
  }
  
  .search-modal-clear:hover {
    background: rgba(231, 76, 60, 0.2);
    transform: translateY(-50%) scale(1.1);
  }
  
  .search-modal-clear:active {
    transform: translateY(-50%) scale(0.95);
  }
  
  .search-modal-clear svg {
    width: 14px;
    height: 14px;
    stroke: #e74c3c;
    stroke-width: 3;
  }
  
  /* Contenedor de resultados */
  .search-modal-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #f7fafc;
  }
  
  /* Estado vacío / sugerencias */
  .search-modal-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  
  .search-modal-empty-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #e74c3c, #c53030);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.3);
  }
  
  .search-modal-empty-icon svg {
    width: 40px;
    height: 40px;
    stroke: #ffffff;
    stroke-width: 2;
  }
  
  .search-modal-empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
  }
  
  .search-modal-empty-subtitle {
    font-size: 0.95rem;
    color: #718096;
    margin: 0;
    max-width: 280px;
  }
  
  /* Sugerencias de búsqueda */
  .search-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    padding: 0 1rem;
  }
  
  .search-suggestion-chip {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  }
  
  .search-suggestion-chip:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2);
  }
  
  .search-suggestion-chip:active {
    transform: translateY(0);
  }
  
  /* Contenedor de resultados */
  .search-results-container {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
  }
  
  /* Mensaje de carga */
  .search-loading {
    padding: 3rem 1.5rem;
    text-align: center;
  }
  
  .search-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(231, 76, 60, 0.2);
    border-top-color: #e74c3c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
  }
  
  .search-loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
  }
  
  /* Mensaje sin resultados */
  .search-no-results {
    padding: 3rem 1.5rem;
    text-align: center;
  }
  
  .search-no-results-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #cbd5e0, #a0aec0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  }
  
  .search-no-results-icon svg {
    width: 35px;
    height: 35px;
    stroke: #ffffff;
    stroke-width: 2;
  }
  
  .search-no-results-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 0.5rem;
  }
  
  .search-no-results-subtitle {
    font-size: 0.95rem;
    color: #718096;
    margin: 0;
  }
  
  /* Sección de resultados */
  .search-results-section {
    margin-bottom: 1.5rem;
  }
  
  .search-results-section:last-child {
    margin-bottom: 0;
  }
  
  .search-results-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0 0.25rem;
  }
  
  .search-results-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #e74c3c, #c53030);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  
  .search-results-icon svg {
    width: 18px;
    height: 18px;
    stroke: #ffffff;
    stroke-width: 2.5;
  }
  
  .search-results-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    flex: 1;
  }
  
  .search-results-count {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 12px;
  }
  
  /* Grid de resultados */
  .search-results-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
  }
  
  /* Tarjeta de resultado */
  .search-result-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
  }
  
  .search-result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #e74c3c;
  }
  
  .search-result-card:active {
    transform: translateY(-1px);
  }
  
  .search-result-content {
    display: flex;
    gap: 1rem;
    padding: 1rem;
  }
  
  .search-result-image {
    width: 90px;
    height: 90px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
  }
  
  .search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
  }
  
  .search-result-name {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
  }
  
  .search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
  }
  
  .search-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #f7fafc;
    color: #718096;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
  }
  
  .search-result-badge svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.5;
  }
  
  .search-result-badge.open {
    background: rgba(56, 161, 105, 0.1);
    color: #38a169;
  }
  
  .search-result-badge.closed {
    background: rgba(197, 48, 48, 0.1);
    color: #c53030;
  }
  
  .search-result-price {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
  }
  
  .search-result-description {
    font-size: 0.85rem;
    color: #718096;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
  }
  
  /* Animaciones */
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  
  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
  
  /* Responsive: Tablets */
  @media (min-width: 640px) {
    .search-modal-header {
      padding: 1.25rem 1.5rem;
    }
    
    .search-modal-input {
      font-size: 1.1rem;
      padding: 0.85rem 3.5rem 0.85rem 3.5rem;
    }
    
    .search-modal-close {
      width: 45px;
      height: 45px;
    }
    
    .search-modal-icon svg,
    .search-modal-clear svg {
      width: 22px;
      height: 22px;
    }
    
    .search-results-container {
      padding: 1.5rem;
    }
    
    .search-results-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  /* Responsive: Desktop */
  @media (min-width: 1024px) {
    .search-modal {
      max-width: 900px;
      max-height: 85vh;
      margin: auto;
      border-radius: 20px;
      overflow: hidden;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }
    
    .search-modal-overlay {
      align-items: center;
      justify-content: center;
      padding: 2rem;
    }
    
    .search-modal-header {
      border-radius: 20px 20px 0 0;
    }
    
    .search-results-grid {
      grid-template-columns: 1fr;
    }
  }
  
  /* Safari fixes */
  @supports (-webkit-touch-callout: none) {
    .search-modal-input {
      font-size: 16px; /* Prevenir zoom en iOS */
    }
  }
  
  /* Accesibilidad */
  @media (prefers-reduced-motion: reduce) {
    .search-modal-overlay,
    .search-modal,
    * {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }