/* =============================================
   OLX Oglasi Plugin — BestCode Shop Listing
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&family=Barlow+Condensed:wght@700;800&display=swap');

/* ── RESET — sve unutar wrappera zaštititi od teme ── */
#olx-shop-wrapper,
#olx-shop-wrapper * {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

/* Spriječi temu da napravi SVG ogromnim */
#olx-shop-wrapper svg {
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  vertical-align: middle;
}

#olx-shop-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
}

#olx-shop-wrapper a {
  text-decoration: none;
  color: inherit;
}

#olx-shop-wrapper button {
  line-height: normal;
}

/* ── VARIJABLE ────────────────────────────── */
#olx-shop-wrapper {
  --c-accent:    #cf1046;
  --c-accent-dk: #a80d38;
  --c-accent-bg: rgba(207,16,70,0.07);
  --c-bg:        #f4f4f4;
  --c-surface:   #ffffff;
  --c-surface2:  #f7f7f7;
  --c-border:    #e0e0e0;
  --c-text:      #111111;
  --c-muted:     #777777;
  --c-faint:     #cccccc;
  --radius:      10px;
  --radius-sm:   6px;
  --ease:        0.2s cubic-bezier(0.4,0,0.2,1);

  font-family: 'Barlow', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  padding-bottom: 60px;
}

/* ── HERO ─────────────────────────────────── */
#olx-shop-wrapper .olx-hero {
  background: var(--c-accent);
  padding: 48px 32px 44px;
  position: relative;
  overflow: hidden;
}

#olx-shop-wrapper .olx-hero-subtitle {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  margin: 0 0 8px;
  line-height: 1;
}

#olx-shop-wrapper .olx-hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  line-height: 1;
  color: #fff;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

/* ── CONTROLS ─────────────────────────────── */
#olx-shop-wrapper .olx-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

/* Search */
#olx-shop-wrapper .olx-search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
}

#olx-shop-wrapper .olx-search-icon {
  position: absolute !important;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px !important;
  height: 15px !important;
  color: var(--c-muted);
  pointer-events: none;
  flex-shrink: 0;
}

#olx-search {
  width: 100%;
  background: var(--c-surface2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px 9px 34px;
  color: var(--c-text);
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}

#olx-search::placeholder { color: var(--c-muted); }
#olx-search:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-bg);
  background: #fff;
}

/* Filter buttons */
#olx-shop-wrapper .olx-filters {
  display: flex;
  gap: 3px;
  background: var(--c-surface2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

#olx-shop-wrapper .olx-filter-btn {
  background: transparent;
  border: none;
  color: var(--c-muted);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  line-height: 1.4;
}

#olx-shop-wrapper .olx-filter-btn:hover { color: var(--c-text); }
#olx-shop-wrapper .olx-filter-btn.active {
  background: var(--c-accent);
  color: #fff;
}

/* Sort */
#olx-shop-wrapper .olx-sort-wrap select {
  background: var(--c-surface2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 32px 9px 11px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--ease);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

#olx-shop-wrapper .olx-sort-wrap select:focus { border-color: var(--c-accent); }

/* View toggle */
#olx-shop-wrapper .olx-view-toggle {
  display: flex;
  gap: 3px;
  background: var(--c-surface2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

#olx-shop-wrapper .olx-view-btn {
  background: transparent;
  border: none;
  color: var(--c-muted);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
  padding: 0;
}

#olx-shop-wrapper .olx-view-btn svg {
  width: 15px !important;
  height: 15px !important;
}

#olx-shop-wrapper .olx-view-btn:hover { color: var(--c-text); }
#olx-shop-wrapper .olx-view-btn.active {
  background: var(--c-accent);
  color: #fff;
}

/* ── STATS ────────────────────────────────── */
#olx-shop-wrapper .olx-stats {
  padding: 9px 32px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
}

/* ── GRID ─────────────────────────────────── */
#olx-shop-wrapper .olx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 24px 32px;
}

#olx-shop-wrapper .olx-grid.list-view {
  grid-template-columns: 1fr;
  gap: 8px;
}

/* ── CARD ─────────────────────────────────── */
#olx-shop-wrapper .olx-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--c-text);
  text-decoration: none !important;
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
  animation: olx-fadein 0.3s ease both;
}

#olx-shop-wrapper .olx-card:hover {
  transform: translateY(-3px);
  border-color: var(--c-accent);
  box-shadow: 0 8px 28px rgba(207,16,70,0.1);
  color: var(--c-text);
  text-decoration: none !important;
}

/* List view card */
#olx-shop-wrapper .olx-grid.list-view .olx-card {
  flex-direction: row;
  height: 100px;
}

#olx-shop-wrapper .olx-grid.list-view .olx-card-img-wrap {
  width: 130px;
  min-width: 130px;
  height: 98px;
  flex-shrink: 0;
}

#olx-shop-wrapper .olx-grid.list-view .olx-card-img,
#olx-shop-wrapper .olx-grid.list-view .olx-no-img {
  height: 100%;
  aspect-ratio: unset;
}

#olx-shop-wrapper .olx-grid.list-view .olx-card-body {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  gap: 12px;
}

#olx-shop-wrapper .olx-grid.list-view .olx-card-title {
  -webkit-line-clamp: 1;
  margin-bottom: 4px;
}

#olx-shop-wrapper .olx-grid.list-view .olx-card-price-wrap {
  flex-shrink: 0;
  text-align: right;
  margin-top: 0;
}

#olx-shop-wrapper .olx-grid.list-view .olx-card-cta { display: none; }

/* Card image */
#olx-shop-wrapper .olx-card-img-wrap {
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

#olx-shop-wrapper .olx-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--c-surface2);
  transition: transform 0.4s ease;
  height: auto !important;
}

#olx-shop-wrapper .olx-card:hover .olx-card-img { transform: scale(1.04); }

#olx-shop-wrapper .olx-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--c-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.5;
}

#olx-shop-wrapper .olx-card-badge.used {
  background: rgba(0,0,0,0.4);
}

#olx-shop-wrapper .olx-no-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--c-surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-faint);
}

#olx-shop-wrapper .olx-no-img svg {
  width: 32px !important;
  height: 32px !important;
}

/* Card body */
#olx-shop-wrapper .olx-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

#olx-shop-wrapper .olx-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

#olx-shop-wrapper .olx-card-price-wrap { margin-top: auto; }

#olx-shop-wrapper .olx-card-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--c-accent);
  display: block;
  line-height: 1.2;
}

#olx-shop-wrapper .olx-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}

#olx-shop-wrapper .olx-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.4;
}

#olx-shop-wrapper .olx-card-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  transition: gap var(--ease);
}

#olx-shop-wrapper .olx-card:hover .olx-card-cta { gap: 8px; }

#olx-shop-wrapper .olx-card-cta svg {
  width: 12px !important;
  height: 12px !important;
  flex-shrink: 0;
}

/* ── SKELETON ─────────────────────────────── */
#olx-shop-wrapper .olx-skeleton {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}

#olx-shop-wrapper .olx-skeleton-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--c-surface2);
  position: relative;
  overflow: hidden;
}

#olx-shop-wrapper .olx-skeleton-body { padding: 14px 16px; }

#olx-shop-wrapper .olx-skeleton-line {
  height: 10px;
  background: var(--c-surface2);
  border-radius: 3px;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

#olx-shop-wrapper .olx-skeleton-line.w80 { width: 80%; }
#olx-shop-wrapper .olx-skeleton-line.w50 { width: 50%; }
#olx-shop-wrapper .olx-skeleton-line.w60 { width: 60%; }

#olx-shop-wrapper .olx-skeleton-img::after,
#olx-shop-wrapper .olx-skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(207,16,70,0.05), transparent);
  animation: olx-shimmer 1.5s infinite;
}

/* ── EMPTY / ERROR ────────────────────────── */
#olx-shop-wrapper .olx-empty,
#olx-shop-wrapper .olx-error {
  text-align: center;
  padding: 60px 32px;
  color: var(--c-muted);
  max-width: 360px;
  margin: 0 auto;
}

#olx-shop-wrapper .olx-empty svg,
#olx-shop-wrapper .olx-error svg {
  width: 44px !important;
  height: 44px !important;
  margin: 0 auto 16px;
  display: block !important;
  opacity: 0.3;
}

#olx-shop-wrapper .olx-empty h3,
#olx-shop-wrapper .olx-error h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--c-text);
  margin: 0 0 6px;
}

#olx-shop-wrapper .olx-empty p,
#olx-shop-wrapper .olx-error p {
  font-size: 13px;
  margin: 0 0 16px;
  line-height: 1.5;
}

#olx-shop-wrapper #olx-retry {
  background: var(--c-accent);
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background var(--ease);
}

#olx-shop-wrapper #olx-retry:hover { background: var(--c-accent-dk); }

/* ── FOOTER ───────────────────────────────── */
#olx-shop-wrapper .olx-footer-bar {
  padding: 0 32px;
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

#olx-shop-wrapper .olx-view-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-accent);
  text-decoration: none !important;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 2px solid var(--c-accent);
  padding: 10px 28px;
  border-radius: 100px;
  transition: all var(--ease);
}

#olx-shop-wrapper .olx-view-all svg {
  width: 13px !important;
  height: 13px !important;
  transition: transform var(--ease);
  flex-shrink: 0;
}

#olx-shop-wrapper .olx-view-all:hover {
  background: var(--c-accent);
  color: #fff;
}

#olx-shop-wrapper .olx-view-all:hover svg {
  transform: translateX(3px);
}

/* ── ANIMACIJE ────────────────────────────── */
@keyframes olx-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes olx-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#olx-shop-wrapper .olx-card:nth-child(1)  { animation-delay: 0.03s; }
#olx-shop-wrapper .olx-card:nth-child(2)  { animation-delay: 0.06s; }
#olx-shop-wrapper .olx-card:nth-child(3)  { animation-delay: 0.09s; }
#olx-shop-wrapper .olx-card:nth-child(4)  { animation-delay: 0.12s; }
#olx-shop-wrapper .olx-card:nth-child(5)  { animation-delay: 0.15s; }
#olx-shop-wrapper .olx-card:nth-child(6)  { animation-delay: 0.18s; }
#olx-shop-wrapper .olx-card:nth-child(n+7){ animation-delay: 0.21s; }

/* ── RESPONSIVE ───────────────────────────── */
@media (max-width: 768px) {
  #olx-shop-wrapper .olx-hero { padding: 36px 20px 32px; }
  #olx-shop-wrapper .olx-controls { padding: 12px 16px; position: static; }
  #olx-shop-wrapper .olx-grid { padding: 14px 16px; gap: 10px; }
  #olx-shop-wrapper .olx-stats { padding: 8px 16px; }
  #olx-shop-wrapper .olx-footer-bar { padding: 0 16px; }
}

@media (max-width: 500px) {
  #olx-shop-wrapper .olx-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  #olx-shop-wrapper .olx-card-cta { display: none; }
  #olx-shop-wrapper .olx-sort-wrap { display: none; }
  #olx-shop-wrapper .olx-card-price { font-size: 18px; }
}
