﻿.search-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 0.75rem 4rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  .search-page * {
    min-width: 0;
  }

  .search-hero {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(4, 120, 87, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: 24px;
    padding: 1.6rem 1.4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  }

  .search-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.4), transparent 60%);
    opacity: 0.6;
  }

  .hero-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-green);
    font-size: 1.4rem;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.15);
    position: relative;
    z-index: 1;
  }

  .search-hero h1 {
    font-family: "Poppins", sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 800;
    margin: 0.85rem 0 0.35rem;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
  }

  .search-hero p {
    margin: 0;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    z-index: 1;
  }

  .search-bar {
    margin-top: 1.4rem;
    background: #fff;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .search-bar i {
    color: var(--text-secondary);
    margin-left: 0.35rem;
  }

  #search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 0.8rem 0.4rem;
    outline: none;
    min-width: 0;
    max-width: 100%;
  }

  .search-clear {
    border: none;
    background: rgba(16, 185, 129, 0.12);
    color: var(--secondary-green);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
  }

  .search-clear:hover {
    transform: translateY(-1px);
  }

  .search-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 0.5rem;
  }

  .pill {
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.08);
    color: var(--secondary-green);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
  }

  .pill:hover {
    background: var(--primary-green);
    color: #fff;
    transform: translateY(-1px);
  }

  .loading-indicator {
    display: none;
    text-align: center;
    margin-top: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
  }

  .loading-indicator.show {
    display: block;
  }

  .loading-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--primary-green);
    border-radius: 50%;
    margin: 0 2px;
    animation: pulse 1.4s infinite;
  }

  .loading-dot:nth-child(2) { animation-delay: 0.2s; }
  .loading-dot:nth-child(3) { animation-delay: 0.4s; }

  @keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
  }

  .results-section {
    margin-top: 1.6rem;
  }

  .results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
  }

  .results-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin: 0;
  }

  .results-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-green);
    background: rgba(16, 185, 129, 0.12);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
  }

  .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    min-width: 0;
  }

  .product-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
  }

  .product-media {
    height: 130px;
    position: relative;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(4, 120, 87, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-green);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    font-weight: 700;
  }

  .product-body {
    padding: 0.85rem;
    overflow-wrap: anywhere;
  }

  .product-name {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .product-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--secondary-green);
  }

  .product-meta {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .btn-add-cart {
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.55rem;
    border-radius: 10px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.12);
    color: var(--secondary-green);
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    cursor: pointer;
  }

  .btn-add-cart:hover {
    background: var(--primary-green);
    color: #fff;
    border-color: var(--primary-green);
  }

  .btn-add-cart.service {
    border-color: rgba(37, 99, 235, 0.25);
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
  }

  .btn-add-cart.service:hover {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
  }

  .shops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    min-width: 0;
  }

  .shop-card {
    background: #fff;
    border-radius: 16px;
    padding: 0.9rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
    display: flex;
    gap: 0.8rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow-wrap: anywhere;
  }

  .shop-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
  }

  .shop-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    flex-shrink: 0;
    overflow: hidden;
  }

  .shop-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .shop-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
  }

  .shop-description {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .shop-stats {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    min-width: 0;
  }

  .location-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
  }

  .location-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
  }

  .location-media-link {
    display: block;
    text-decoration: none;
    color: inherit;
  }

  .location-media {
    height: 130px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(180, 83, 9, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b45309;
    font-size: 1.65rem;
  }

  .location-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .location-body {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
  }

  .location-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .location-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
  }

  .location-price {
    font-size: 1rem;
    font-weight: 800;
    color: #b45309;
  }

  .location-actions {
    margin-top: auto;
    display: flex;
  }

  .btn-location-detail {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.42rem 0.72rem;
    border-radius: 10px;
    transition: all 0.2s ease;
  }

  .btn-location-detail:hover {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
  }

  .category-tag {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }

  .category-tag:hover {
    background: var(--primary-green);
    color: #fff;
    text-decoration: none;
  }

  .empty-results {
    text-align: center;
    padding: 3rem 1rem;
  }

  .empty-icon {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
    opacity: 0.6;
  }

  .empty-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
  }

  .empty-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
  }

  .search-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
    z-index: 9999;
    animation: slideIn 0.3s ease;
    max-width: min(calc(100vw - 1rem), 360px);
  }

  .search-toast.success {
    background: #10b981;
  }

  .search-toast.error {
    background: #ef4444;
  }

  @keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }

  @keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
  }

  @media (min-width: 768px) {
    .search-page {
      padding: 2.5rem 1.5rem 5rem;
    }

    .product-media {
      height: 150px;
    }
  }

  @media (max-width: 767.98px) {
    .search-page {
      padding-inline: 0.75rem;
    }

    #search-input {
      font-size: 16px;
    }

    .search-bar {
      gap: 0.45rem;
      padding-inline: 0.45rem;
    }

    .shops-grid,
    .locations-grid {
      grid-template-columns: 1fr;
    }

    .search-toast {
      left: 0.5rem;
      right: 0.5rem;
      width: auto;
      max-width: none;
    }
  }
