/* ════════════════════════════════════════
   솔레뜨 인스타그램 보고서
   형광 그린 → 코발트 블루 팔레트
   ════════════════════════════════════════ */

:root {
  --white:   #ffffff;
  --off:     #f4f9f4;        /* 배경 — 그린 틴트 */
  --border:  #d4e8d4;
  --muted:   #7a9a7a;
  --text:    #0a1a0a;
  --sub:     #2a4a2a;
  --green:   #00cc0a;        /* 형광 그린 상단 */
  --green-lt:#d0ffe0;
  --green-md:#00e80c;        /* 더 밝은 그린 */
  --blue:    #0040d8;        /* 코발트 블루 하단 */
  --blue-lt: #d0e4ff;
  --blue-md: #1a5af0;        /* 미디엄 블루 */
  --teal:    #008888;        /* 중간 청록 */
  --black:   #111111;        /* 순수 블랙 */
  /* 헤더·강조용 그라디언트 — 위(초록)→아래(파랑) */
  --grad: linear-gradient(to bottom, #00cc0a 0%, #008888 50%, #0040d8 100%);

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --font:      'Pretendard','Inter',sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; margin:0; padding:0; }
html { scroll-behavior:smooth; }
body {
  font-family: var(--font);
  background:  var(--off);
  color:       var(--text);
  line-height: 1.6;
  font-size:   15px;
}

/* ── HEADER ─────────────────────────────── */
.site-header {
  background: var(--black);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--green);
}
.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand-info { display:flex; align-items:center; gap:12px; }
.brand-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--green);
  background: #222;
  flex-shrink: 0;
}
.brand-avatar img { width:100%; height:100%; object-fit:cover; object-position:50% 0%; }
.brand-name { font-size:1.1rem; font-weight:700; letter-spacing:-.01em; }
.brand-sub  { font-size:.72rem; color:#aaa; margin-top:1px; }
.period-badge {
  border: 1px solid #444;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: .78rem;
  color: #ccc;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.period-badge i { color: var(--green-md); }

/* ── LOADING ─────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(247,248,247,.96);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; transition: opacity .4s;
}
.loading-overlay.hidden { opacity:0; pointer-events:none; }
.loading-content { text-align:center; }
.loading-spinner {
  width:40px; height:40px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ── MAIN ────────────────────────────────── */
.main-content {
  max-width: 1140px;
  margin: 0 auto;
  padding: 36px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 52px;
}

/* ── SECTION ─────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--black);
  padding-bottom: 10px;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--black);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title i { color: var(--green); }
.section-sub {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
}

/* ── KPI CARDS ───────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 12px;
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-accent, var(--green));
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}
.kpi-card:hover {
  box-shadow: 0 4px 18px rgba(0,204,10,.15);
  transform: translateY(-2px);
}
.kpi-icon {
  font-size: .85rem;
  margin-bottom: 8px;
  color: var(--card-accent, var(--black));
  opacity: .6;
}
.kpi-label {
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--black);
  letter-spacing: -.03em;
  line-height: 1;
}
.kpi-meta { margin-top:6px; font-size:.72rem; }
.kpi-change.up      { color: var(--green); }
.kpi-change.down    { color: #cc3333; }
.kpi-change.neutral { color: var(--muted); }

/* ── REACH BAR ───────────────────────────── */
.reach-bar-wrap { max-width:420px; margin-top:14px; }
.reach-bar-label { font-size:.72rem; font-weight:600; color:var(--sub); margin-bottom:6px; }
.reach-bar { display:flex; height:8px; border-radius:4px; overflow:hidden; background:var(--border); }
.reach-seg.follower    { background:var(--green); }
.reach-seg.nonfollower { background:var(--blue); }
.reach-bar-legend { display:flex; gap:16px; margin-top:7px; font-size:.72rem; color:var(--sub); }
.reach-bar-legend span { display:flex; align-items:center; gap:5px; }
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot.follower    { background:var(--black); }
.dot.nonfollower { background:var(--blue-md); }

/* ── CHARTS ──────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 16px;
}
.chart-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── FEED + INSIGHT LIST ─────────────────── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--white);
  transition: background .15s;
}
.post-row:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.post-row:last-child  {
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.post-row:hover { background: var(--off); }

/* 썸네일 */
.post-thumb {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  background: #ddd;
}
.post-thumb-img {
  width: 100%; height: 100%;
  background-repeat: no-repeat;
  background-size: 300% 400%;
  /* background-image은 JS에서 inline style로 주입 */
}
.post-thumb-badge {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--black);
  color: var(--white);
  font-size: .58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 3px;
}
.post-thumb-badge.reel     { background: var(--blue); }
.post-thumb-badge.carousel { background: #333; }
.post-thumb-badge.image    { background: var(--black); }
.post-thumb-top {
  position: absolute;
  top: 6px; right: 6px;
  font-size: .75rem;
}

/* 인사이트 패널 */
.post-insight {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  border-left: 1px solid var(--border);
}
.post-insight-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.post-desc {
  font-size: .82rem;
  font-weight: 700;
  color: var(--black);
  line-height: 1.3;
  flex: 1;
}
.post-date-tag {
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
}
.post-url-link {
  font-size: .68rem;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
}
.post-url-link:hover { text-decoration: underline; }

/* 지표 행 */
.post-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 2px;
}
.metric-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.metric-label {
  font-size: .65rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.metric-value {
  font-size: .88rem;
  font-weight: 700;
  color: var(--black);
}
.metric-value.green { color: var(--green); }
.metric-value.blue  { color: var(--blue);  }
.metric-value.dash  { color: var(--muted); font-weight:400; }

/* 진행 바 */
.metric-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.metric-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  flex: 1;
  max-width: 120px;
  overflow: hidden;
}
.metric-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
}
.metric-bar-fill.blue { background: var(--blue-md); }

/* no-data 안내 */
.post-no-data {
  font-size: .72rem;
  color: var(--muted);
  font-style: italic;
}

/* ── INSIGHT TABLE ────────────────────────── */
.table-wrapper { overflow-x:auto; border-radius:var(--radius-sm); border:1px solid var(--border); }
.insight-table { width:100%; border-collapse:collapse; background:var(--white); font-size:.8rem; }
.insight-table thead tr { background: var(--black); color:var(--white); }
.insight-table th {
  padding: 10px 12px; text-align:left; font-size:.68rem;
  font-weight:600; text-transform:uppercase; letter-spacing:.05em; white-space:nowrap;
}
.insight-table td { padding:9px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.insight-table tbody tr:last-child td { border-bottom:none; }
.insight-table tbody tr:hover { background:var(--off); }
.type-badge {
  display:inline-flex; align-items:center; gap:3px;
  padding:2px 8px; border-radius:3px; font-size:.65rem; font-weight:700;
  text-transform:uppercase; letter-spacing:.03em;
}
.type-badge.reel     { background:var(--blue-lt);  color:var(--blue); }
.type-badge.image    { background:#f0f0f0;          color:#333; }
.type-badge.carousel { background:var(--green-lt);  color:var(--green); }
.caption-cell {
  max-width:180px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--sub);
}
.num           { font-variant-numeric:tabular-nums; font-weight:600; }
.num-highlight { color:var(--green); font-weight:700; }
.er-bar { display:flex; align-items:center; gap:6px; }
.er-fill {
  height:5px; border-radius:3px; background:var(--blue-md);
  min-width:2px;
}
.table-note {
  margin-top:10px; font-size:.72rem; color:var(--muted);
  display:flex; align-items:flex-start; gap:5px; line-height:1.5;
}
.table-note i { color:var(--green); margin-top:2px; flex-shrink:0; }

/* ── INSIGHT LIST (한 줄씩) ──────────────── */
.insight-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
}
.insight-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  align-items: stretch;
  transition: background .15s;
}
.insight-row:last-child { border-bottom: none; }
.insight-row:hover { background: var(--off); }

.insight-icon-cell {
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.insight-body {
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.insight-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--black);
  white-space: nowrap;
  min-width: 160px;
}
.insight-divider {
  width: 1px; height: 14px;
  background: var(--border);
  flex-shrink: 0;
  align-self: center;
}
.insight-text {
  font-size: .8rem;
  color: var(--sub);
  line-height: 1.5;
  flex: 1;
}

/* ── FOOTER ──────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px 20px;
  color: #aaa;
  font-size: .72rem;
  border-top: 1px solid #333;
  background: var(--black);
}

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset:0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  display: flex; align-items:center; justify-content:center;
  padding: 20px;
  opacity:0; pointer-events:none; transition:opacity .2s;
}
.modal-overlay.open { opacity:1; pointer-events:all; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 560px; width:100%;
  max-height: 90vh; overflow-y:auto;
  position:relative;
  box-shadow: 0 20px 48px rgba(0,0,0,.3);
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { transform:scale(.96) translateY(8px); }
  to   { transform:scale(1)   translateY(0); }
}
.modal-close {
  position:absolute; top:12px; right:12px;
  background:var(--off); border:none; border-radius:50%;
  width:30px; height:30px; cursor:pointer;
  font-size:.85rem; color:var(--sub);
  display:flex; align-items:center; justify-content:center;
  transition:background .15s;
}
.modal-close:hover { background:var(--border); }
.modal-inner { padding:24px; }
.modal-header { margin-bottom:14px; }
.post-date-badge {
  display:inline-block; font-size:.7rem; font-weight:600;
  background:var(--off); color:var(--sub);
  padding:3px 10px; border-radius:4px; margin-bottom:8px;
}
.modal-stats {
  display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:16px 0;
}
.modal-stat {
  background:var(--off); border-radius:var(--radius-sm); padding:12px; text-align:center;
}
.ms-label { font-size:.62rem; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin-bottom:4px; }
.ms-value { font-size:1.2rem; font-weight:800; color:var(--black); }
.ms-sub   { font-size:.6rem;  color:var(--muted); margin-top:2px; }
.modal-divider { height:1px; background:var(--border); margin:14px 0; }
.modal-er {
  display:flex; align-items:center; justify-content:space-between;
  background:var(--green-lt); border-radius:var(--radius-sm); padding:10px 14px;
}
.modal-er-label { font-size:.78rem; font-weight:600; color:var(--sub); }
.modal-er-value { font-size:1.2rem; font-weight:800; color:var(--green); }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width:900px) {
  .charts-grid { grid-template-columns:1fr; }
  .modal-stats  { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:640px) {
  .header-inner  { padding:12px 16px; }
  .brand-name    { font-size:.95rem; }
  .period-badge  { font-size:.7rem; padding:5px 10px; }
  .main-content  { padding:20px 12px 48px; gap:36px; }
  .kpi-grid      { grid-template-columns:repeat(2,1fr); }
  .kpi-value     { font-size:1.4rem; }
  .post-row      { grid-template-columns:90px 1fr; }
  .post-thumb    { width:90px; height:90px; }
  .insight-title { min-width:100%; }
  .insight-divider { display:none; }
}
