/* ============================================================
   Riftmana Card & Article Search — overlay UI
   Dark theme, matches deck-viewer palette.
   All classes prefixed .rcs- to avoid collisions.
   ============================================================ */

html.rcs-lock { overflow: hidden; }

/* --- Defeat Blocksy's global bare-element theming -------------------------
   The overlay is JS-injected with bare <button>/<input>/<svg>, so Blocksy's
   element resets in main.min.css co-apply (themed pill backgrounds, ~34px
   min-heights, forced 15x15 svg fill, focus rings) and visually clobber our
   correctly-loaded CSS. These scoped resets neutralize that. Component rules
   for buttons are scoped under .rcs-overlay so they out-specify this reset. */
.rcs-overlay,
.rcs-overlay *,
.rcs-overlay *::before,
.rcs-overlay *::after { box-sizing: border-box; }

.rcs-overlay button {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: normal;
  letter-spacing: normal;
  text-transform: none;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
  transition: none;
}
.rcs-overlay button:focus { outline: none; }
.rcs-overlay button:focus-visible { outline: 2px solid #ffd700; outline-offset: 2px; }

.rcs-overlay a { color: inherit; text-decoration: none; transition: none; }
.rcs-overlay img { max-width: 100%; vertical-align: middle; }

.rcs-overlay .rcs-bar svg,
.rcs-overlay .rcs-bar-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  position: static;
  top: auto;
  vertical-align: middle;
}

.rcs-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000001;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.rcs-overlay[hidden] { display: none; }
.rcs-overlay.is-open { opacity: 1; }

.rcs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.rcs-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: translateY(-10px);
  transition: transform 0.18s ease;
}

.rcs-overlay.is-open .rcs-modal { transform: translateY(0); }

/* ---- Search bar ---- */
.rcs-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #2c2c2c;
}

.rcs-bar-icon {
  color: #888;
  display: inline-flex;
  flex-shrink: 0;
}

.rcs-overlay input.rcs-input {
  flex: 1;
  min-width: 0;
  height: auto;
  min-height: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  color: #f5f5f5;
  font: inherit;
  font-size: 16px;        /* 16px avoids iOS zoom-on-focus */
  line-height: 1.4;
  padding: 4px 0;
}
.rcs-overlay input.rcs-input:focus {
  outline: none;
  border: none;
  background: transparent;
  box-shadow: none;
}
.rcs-overlay input.rcs-input::placeholder { color: #777; }

.rcs-overlay .rcs-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: #888;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}
.rcs-overlay .rcs-close:hover { color: #fff; }

/* ---- Tabs ---- */
.rcs-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid #2c2c2c;
}

.rcs-overlay .rcs-tab {
  position: relative;
  background: transparent;
  border: none;
  color: #999;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 12px 14px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.rcs-overlay .rcs-tab:hover { color: #fff; }

.rcs-overlay .rcs-tab.is-active { color: #ffd700; }
.rcs-overlay .rcs-tab.is-active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: #ffd700;
  border-radius: 2px;
}

/* ---- Results area ---- */
.rcs-results {
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}

.rcs-msg {
  color: #888;
  font-size: 14px;
  text-align: center;
  padding: 28px 16px;
}
.rcs-loading { color: #aaa; }

.rcs-more {
  color: #777;
  font-size: 12px;
  text-align: center;
  padding: 10px 8px 4px;
  border-top: 1px solid #2a2a2a;
  margin-top: 6px;
}

/* ---- Shared result item ---- */
.rcs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.rcs-item:hover { background: #262626; }

/* ---- Card result ---- */
.rcs-card-list,
.rcs-article-list { display: flex; flex-direction: column; gap: 2px; }

.rcs-card-thumb {
  flex-shrink: 0;
  width: 46px;
  height: 64px;
  border-radius: 5px;
  overflow: hidden;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rcs-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.rcs-card-thumb.is-broken::after {
  content: '🂠';
  font-size: 22px;
  color: #555;
}

.rcs-card-body { flex: 1; min-width: 0; }

.rcs-card-name {
  color: #f5f5f5;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rcs-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.rcs-cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  box-sizing: border-box;
}

.rcs-color-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}

/* Combined dual-color icon is a side-by-side pair — let it keep its ratio */
.rcs-color-icon-dual {
  width: auto;
  height: 17px;
}

.rcs-card-typeset {
  color: #8a8a8a;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rcs-flag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 4px;
}
.rcs-flag-banned { background: #5b1a1a; color: #ff8585; }

/* ---- Article result ---- */
.rcs-article-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 44px;
  border-radius: 5px;
  overflow: hidden;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rcs-article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rcs-article-thumb.is-broken::after {
  content: '📄';
  font-size: 18px;
  opacity: 0.4;
}

.rcs-article-body { flex: 1; min-width: 0; }

.rcs-article-title {
  color: #f5f5f5;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rcs-article-excerpt {
  color: #8a8a8a;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Optional shortcode trigger button ---- */
.rcs-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #f5f5f5;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: normal;
  -webkit-appearance: none;
  appearance: none;
}
.rcs-trigger-btn:hover { background: #3a3a3a; border-color: #666; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .rcs-overlay { padding: 0; align-items: stretch; }
  .rcs-modal {
    max-width: none;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
}
