/* ===================================================
   COMPONENTS — 카드, 버튼, 배지, 검색 · v3 Editorial
   =================================================== */

/* ── 버튼 ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-korean);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  white-space: nowrap;
  border: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(255,255,255,0.10);
  transition: opacity var(--duration-fast);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

/* 바이올렛 — 기본 버튼 */
.btn--violet {
  background: linear-gradient(135deg, var(--violet-dark) 0%, var(--violet) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 16px rgba(124,106,245,0.28), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn--violet:hover {
  box-shadow: 0 4px 28px rgba(124,106,245,0.45), inset 0 1px 0 rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

/* 골드 */
.btn--gold {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 60%, var(--gold-light) 100%);
  color: #09090e;
  font-weight: 700;
  box-shadow: 0 2px 14px rgba(245,200,66,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn--gold:hover {
  box-shadow: 0 4px 24px rgba(245,200,66,0.42), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* 아웃라인 */
.btn--outline {
  background: transparent;
  border: 1px solid rgba(124,106,245,0.3);
  color: var(--violet-light);
  font-weight: 600;
}
.btn--outline:hover {
  background: var(--violet-dim);
  border-color: rgba(124,106,245,0.55);
  color: #fff;
  box-shadow: 0 0 20px rgba(124,106,245,0.15);
}

/* 고스트 */
.btn--ghost {
  background: var(--glass-bg);
  border: var(--border-glass);
  color: var(--text-secondary);
}
.btn--ghost:hover {
  color: var(--text-primary);
  border-color: var(--glass-border-bright);
  background: var(--glass-bg-hover);
}

/* 에메랄드 */
.btn--emerald {
  background: linear-gradient(135deg, #089e76 0%, var(--emerald) 100%);
  color: #09090e;
  font-weight: 700;
  box-shadow: 0 2px 14px rgba(16,232,176,0.22);
}

/* ── 배지 ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: var(--text-2xs);
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge--violet  { background: var(--violet-dim);  color: var(--violet-light); border: 1px solid rgba(124,106,245,0.22); }
.badge--gold    { background: var(--gold-dim);    color: var(--gold);         border: 1px solid rgba(245,200,66,0.22); }
.badge--emerald { background: var(--emerald-dim); color: var(--emerald);      border: 1px solid rgba(16,232,176,0.22); }
.badge--cyan    { background: var(--cyan-dim);    color: var(--cyan);         border: 1px solid rgba(13,240,255,0.22); }
.badge--purple  { background: var(--purple-dim);  color: var(--purple);       border: 1px solid rgba(192,132,252,0.22); }
.badge--blue    { background: var(--blue-dim);    color: var(--blue);         border: 1px solid rgba(96,165,250,0.22); }
.badge--pink    { background: var(--pink-dim);    color: var(--pink);         border: 1px solid rgba(244,114,182,0.22); }
.badge--orange  { background: var(--orange-dim);  color: var(--orange);       border: 1px solid rgba(251,146,60,0.22); }

/* ── 태그 ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-full);
  font-size: var(--text-2xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
  letter-spacing: 0.02em;
}
.tag:hover, .tag.active {
  background: var(--violet-dim);
  border-color: rgba(124,106,245,0.3);
  color: var(--violet-light);
}

/* ── 검색 ─────────────────────────────────────────── */
.search-wrapper { position: relative; }
.search-wrapper__icon {
  position: absolute;
  left: 0.85rem; top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  pointer-events: none;
  z-index: 1;
}
.search-input {
  width: 100%;
  padding: 0.68rem 1rem 0.68rem 2.6rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-korean);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  appearance: none;
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: rgba(124,106,245,0.45);
  box-shadow: 0 0 0 3px rgba(124,106,245,0.08);
}

/* ── 컴포넌트 카드 ────────────────────────────────── */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.5rem 1.5rem 1.85rem; /* 왼쪽 여백 — 액센트 바 공간 */
  cursor: pointer;
  transition:
    transform var(--duration-base) var(--ease-out-expo),
    box-shadow var(--duration-base) var(--ease-out-expo),
    border-color var(--duration-base);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* 왼쪽 액센트 바 */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--violet) 0%, transparent 100%);
  transform: scaleY(0.3);
  transform-origin: top;
  transition: transform var(--duration-base) var(--ease-out-expo),
              background var(--duration-base);
  border-radius: 0 0 2px 2px;
}

/* 상단 하이라이트 라인 */
.card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--violet) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--duration-base);
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(124,106,245,0.22);
  box-shadow: 0 12px 44px rgba(0,0,0,0.55), 0 0 0 1px rgba(124,106,245,0.1), var(--shadow-violet);
}
.card:hover::before {
  transform: scaleY(1);
  background: linear-gradient(180deg, var(--violet) 0%, var(--cyan) 100%);
}
.card:hover::after { opacity: 1; }

/* 카드 내부 */
.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.card__icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.card__icon--gold    { background: var(--gold-dim);    color: var(--gold);    box-shadow: 0 0 14px rgba(245,200,66,0.15); }
.card__icon--emerald { background: var(--emerald-dim); color: var(--emerald); box-shadow: 0 0 14px rgba(16,232,176,0.15); }
.card__icon--purple  { background: var(--purple-dim);  color: var(--purple);  box-shadow: 0 0 14px rgba(192,132,252,0.15); }
.card__icon--blue    { background: var(--blue-dim);    color: var(--blue);    box-shadow: 0 0 14px rgba(96,165,250,0.15); }
.card__icon--pink    { background: var(--pink-dim);    color: var(--pink);    box-shadow: 0 0 14px rgba(244,114,182,0.15); }
.card__icon--orange  { background: var(--orange-dim);  color: var(--orange);  box-shadow: 0 0 14px rgba(251,146,60,0.15); }
.card__icon--violet  { background: var(--violet-dim);  color: var(--violet-light); box-shadow: 0 0 14px rgba(124,106,245,0.18); }
.card__icon--cyan    { background: var(--cyan-dim);    color: var(--cyan);    box-shadow: 0 0 14px rgba(13,240,255,0.15); }

.card__name {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.card__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-bottom: 0.85rem;
}
.card__footer {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.card__stars {
  font-size: var(--text-xs);
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 600;
}
.card__installs {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.card__copy-btn {
  margin-left: auto;
  padding: 0.25rem 0.6rem;
  background: var(--violet-dim);
  border: 1px solid rgba(124,106,245,0.22);
  border-radius: var(--radius-sm);
  color: var(--violet-light);
  font-size: var(--text-2xs);
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  transition: all var(--duration-fast);
}
.card__copy-btn:hover {
  background: rgba(124,106,245,0.25);
  border-color: rgba(124,106,245,0.5);
  color: #fff;
}

/* ── 섹션 헤더 컴포넌트 ─────────────────────────── */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}
.section-header__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--violet-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.4rem;
}
.section-header__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.section-header__link {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color var(--duration-fast);
  white-space: nowrap;
  padding-bottom: 2px;
}
.section-header__link:hover { color: var(--violet-light); }

/* ── 목록 툴바 ────────────────────────────────────── */
.listing-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.listing-toolbar .search-wrapper { flex: 1; min-width: 200px; }
.listing-toolbar__count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.listing-toolbar__sort {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 0.58rem 0.9rem;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-korean);
  outline: none;
}
.listing-toolbar__sort option { background: var(--bg-elevated); }

.listing-toolbar__search {
  flex: 1;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}
.listing-toolbar__search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.listing-toolbar__input {
  width: 100%;
  padding: 0.58rem 0.9rem 0.58rem 2.4rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-korean);
  outline: none;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}
.listing-toolbar__input::placeholder { color: var(--text-muted); }
.listing-toolbar__input:focus {
  border-color: rgba(124,106,245,0.35);
  background: rgba(255,255,255,0.06);
}

/* ── 토스트 ──────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid rgba(124,106,245,0.3);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.4rem;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--text-primary);
  box-shadow: var(--shadow-elevated), 0 0 20px rgba(124,106,245,0.15);
  z-index: var(--z-toast);
  transition: transform var(--duration-base) var(--ease-out-expo), opacity var(--duration-base);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(16px);
}
.toast--show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── 상세 모달 ────────────────────────────────────── */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.18s ease both;
}
.detail-modal {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid rgba(124,106,245,0.18);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated), 0 0 0 1px rgba(124,106,245,0.08), 0 0 60px rgba(124,106,245,0.12);
  animation: slideUp 0.24s var(--ease-out-expo) both;
}
@keyframes slideUp { from { transform: translateY(28px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }

.detail-modal__close {
  position: absolute; top: 1.1rem; right: 1.1rem;
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast);
}
.detail-modal__close:hover {
  background: rgba(124,106,245,0.15);
  border-color: rgba(124,106,245,0.35);
  color: var(--text-primary);
}

.detail-modal__head {
  display: flex; align-items: flex-start; gap: 1rem;
  margin-bottom: 1.1rem;
}
.detail-modal__icon {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; flex-shrink: 0;
}
.detail-modal__title {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}
.detail-modal__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem;
  font-size: var(--text-sm);
}
.detail-modal__stat { color: var(--text-secondary); }
.detail-modal__desc {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1.1rem;
  font-size: var(--text-sm);
}
.detail-modal__tags {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin-bottom: 1.1rem;
}
.detail-modal__code-section {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(124,106,245,0.15);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}
.detail-modal__code-label {
  background: rgba(255,255,255,0.03);
  padding: 0.45rem 1rem;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.detail-modal__code {
  padding: 1rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--cyan);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}
.detail-modal__actions {
  display: flex; gap: 0.7rem; flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* ── 로고 이미지 ─────────────────────────────────── */
.nav__logo-img { height: 28px; width: auto; display: block; }

/* ── 광고 슬롯 ────────────────────────────────────── */
.ad-slot { display: none; }
.ad-slot--header {
  padding: 0.5rem var(--space-4);
  text-align: center;
  background: rgba(255,255,255,0.01);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.ad-slot--inline {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-4) 0;
  border-top: 1px dashed rgba(255,255,255,0.04);
  border-bottom: 1px dashed rgba(255,255,255,0.04);
}
.ad-slot--before-footer {
  text-align: center;
  padding: var(--space-8) 0;
}
.ad-slot--footer {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px dashed rgba(255,255,255,0.04);
}
.ad-slot--sticky {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: var(--z-above);
  text-align: center;
  background: rgba(9,9,14,0.97);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(124,106,245,0.12);
  padding: var(--space-2);
}
.ad-slot--popup {
  position: fixed; inset: 0;
  z-index: var(--z-popup);
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(10px);
}
.ad-popup-close {
  position: absolute; top: -14px; right: -14px;
  width: 28px; height: 28px;
  background: var(--bg-elevated); border: var(--border-glass);
  border-radius: 50%;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer;
  transition: all var(--duration-fast);
}
.ad-popup-close:hover { color: var(--text-primary); background: var(--violet-dim); }
