/* Modern Vanilla CSS for BuyMonitor Homepage Search Card */
/* Pure native CSS: Nesting, Variables, 0% Bulma dependency */

:root {
  --hs-primary: #2563eb;
  --hs-primary-hover: #1d4ed8;
  --hs-primary-light: #eff6ff;
  --hs-card-bg: #ffffff;
  --hs-subtle-bg: #f8fafc;
  --hs-input-bg: #f8fafc;
  --hs-border: #e2e8f0;
  --hs-border-hover: #cbd5e1;
  --hs-text-dark: #0f172a;
  --hs-text-muted: #64748b;
  --hs-radius: 16px;
}

.home-search-hero {
  padding: 1.25rem 0.5rem 0.75rem;
  text-align: center;
  max-width: 680px;
  margin: 0 auto 1.25rem;

  & .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--hs-primary-light);
    color: var(--hs-primary);
    border: 1px solid #bfdbfe;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.5rem;

    & .pulse-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--hs-primary);
      animation: hsPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }
  }

  & .hero-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--hs-text-dark);
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;

    @media (min-width: 640px) {
      font-size: 1.85rem;
    }

    & .highlight-city {
      color: var(--hs-primary);
    }
  }

  & .hero-subtitle {
    font-size: 0.85rem;
    color: var(--hs-text-muted);
    line-height: 1.4;
  }
}

@keyframes hsPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.home-search-card {
  background: var(--hs-card-bg);
  border: 2px solid var(--hs-border);
  border-radius: var(--hs-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  max-width: 680px;
  margin: 0 auto 1.5rem;

  /* Tab Header Bar */
  & .card-tabs {
    display: flex;
    border-bottom: 1px solid var(--hs-border);
    background: rgba(248, 250, 252, 0.8);
    font-size: 0.8rem;
    font-weight: 700;

    & .tab-btn {
      flex: 1;
      padding: 0.75rem 1rem;
      border: none;
      border-bottom: 2px solid transparent;
      background: transparent;
      color: var(--hs-text-muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: all 0.15s ease;
      font-family: inherit;

      &:hover {
        color: var(--hs-text-dark);
      }

      &.is-active {
        background: #ffffff;
        color: var(--hs-primary);
        border-bottom-color: var(--hs-primary);
      }
    }
  }

  /* Inner Panels */
  & .card-panel {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;

    &.is-hidden {
      display: none !important;
    }
  }

  /* Goods Search Form */
  & .goods-input-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    @media (min-width: 640px) {
      flex-direction: row;
    }

    & .search-field-box {
      flex: 1;
      display: flex;
      align-items: center;
      background: var(--hs-input-bg);
      border: 1px solid var(--hs-border);
      border-radius: 12px;
      padding: 0.45rem 0.75rem;
      transition: all 0.15s ease;

      &:focus-within {
        background: #ffffff;
        border-color: var(--hs-primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
      }

      & svg, & .fa-icon {
        color: #94a3b8;
        margin-right: 0.5rem;
        flex-shrink: 0;
      }

      & input {
        width: 100%;
        background: transparent;
        border: none;
        outline: none;
        font-size: 0.875rem;
        color: var(--hs-text-dark);
        font-family: inherit;

        &::placeholder {
          color: #94a3b8;
        }
      }
    }

    & .goods-submit-btn {
      background: var(--hs-primary);
      color: #ffffff;
      border: none;
      border-radius: 12px;
      padding: 0.55rem 1.25rem;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      white-space: nowrap;
      transition: background 0.15s ease;
      font-family: inherit;

      &:hover {
        background: var(--hs-primary-hover);
      }
    }
  }

  /* Goods Categories Strip */
  & .goods-categories-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;

    &::-webkit-scrollbar {
      display: none;
    }

    & .cat-chip {
      background: #f1f5f9;
      color: #334155;
      border: 1px solid transparent;
      border-radius: 8px;
      padding: 4px 10px;
      font-size: 0.75rem;
      font-weight: 600;
      white-space: nowrap;
      text-decoration: none;
      transition: all 0.15s ease;
      cursor: pointer;

      &:hover {
        background: #e2e8f0;
        color: #0f172a;
      }

      &.is-active {
        background: #0f172a;
        color: #ffffff;
      }
    }
  }

  /* Apartments Panel Controls */
  & .apts-top-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    font-size: 0.78rem;

    & .control-cluster {
      display: flex;
      align-items: center;
      gap: 6px;

      & .cluster-label {
        color: #94a3b8;
        font-weight: 700;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
      }

      & .segmented-group {
        display: inline-flex;
        background: #f1f5f9;
        padding: 2px;
        border-radius: 8px;

        & .seg-btn {
          border: none;
          background: transparent;
          color: #475569;
          font-weight: 600;
          font-size: 0.75rem;
          padding: 4px 10px;
          border-radius: 6px;
          cursor: pointer;
          transition: all 0.15s ease;
          font-family: inherit;

          &:hover {
            color: #0f172a;
          }

          &.is-selected {
            background: #ffffff;
            color: var(--hs-primary);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
            font-weight: 700;
          }
        }
      }

      & .room-chips {
        display: inline-flex;
        gap: 4px;

        & .room-btn {
          border: 1px solid transparent;
          background: #f1f5f9;
          color: #475569;
          font-size: 0.75rem;
          font-weight: 600;
          padding: 4px 9px;
          border-radius: 8px;
          cursor: pointer;
          transition: all 0.15s ease;
          font-family: inherit;

          &:hover {
            background: #e2e8f0;
          }

          &.is-selected {
            background: var(--hs-primary-light);
            border-color: #93c5fd;
            color: var(--hs-primary);
            font-weight: 700;
          }
        }
      }
    }
  }

  /* Price & Actions Row */
  & .apts-actions-row {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;

    @media (min-width: 640px) {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
    }

    & .price-inputs-cluster {
      display: flex;
      align-items: center;
      gap: 6px;

      & .price-label {
        font-size: 0.7rem;
        font-weight: 700;
        color: #94a3b8;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-right: 2px;
      }

      & .distinct-price-box {
        display: flex;
        align-items: center;
        background: #ffffff;
        border: 1px solid var(--hs-border);
        border-radius: 10px;
        padding: 5px 8px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
        transition: all 0.15s ease;

        &:focus-within {
          border-color: var(--hs-primary);
          box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
        }

        & .curr-symbol {
          font-size: 0.75rem;
          font-weight: 700;
          color: #64748b;
          margin-right: 4px;
        }

        & input {
          width: 60px;
          border: none;
          outline: none;
          background: transparent;
          font-size: 0.8rem;
          font-weight: 600;
          color: var(--hs-text-dark);
          font-family: inherit;

          @media (min-width: 640px) {
            width: 72px;
          }

          &::placeholder {
            color: #94a3b8;
            font-weight: 400;
          }
        }
      }

      & .range-sep {
        color: #cbd5e1;
        font-weight: 500;
      }
    }

    & .action-buttons-group {
      display: flex;
      align-items: center;
      gap: 8px;

      & .btn-on-map {
        background: #f1f5f9;
        color: #1e293b;
        border: 1px solid var(--hs-border);
        border-radius: 12px;
        padding: 0.55rem 0.95rem;
        font-size: 0.8rem;
        font-weight: 700;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        text-decoration: none;
        transition: all 0.15s ease;
        font-family: inherit;
        white-space: nowrap;

        &:hover {
          background: #e2e8f0;
          color: #0f172a;
        }

        & svg, & .fa-icon {
          color: var(--hs-primary);
        }
      }

      & .btn-show-flats {
        flex: 1;
        background: var(--hs-primary);
        color: #ffffff;
        border: none;
        border-radius: 12px;
        padding: 0.55rem 1.15rem;
        font-size: 0.82rem;
        font-weight: 700;
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.15s ease;
        font-family: inherit;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;

        &:hover {
          background: var(--hs-primary-hover);
        }

        & .count-number {
          font-weight: 800;
          color: #bfdbfe;
          text-decoration: underline;
          text-decoration-color: #60a5fa;
          text-underline-offset: 3px;
        }
      }
    }
  }

  /* Property Condition Chips */
  & .apts-conditions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;

    & .cond-chip {
      background: #f1f5f9;
      color: #334155;
      border: 1px solid transparent;
      border-radius: 8px;
      padding: 4px 10px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      transition: all 0.15s ease;
      font-family: inherit;

      &:hover {
        background: #e2e8f0;
      }

      &.is-active {
        background: var(--hs-primary);
        color: #ffffff;
      }

      &.is-emerald-active {
        background: #ecfdf5;
        border-color: #a7f3d0;
        color: #065f46;

        &.is-active {
          background: #059669;
          color: #ffffff;
          border-color: #059669;
        }
      }
    }
  }
}
