/* ── Recent searches (home) ─────────────────────────────── */
.recent-searches {
  margin-top: 8px;
  width: 100%;
  max-width: 576px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, color .15s, border-color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(32,33,36,.06);
}
.recent-item::before {
  content: '';
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235F6368'%3E%3Cpath d='M13 3a9 9 0 1 0 .001 18.001A9 9 0 0 0 13 3zm0 16c-3.86 0-7-3.14-7-7s3.14-7 7-7 7 3.14 7 7-3.14 7-7 7zm.5-11H12v6l5.25 3.15.75-1.23-4.5-2.67V8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: .6;
}
.recent-item:hover {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border-color: #c0c4c8;
}

@media (max-width: 600px) {
  .recent-searches { max-width: 100%; }
}
/* ── Variables ───────────────────────────────────────────────── */
:root {
  --blue:   #4285F4;
  --red:    #EA4335;
  --yellow: #FBBC04;
  --green:  #34A853;

  --text:        #202124;
  --text-2:      #5F6368;
  --border:      #DADCE0;
  --bg:          #FFFFFF;
  --bg-2:        #F8F9FA;
  --shadow-sm:   0 1px 6px rgba(32,33,36,.18);
  --shadow-md:   0 2px 10px rgba(32,33,36,.28);
  --radius-pill: 24px;
  --radius-card: 12px;
  --radius-sm:   8px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Color helpers ───────────────────────────────────────────── */
.c-blue   { color: var(--blue); }
.c-red    { color: var(--red); }
.c-yellow { color: var(--yellow); }
.c-green  { color: var(--green); }

/* ── Page switching ──────────────────────────────────────────── */
.page { display: none; min-height: 100vh; flex-direction: column; }
.page.active { display: flex; }

/* ══════════════════════ HOME PAGE ══════════════════════════════ */
.home-header {
  display: flex;
  justify-content: flex-end;
  padding: 14px 24px;
}

.home-nav { display: flex; gap: 20px; }
.nav-link { color: var(--text); font-size: 13px; }
.nav-link:hover { text-decoration: underline; color: var(--text); }

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 16px 100px;
}

/* Logo */
.logo-block { text-align: center; }

.logo-text {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 88px;
  font-weight: 700;
  letter-spacing: -3px;
  line-height: 1;
  user-select: none;
}

.logo-tagline {
  color: var(--text-2);
  font-size: 15px;
  margin-top: 8px;
  font-weight: 300;
}

/* Search field (shared home + header) */
.home-search-box {
  width: 100%;
  max-width: 576px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.search-field {
  width: 100%;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  height: 48px;
  padding: 0 16px;
  background: var(--bg);
  transition: box-shadow .2s, border-color .2s;
}
.search-field:hover   { box-shadow: var(--shadow-sm); }
.search-field:focus-within { box-shadow: var(--shadow-md); border-color: transparent; }

.field-icon {
  width: 20px; height: 20px;
  color: var(--text-2);
  flex-shrink: 0;
  margin-right: 12px;
}

.field-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  font-family: inherit;
}

.field-clear {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-2);
  display: flex;
  align-items: center;
}
.field-clear svg { width: 18px; height: 18px; }
.field-clear:hover { color: var(--text); }

/* Buttons */
.home-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.btn {
  height: 36px;
  padding: 0 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  background: var(--bg-2);
  color: var(--text);
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: #e8eaed; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: #3367d6; border-color: #3367d6; }

/* Footer */
.home-footer {
  text-align: center;
  padding: 12px;
  color: var(--text-2);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════ RESULTS PAGE ════════════════════════════ */
.results-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 20px;
}

/* Small logo button */
.header-logo {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1px;
  flex-shrink: 0;
  padding: 4px;
  border-radius: 6px;
  transition: background .15s;
}
.header-logo:hover { background: var(--bg-2); }

.header-search-field {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  height: 44px;
  padding: 0 8px 0 16px;
  background: var(--bg);
  transition: box-shadow .2s, border-color .2s;
}
.header-search-field:focus-within { box-shadow: var(--shadow-sm); border-color: transparent; }

.header-search-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: background .15s;
}
.header-search-btn:hover { background: var(--bg-2); color: var(--text); }
.header-search-btn svg { width: 20px; height: 20px; }

/* Main content area */
.results-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  width: 100%;
}

/* ── State panels ────────────────────────────────────────────── */
.state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 20px;
  text-align: center;
}

.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state-panel p { color: var(--text-2); font-size: 15px; }

.error-emoji { font-size: 48px; }
.error-text { max-width: 420px; color: var(--text-2); line-height: 1.6; }

/* ── AI Card ─────────────────────────────────────────────────── */
.ai-card {
  background: linear-gradient(135deg, #e8f0fe 0%, #f0f4ff 100%);
  border: 1px solid #c5cae9;
  border-radius: var(--radius-card);
  padding: 18px 22px;
  margin-bottom: 24px;
  animation: fadeUp .4s ease;
}

.ai-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-badge {
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.result-count { color: var(--text-2); font-size: 13px; }

.ai-summary {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 6px;
}

.ai-insight {
  font-size: 13px;
  color: #3c4043;
  font-style: italic;
}

/* ── Listings Grid ───────────────────────────────────────────── */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.no-results {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-2);
  padding: 40px;
  font-size: 15px;
}

/* ── Listing Card ────────────────────────────────────────────── */
.listing-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: box-shadow .2s, transform .15s;
  animation: fadeUp .35s ease both;
}
.listing-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.listing-card.top-pick { border-color: var(--blue); border-width: 2px; }

.top-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  z-index: 1;
  pointer-events: none;
}

/* Card image */
.card-img {
  width: 100%; height: 185px;
  object-fit: cover;
  background: var(--bg-2);
  display: block;
}
.card-img-placeholder {
  width: 100%; height: 185px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: #bdc1c6;
}

/* Card body */
.card-body {
  padding: 14px 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price {
  font-size: 20px;
  font-weight: 700;
  color: #137333;
}

.card-meta {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-highlight {
  background: #e8f0fe;
  border-left: 3px solid var(--blue);
  padding: 6px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
  color: #1a73e8;
  line-height: 1.4;
}

/* Card footer */
.card-footer {
  padding: 10px 15px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-id { font-size: 12px; color: var(--text-2); }

.card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  padding: 5px 12px;
  border: 1px solid var(--blue);
  border-radius: 4px;
  transition: background .15s;
}
.card-link:hover { background: #e8f0fe; text-decoration: none; }

/* ── Chat Section ────────────────────────────────────────────── */
.chat-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.chat-heading {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.chat-messages {
  min-height: 100px;
  max-height: 440px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* Message bubbles */
.msg { display: flex; max-width: 100%; animation: fadeUp .25s ease; }
.msg.msg-ai   { justify-content: flex-start; }
.msg.msg-user { justify-content: flex-end; }

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.msg-ai .bubble {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 2px 12px 12px 12px;
  color: var(--text);
}

.msg-user .bubble {
  background: var(--blue);
  color: #fff;
  border-radius: 12px 2px 12px 12px;
}

.bubble .bubble-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: block;
  margin-bottom: 5px;
  opacity: .65;
}

.bubble p { margin-bottom: 6px; }
.bubble p:last-child { margin-bottom: 0; }

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-2);
  border-radius: 50%;
  animation: bounce .6s infinite alternate;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes bounce { to { opacity: .25; transform: translateY(-5px); } }

/* Chat input bar */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
  background: var(--bg);
  color: var(--text);
}
.chat-input:focus { border-color: var(--blue); }
.chat-input:disabled { background: var(--bg-2); }

.chat-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.chat-send:hover:not(:disabled) { background: #3367d6; }
.chat-send:disabled { background: #bdc1c6; cursor: not-allowed; }
.chat-send svg { width: 17px; height: 17px; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Floating chat bar ───────────────────────────────────────── */
.floating-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 20px rgba(32,33,36,.14);
  padding: 10px 20px 14px;
  transform: translateY(110%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  pointer-events: none;
}

.floating-bar.visible {
  transform: translateY(0);
  pointer-events: auto;
}

.floating-bar-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.floating-bar .field-icon {
  color: var(--text-2);
  margin-right: 0;
}

/* ── Results-page source tabs (header only) ──────────────────── */
.source-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* .source-tab CSS odstránené, ak už nie je potrebné */

/* Search terms info bar */
.search-terms-info {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
  font-style: italic;
}

/* ── Chat mini cards — compact horizontal rows ───────────────── */
.chat-mini-cards {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
  max-width: 78%;
}

/* Each card is a full-width clickable row: thumb | text | arrow */
.mini-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  text-decoration: none;
  color: inherit;
  transition: background .15s, box-shadow .15s;
  overflow: hidden;
  min-width: 0;
}
.mini-card:hover { background: var(--bg-2); box-shadow: var(--shadow-sm); text-decoration: none; }

.mini-card-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--bg-2);
  flex-shrink: 0;
  display: block;
}

.mini-card-no-thumb {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.mini-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-card-price {
  font-size: 12px;
  font-weight: 700;
  color: #137333;
}

.mini-card-arrow {
  font-size: 13px;
  color: var(--blue);
  flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .logo-text { font-size: 56px; letter-spacing: -2px; }
  .results-main { padding: 16px 12px 60px; }
  .listings-grid { grid-template-columns: 1fr; }
  .results-header { padding: 8px 12px; gap: 8px; }
  .header-logo { font-size: 20px; }
  .source-tabs-header { display: none; }
}
