/* ================================================================
   MEKLĒŠANAS REŽĪMA TOGGLE
   ================================================================ */

.search-mode-toggle{
  position:relative;
  display:inline-flex;
  gap:8px;
  padding:6px;
  border-radius:12px;
  background:#efefef;
  overflow:hidden;
}

.search-mode-btn{
  position:relative;
  z-index:2;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:#1f2d3d;
  font-weight:600;
  transition: color .22s ease, transform .14s ease;
}

.search-mode-btn:active{
  transform:scale(.97);
}

.search-mode-btn.active{
  color:#fff;
}

.search-mode-toggle::before{
  content:"";
  position:absolute;
  top:6px;
  left:6px;
  height:calc(100% - 12px);
  width:calc(50% - 10px);
  background:#16324a;
  border-radius:10px;
  transition:transform .28s ease, width .22s ease;
  z-index:1;
}

.search-mode-toggle.is-ai::before{
  transform: translateX(calc(100% + 8px));
}

@media (max-width: 480px) {
  .search-mode-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .search-mode-btn {
    flex: 1;
    justify-content: center;
    font-size: 13px;
    padding: 8px 10px;
  }

  .search-mode-toggle::before{
    width: calc(50% - 10px);
  }

  .ai-search-input-wrap {
    flex-direction: column;
  }

  .ai-search-submit {
    width: 100%;
    justify-content: center;
  }
}

.search-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.search-mode-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #222;
}

.search-mode-btn.active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.search-mode-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.search-mode-btn.active svg {
  opacity: 1;
}

/* AI badge */
.ai-badge {
  display: inline-block;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.6;
}

/* ================================================================
   AI MEKLĒŠANAS PANELIS
   ================================================================ */

.ai-search-panel {
  padding: 4px 0 10px;
}

/* Ievads un piemēri */
.ai-search-intro {
  margin-bottom: 16px;
}

.ai-search-hint {
  color: #555;
  font-size: 14px;
  margin: 0 0 10px;
  line-height: 1.5;
}

.ai-search-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ai-example-label {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
}

.ai-example-chip {
    background: #17324c;
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #ffffff;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.ai-example-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

/* Input + poga */
.ai-search-input-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.ai-search-textarea {
  flex: 1;
  border: 1.5px solid #d0d0d8;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  min-height: 48px;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
  color: #1a1a1a;
}

.ai-search-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.ai-search-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 11px 20px;
  font-size: 15px;
}

/* ================================================================
   AI IELĀDES STĀVOKLIS
   ================================================================ */

.ai-loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  color: #666;
  font-size: 14px;
}

.ai-loading-dots {
  display: flex;
  gap: 5px;
}

.ai-loading-dots span {
  width: 8px;
  height: 8px;
  background: #6366f1;
  border-radius: 50%;
  animation: ai-dot-bounce 1.2s infinite ease-in-out;
}

.ai-loading-dots span:nth-child(1) { animation-delay: 0s; }
.ai-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0.30s; }

@keyframes ai-dot-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1.1); opacity: 1; }
}

/* ================================================================
   AI KĻŪDU STĀVOKLIS
   ================================================================ */

.ai-error-state {
  background: #fff2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
  color: #b91c1c;
  font-size: 14px;
  margin-top: 14px;
}

/* ================================================================
   AI ATBILDE (teksts)
   ================================================================ */

.ai-answer-text {
  background: #f8f8fc;
  border-left: 3px solid #6366f1;
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0 20px;
  color: #333;
  font-size: 14.5px;
  line-height: 1.6;
}

.ai-answer-text p {
  margin: 0 0 8px;
}

.ai-answer-text p:last-child {
  margin-bottom: 0;
}

.ai-no-results {
  color: #666;
}

.ai-tag-chip {
    display: inline-block;
    text-decoration: none;
    background: #17324c;
    border: 1px solid #3576b3;
    color: #ffffff;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.ai-tag-chip:hover {
    background: #1e4a73;
    border-color: #5a9fd4;
}

/* ================================================================
   AI REZULTĀTU REŽĢIS
   ================================================================ */

.ai-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .ai-items-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

@media (max-width: 400px) {
  .ai-items-grid {
    grid-template-columns: 1fr;
  }
}

/* AI Kartiņa — atkārtoti izmanto search-item stilu */
.ai-item-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.ai-item-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.ai-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.ai-item-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f0f0f4;
  position: relative;
}

.ai-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.ai-item-card:hover .ai-item-img {
  transform: scale(1.04);
}

.ai-item-img--placeholder {
  background: linear-gradient(135deg, #e8e8f0 0%, #d8d8e8 100%);
}

.ai-item-body {
  padding: 12px 14px 14px;
}

.ai-item-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6366f1;
  margin-bottom: 5px;
}

.ai-item-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #1a1a1a;
  margin: 0 0 6px;
}

.ai-item-addr {
  font-size: 13px;
  color: #777;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-item-dist {
  display: inline-block;
  background: #f0f0f8;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: #5a5aaa;
  white-space: nowrap;
}

/* ================================================================
   RESPONSIVS TOGGLE
   ================================================================ */

@media (max-width: 480px) {
  .search-mode-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .search-mode-btn {
    flex: 1;
    justify-content: center;
    font-size: 13px;
    padding: 8px 10px;
  }

  .ai-search-input-wrap {
    flex-direction: column;
  }

  .ai-search-submit {
    width: 100%;
    justify-content: center;
  }
}

