/* =========================================================
   SEARCH
   ========================================================= */

.search-section {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
  max-width: 1200px;
}

/* =========================
   SEARCH BAR
   ========================= */

.main-search-input {
  position: relative;
  z-index: 20;

  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid rgba(11, 95, 255, 0.12);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 12px 28px rgba(8, 27, 70, 0.1);
}

.main-search-input-item {
  flex: 1;
  min-width: 0;
  padding: 0 20px;
  border-right: 1px solid rgba(11, 95, 255, 0.08);
}

.main-search-input-item:last-of-type {
  border-right: none;
}

/* =========================
   TEXT INPUT
   ========================= */

.main-search-input input[type="text"] {
  width: 100%;
  height: 45px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.main-search-input input[type="text"]::placeholder {
  color: var(--muted);
}

.main-search-input input[type="text"]:focus {
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* =========================
   CUSTOM SELECT
   ========================= */

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  position: relative;
  display: flex;
  align-items: center;

  width: 100%;
  height: 45px;
  padding: 0 40px 0 0;

  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.custom-select-trigger:focus-visible {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.custom-select-value {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%) rotate(0deg);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
  transition: transform 0.2s ease, color 0.2s ease;
}

.custom-select.is-open .custom-select-arrow {
  transform: translateY(-50%) rotate(180deg);
  color: var(--primary);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 35;

  width: 100%;
  margin: 0;
  padding: 8px;

  list-style: none;
  background: #fff;
  border: 1px solid rgba(11, 95, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 32px rgba(8, 27, 70, 0.14);

  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;

  max-height: 260px;
  overflow-y: auto;
}

.custom-select.is-open .custom-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-option {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.custom-select-option:hover,
.custom-select-option.is-active {
  background: rgba(11, 95, 255, 0.08);
}

.custom-select-option.is-selected {
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.1), rgba(0, 184, 148, 0.08));
  color: var(--primary-dark);
  font-weight: 700;
}

/* =========================
   SEARCH BUTTON
   ========================= */

.main-search-input .button {
  height: 50px;
  padding: 0 30px;
  border: none;
  border-radius: 50px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;

  background: linear-gradient(135deg, var(--primary), #2f7dff);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;

  box-shadow: 0 8px 20px rgba(11, 95, 255, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.main-search-input .button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(11, 95, 255, 0.35);
}

/* =========================
   SEARCH RESULTS DROPDOWN
   ========================= */

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 15;

  width: 100%;
  max-height: 420px;
  overflow-y: auto;

  padding: 18px 16px 16px;
  background: #ffffff;
  border: 1px solid rgba(11, 95, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(8, 27, 70, 0.14);
}

.search-results[hidden] {
  display: none;
}

.search-results-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  padding-right: 42px;
}

.search-results-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.search-results-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.search-results-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;

  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(11, 95, 255, 0.08);
  color: var(--primary-dark);
  cursor: pointer;

  transition: background 0.2s ease, transform 0.2s ease;
}

.search-results-close:hover {
  background: rgba(11, 95, 255, 0.16);
  transform: scale(1.05);
}

.search-results-list {
  display: grid;
  gap: 10px;
}

.search-result-item {
  border: 1px solid rgba(11, 95, 255, 0.08);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.search-result-item:hover {
  border-color: rgba(11, 95, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(8, 27, 70, 0.08);
}

.search-result-item a {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
}

.search-result-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--text);
}

.search-result-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

.search-result-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 8px;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;

  background: rgba(11, 95, 255, 0.08);
  color: var(--primary-dark);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-results-empty {
  padding: 6px 2px;
  color: var(--muted);
  line-height: 1.6;
}

.search-highlight {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(255, 183, 3, 0.28);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 600px) {
  .main-search-input {
    flex-direction: column;
    border-radius: 20px;
    padding: 15px;
  }

  .main-search-input-item {
    width: 100%;
    padding: 0;
    border-right: none;
  }

  .custom-select-menu {
    position: static;
    margin-top: 8px;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }

  .custom-select.is-open .custom-select-menu {
    display: block;
  }

  .main-search-input .button {
    width: 100%;
    justify-content: center;
  }

  .search-results {
    position: static;
    margin-top: 12px;
    max-height: none;
  }
}