/* ═══════════════════════════════════════
   TagCoupon Manager v3.2 — Frontend CSS
   모바일 완전 대응
═══════════════════════════════════════ */

:root {
  --tc-red:    #c0392b;
  --tc-red-lt: #fef2f2;
  --tc-red-bd: #fcd5d5;
  --tc-bg:     #f5f4f0;
  --tc-white:  #ffffff;
  --tc-surface:#fafafa;
  --tc-bd:     #e8e8e8;
  --tc-bd2:    #f0f0f0;
  --tc-t1:     #111111;
  --tc-t2:     #555555;
  --tc-t3:     #888888;
  --tc-t4:     #bbbbbb;
  --tc-mono:   'Courier New', Courier, monospace;
}

/* ── 카드 레이아웃 ── */
.tc-coupons { margin: 0; }
.tc-layout-list { display: flex; flex-direction: column; gap: 2px; }
.tc-layout-list .tc-card:first-child { border-radius: 10px 10px 0 0; }
.tc-layout-list .tc-card:last-child  { border-radius: 0 0 10px 10px; border-bottom: none; }
.tc-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.tc-layout-grid .tc-card { border-radius: 10px; }

/* ── 카드 공통 ── */
.tc-card {
  background: var(--tc-white);
  border: 1px solid var(--tc-bd);
  display: flex;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  transition: background .1s;
  min-width: 0;
}
.tc-card:hover { background: var(--tc-surface); }
.tc-card.tc-expired { opacity: .52; }

/* ── 뱃지 ── */
.tc-bdg {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 10px; font-weight: 500;
  padding: 2px 7px; border-radius: 3px;
  z-index: 1;
}
.tc-bdg-hot  { background: var(--tc-red-lt); color: var(--tc-red); }
.tc-bdg-new  { background: #eff6ff; color: #1d4ed8; }
.tc-bdg-app  { background: #f0fdf4; color: #166534; }
.tc-bdg-ship { background: #fffbeb; color: #92400e; }
.tc-bdg-exp  { background: #f5f5f5; color: #999; }

/* ── 브랜드 컬럼 ── */
.tc-card-brand {
  flex: 0 0 68px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 16px 8px; gap: 5px;
  border-right: 1px solid var(--tc-bd2);
}
.tc-brand-ico {
  width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 500; flex-shrink: 0;
}
.tc-brand-ico-img { overflow: hidden; }
.tc-brand-name { font-size: 9px; color: var(--tc-t4); text-align: center; line-height: 1.3; word-break: keep-all; }

/* ── 카드 본문 ── */
.tc-card-body {
  flex: 1; min-width: 0;
  padding: 16px 18px;
  display: flex; flex-direction: column;
  justify-content: center; gap: 5px;
}
.tc-card-title {
  font-size: 13px; font-weight: 500; color: var(--tc-t1);
  letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none;
}
.tc-card-title:hover { color: var(--tc-red); }
.tc-card-cond { font-size: 12px; color: var(--tc-t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-card-meta { display: flex; gap: 10px; }
.tc-card-meta span { font-size: 11px; color: var(--tc-t4); white-space: nowrap; }
.tc-card-meta b { color: var(--tc-t3); font-weight: 500; }

/* ── 카드 액션 ── */
.tc-card-action {
  flex: 0 0 148px;
  border-left: 1px solid var(--tc-bd2);
  padding: 16px;
  display: flex; flex-direction: column;
  align-items: flex-end; justify-content: center;
  gap: 8px;
}
.tc-discount { font-size: 17px; font-weight: 500; color: var(--tc-red); letter-spacing: -.5px; white-space: nowrap; line-height: 1.1; }
.tc-code-row { display: flex; align-items: center; gap: 5px; }
.tc-code {
  font-family: var(--tc-mono);
  font-size: 11px; font-weight: 500;
  background: var(--tc-bg); border: 1px solid #ddd;
  border-radius: 3px; padding: 4px 8px;
  color: #333; letter-spacing: .5px;
  white-space: nowrap; flex-shrink: 0;
}
.tc-copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 12px;
  background: #222; color: #fff !important;
  border: none; border-radius: 3px;
  font-size: 11px; font-weight: 500;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  user-select: none; transition: background .12s;
}
.tc-copy-btn:hover { background: #444; }
.tc-copy-btn.copied { background: #2d7a3e !important; }
.tc-link-btn {
  display: inline-flex; align-items: center;
  padding: 5px 11px;
  background: var(--tc-bg); border: 1px solid #ddd;
  border-radius: 3px; font-size: 11px; font-weight: 500;
  color: #555 !important; text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.tc-link-btn:hover { border-color: #999; color: #222 !important; }

/* ── 2-col 섹션 ── */
.tc-twocol-wrap { margin-bottom: 24px; }
.tc-twocol-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.tc-twocol-title { font-size: 15px; font-weight: 500; color: var(--tc-t1); letter-spacing: -.4px; }
.tc-more { font-size: 12px; color: var(--tc-t4); text-decoration: none; }
.tc-more:hover { color: var(--tc-t2); }
.tc-twocol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tc-col-section { background: var(--tc-white); border: 1px solid var(--tc-bd); border-radius: 10px; overflow: hidden; }
.tc-col-hd { padding: 14px 18px; border-bottom: 1px solid var(--tc-bd2); display: flex; align-items: center; gap: 8px; }
.tc-col-ico  { font-size: 16px; flex-shrink: 0; }
.tc-col-nm   { font-size: 13px; font-weight: 500; color: var(--tc-t1); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-col-ct   { font-size: 11px; color: var(--tc-t4); white-space: nowrap; flex-shrink: 0; }
.tc-col-more { font-size: 11px; color: var(--tc-red); text-decoration: none; white-space: nowrap; flex-shrink: 0; }

/* ── 카테고리 탭 ── */
.tc-cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.tc-cat-tab {
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--tc-bd); font-size: 13px;
  color: var(--tc-t3); text-decoration: none;
  background: var(--tc-white); transition: all .12s; white-space: nowrap;
}
.tc-cat-tab:hover, .tc-cat-tab.current { background: var(--tc-red); color: #fff; border-color: var(--tc-red); }

/* ── HOT 배너 ── */
.tc-hot-banner { background: var(--tc-white); border: 1px solid var(--tc-bd); border-radius: 10px; padding: 16px 18px; margin-bottom: 20px; }
.tc-hot-banner h3 { font-size: 15px; font-weight: 500; margin-bottom: 12px; color: var(--tc-t1); }
.tc-hot-list { display: flex; flex-direction: column; gap: 10px; }
.tc-hot-item { display: flex; align-items: center; gap: 10px; }
.tc-hot-info { flex: 1; min-width: 0; }
.tc-hot-info strong { display: block; font-size: 13px; font-weight: 500; color: var(--tc-t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-hot-info span { font-size: 12px; color: var(--tc-red); font-weight: 500; }

/* ── 빈 상태 ── */
.tc-empty { color: var(--tc-t4); font-size: 13px; padding: 20px; text-align: center; }

/* ═══════════════════════════════════════
   페이지 레이아웃
═══════════════════════════════════════ */
.tc-page-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 24px 40px; }

/* 브레드크럼 */
.tc-bc { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #bbb; margin-bottom: 18px; flex-wrap: wrap; }
.tc-bc a { color: #bbb; text-decoration: none; }
.tc-bc a:hover { color: #555; }
.tc-bc-current { color: #555; }

/* ── 상세 페이지 그리드 ── */
.tc-detail-grid { display: grid; grid-template-columns: 1fr 220px; gap: 22px; }
.tc-detail-main {}
.tc-detail-sidebar {}

/* 히어로 */
.tc-hero-box { background: #fff; border-radius: 10px; border: 1px solid #e8e8e8; overflow: hidden; margin-bottom: 14px; }
.tc-hero-top { padding: 20px 24px 16px; border-bottom: 1px solid #f0f0f0; }
.tc-hero-tags { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; flex-wrap: wrap; }
.tc-htag { padding: 3px 9px; background: #f5f4f0; border: 1px solid #e0e0e0; border-radius: 3px; font-size: 11px; color: #666; white-space: nowrap; }
.tc-htag-hot  { background: #fef2f2; border-color: #fcd5d5; color: var(--tc-red); font-weight: 500; }
.tc-htag-new  { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; font-weight: 500; }
.tc-htag-ship { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.tc-htag-date { font-size: 11px; color: #bbb; margin-left: auto; white-space: nowrap; }
.tc-hero-brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.tc-hero-ico { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 500; flex-shrink: 0; overflow: hidden; }
.tc-hero-h1  { font-size: 18px; font-weight: 500; color: #111; letter-spacing: -.5px; margin: 0 0 4px; line-height: 1.3; }
.tc-hero-sub { font-size: 13px; color: #888; }
.tc-hero-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #bbb; flex-wrap: wrap; }
.tc-hero-meta strong { color: #888; font-weight: 500; }
.tc-dot { color: #ddd; }

/* 코드 영역 */
.tc-code-area  { padding: 16px 20px; background: #fafafa; }
.tc-code-label { font-size: 10px; font-weight: 500; color: #bbb; letter-spacing: .7px; text-transform: uppercase; margin-bottom: 10px; }
.tc-code-main  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tc-code-dashed { flex: 1; min-width: 140px; background: #fff; border: 1.5px dashed #ccc; border-radius: 6px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; gap: 8px; }
.tc-code-big   { font-family: var(--tc-mono); font-size: 17px; font-weight: 500; color: #111; letter-spacing: 2px; white-space: nowrap; }
.tc-code-hint  { font-size: 11px; color: #ccc; white-space: nowrap; flex-shrink: 0; }
.tc-copy-lg    { padding: 10px 20px !important; font-size: 13px !important; border-radius: 5px !important; flex-shrink: 0; }
.tc-discount-big { text-align: right; flex-shrink: 0; }
.tc-disc-num   { font-size: 26px; font-weight: 500; color: var(--tc-red); letter-spacing: -1.5px; line-height: 1; }
.tc-disc-sub   { font-size: 11px; color: #bbb; margin-top: 2px; }
.tc-cond-tags  { display: flex; gap: 6px; flex-wrap: wrap; }
.tc-ctag { padding: 4px 10px; background: #fff; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 11px; color: #666; white-space: nowrap; }

/* 본문 */
.tc-content-block { background: #fff; border-radius: 10px; border: 1px solid #e8e8e8; padding: 24px; margin-bottom: 14px; }
.tc-prose-section { margin-bottom: 24px; }
.tc-prose-section:last-child { margin-bottom: 0; }
.tc-prose-section h2 { font-size: 15px; font-weight: 500; color: #111; letter-spacing: -.4px; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; }
.tc-prose-section p  { font-size: 13px; color: #555; line-height: 1.8; letter-spacing: -.1px; margin-bottom: 10px; }
.tc-tip-box { background: #fff8f8; border-left: 3px solid #e74c3c; border-radius: 0 6px 6px 0; padding: 11px 16px; margin-top: 12px; font-size: 12px; color: #7a3030; line-height: 1.7; }

/* 스텝 */
.tc-step { display: flex; gap: 14px; padding: 13px 0; border-bottom: 1px solid #f5f5f5; }
.tc-step:last-child { border-bottom: none; }
.tc-step-num   { width: 26px; height: 26px; border-radius: 5px; background: #222; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; flex-shrink: 0; margin-top: 1px; }
.tc-step-title { font-size: 13px; font-weight: 500; color: #111; letter-spacing: -.2px; margin-bottom: 2px; }
.tc-step-desc  { font-size: 12px; color: #777; line-height: 1.65; }

/* FAQ */
.tc-faq-item { border-bottom: 1px solid #f0f0f0; padding: 12px 0; cursor: pointer; }
.tc-faq-item:last-child { border-bottom: none; }
.tc-faq-q { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 500; color: #111; }
.tc-faq-mark  { color: var(--tc-red); flex-shrink: 0; width: 14px; margin-top: 1px; }
.tc-faq-arrow { font-size: 10px; color: #ccc; margin-left: auto; flex-shrink: 0; transition: transform .2s; }
.tc-faq-a { font-size: 12px; color: #777; line-height: 1.7; margin-top: 8px; padding-left: 22px; display: none; }
.tc-faq-item.open .tc-faq-a     { display: block; }
.tc-faq-item.open .tc-faq-arrow { transform: rotate(180deg); }

/* 관련 카드 */
.tc-related-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 14px; }
.tc-related-card { background: #fafafa; border: 1px solid #e8e8e8; border-radius: 8px; padding: 14px; text-decoration: none; display: block; transition: background .1s; }
.tc-related-card:hover { background: #f0efeb; }
.tc-related-ico   { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 500; margin-bottom: 8px; overflow: hidden; }
.tc-related-cat   { font-size: 10px; color: #bbb; margin-bottom: 3px; }
.tc-related-title { font-size: 12px; font-weight: 500; color: #111; line-height: 1.4; margin-bottom: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tc-related-disc  { font-size: 13px; font-weight: 500; color: var(--tc-red); }

/* 공유바 */
.tc-share-bar { display: flex; align-items: center; gap: 8px; padding: 18px 0 4px; border-top: 1px solid #f0f0f0; margin-top: 4px; flex-wrap: wrap; }
.tc-share-label  { font-size: 12px; color: #bbb; white-space: nowrap; flex-shrink: 0; }
.tc-share-kakao  { padding: 7px 14px; background: #FEE500; border: 1px solid #D4BE00; border-radius: 4px; font-size: 12px; color: #3C1E1E; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tc-share-link   { padding: 7px 14px; background: #fff; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; color: #444; cursor: pointer; white-space: nowrap; }
.tc-share-x      { padding: 7px 14px; background: #111; border: 1px solid #111; border-radius: 4px; font-size: 12px; color: #fff; cursor: pointer; white-space: nowrap; }
.tc-share-report { padding: 7px 14px; background: #fff; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 12px; color: #aaa; cursor: pointer; white-space: nowrap; margin-left: auto; }

/* 사이드바 */
.tc-sidebar-widget { background: #fff; border-radius: 8px; border: 1px solid #e8e8e8; padding: 16px; margin-bottom: 12px; }
.tc-sticky { position: sticky; top: 20px; }
.tc-sw-label { font-size: 10px; font-weight: 500; color: #bbb; letter-spacing: .6px; text-transform: uppercase; margin-bottom: 10px; }
.tc-sw-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: #111; }
.tc-sw-disc  { font-size: 20px; font-weight: 500; color: var(--tc-red); letter-spacing: -1px; margin-bottom: 8px; }
.tc-sw-code  { width: 100%; background: #f5f4f0; border: 1px dashed #ccc; border-radius: 5px; padding: 9px 12px; font-family: var(--tc-mono); font-size: 13px; font-weight: 500; color: #111; text-align: center; letter-spacing: 2px; margin-bottom: 8px; box-sizing: border-box; }
.tc-sw-link-btn { display: block; width: 100%; padding: 9px; background: #222; color: #fff !important; border-radius: 5px; font-size: 12px; font-weight: 500; text-align: center; text-decoration: none; box-sizing: border-box; }
.tc-sw-exp { font-size: 11px; color: #ccc; text-align: center; margin-top: 7px; }
.tc-sw-item { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid #f5f5f5; text-decoration: none; }
.tc-sw-item:last-child { border-bottom: none; }
.tc-sw-item:hover { opacity: .75; }
.tc-sw-item-title { font-size: 12px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 155px; }
.tc-sw-item-disc  { font-size: 11px; color: var(--tc-red); font-weight: 500; }

/* 아카이브 */
.tc-archive-header { margin-bottom: 16px; }
.tc-archive-title  { font-size: 20px; font-weight: 500; color: #111; margin: 0 0 4px; display: flex; align-items: baseline; gap: 10px; }
.tc-archive-count  { font-size: 14px; color: var(--tc-red); font-weight: 400; }
.tc-archive-date   { font-size: 12px; color: #bbb; }
.tc-filter-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tc-filter-btn { padding: 5px 12px; background: #fff; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 12px; color: #666; text-decoration: none; white-space: nowrap; }
.tc-filter-btn.on { background: #222; color: #fff; border-color: #222; }
.tc-pagination { text-align: center; padding: 20px 0; }
.tc-pagination .page-numbers { padding: 6px 12px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 13px; color: #555; text-decoration: none; margin: 0 2px; display: inline-block; }
.tc-pagination .current { background: #222; color: #fff; border-color: #222; }

/* ═══════════════════════════════════════
   반응형 — 태블릿 (768px 이하)
═══════════════════════════════════════ */
@media (max-width: 768px) {

  .tc-page-wrap { padding: 14px 16px 32px; }

  /* ★ 사이드바 모바일: 아래로 이동 */
  .tc-detail-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .tc-detail-sidebar {
    order: 2; /* 본문 아래로 */
    margin-top: 12px;
  }
  .tc-detail-main { order: 1; }

  /* sticky 해제 (모바일에선 의미없음) */
  .tc-sticky { position: static; }

  /* 사이드바 위젯 가로 배치 */
  .tc-sidebar-widget:first-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }
  .tc-sw-label { grid-column: 1 / -1; margin-bottom: 0; }
  .tc-sw-brand { grid-column: 1 / -1; }

  /* 카드 액션 컬럼 좁힘 */
  .tc-card-brand  { flex: 0 0 54px; padding: 12px 6px; }
  .tc-card-action { flex: 0 0 112px; padding: 12px 10px; }
  .tc-card-body   { padding: 12px 12px; }
  .tc-discount    { font-size: 14px; }
  .tc-code        { font-size: 10px; padding: 3px 6px; }

  /* 2열 → 1열 */
  .tc-twocol-grid { grid-template-columns: 1fr; gap: 8px; }

  /* 관련 카드 2열 */
  .tc-related-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* 히어로 */
  .tc-hero-top { padding: 16px 16px 14px; }
  .tc-hero-h1  { font-size: 16px; }
  .tc-code-area { padding: 14px 16px; }
  .tc-code-big  { font-size: 15px; letter-spacing: 1px; }
  .tc-disc-num  { font-size: 22px; }

  /* 본문 */
  .tc-content-block { padding: 16px; }

  /* 공유바 */
  .tc-share-report { margin-left: 0; }

  /* 아카이브 */
  .tc-archive-title { font-size: 17px; }

  /* 배너 높이 자동 */
  .tc-img-banner { height: auto !important; }
  .tc-img-slide  { height: auto !important; }
  .tc-img-slide img { height: 160px !important; object-fit: cover; }
  .tc-img-prev,
  .tc-img-next   { width: 28px; height: 28px; font-size: 16px; }
}

/* ═══════════════════════════════════════
   반응형 — 모바일 (480px 이하)
═══════════════════════════════════════ */
@media (max-width: 480px) {

  .tc-page-wrap { padding: 10px 12px 24px; }

  /* 카드 더 좁게 */
  .tc-card-brand  { flex: 0 0 46px; padding: 10px 4px; }
  .tc-card-body   { padding: 10px 10px; gap: 4px; }
  .tc-card-action { flex: 0 0 100px; padding: 10px 8px; gap: 6px; }
  .tc-card-title  { font-size: 12px; }
  .tc-card-cond   { display: none; } /* 모바일 최소화 */
  .tc-discount    { font-size: 13px; }
  .tc-code        { font-size: 10px; padding: 3px 5px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
  .tc-copy-btn    { padding: 4px 8px; font-size: 10px; }

  /* 배너 */
  .tc-img-slide img { height: 130px !important; }

  /* 관련 카드 1열 */
  .tc-related-grid { grid-template-columns: 1fr; }

  /* 히어로 코드 영역 세로 배치 */
  .tc-code-main   { flex-direction: column; align-items: stretch; }
  .tc-code-dashed { min-width: unset; }
  .tc-copy-lg     { width: 100% !important; justify-content: center; }
  .tc-discount-big { text-align: left; margin-top: 4px; }

  /* 브레드크럼 줄임 */
  .tc-bc { font-size: 11px; }

  /* 그리드 1열 */
  .tc-layout-grid { grid-template-columns: 1fr; }

  /* 카테고리 탭 작게 */
  .tc-cat-tab { padding: 5px 10px; font-size: 12px; }

  /* 사이드바 단일 컬럼 */
  .tc-sidebar-widget:first-child {
    grid-template-columns: 1fr;
  }
}