/* ============================================================
   특갤봇 운영 내역 — DCInside-inspired 라이트 테마
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: #e8e8e8;
  color: #333;
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #3b4890;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============ Top Nav Bar ============ */
.top-nav {
  background: #2b2d42;
  border-bottom: 2px solid #1a1b2e;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-nav-inner {
  width: 100%;
  max-width: 1100px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-nav-logo {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.top-nav-logo span {
  color: #8d99ff;
}

.top-nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.top-nav-links a {
  color: #b0b4c8;
  font-size: 11px;
}

.top-nav-links a:hover {
  color: #fff;
  text-decoration: none;
}

.server-status {
  color: #d4d7e3;
  font-size: 11px;
  line-height: 1;
  user-select: none;
}

.server-status.healthy {
  color: #d4f3d9;
}

.server-status.unhealthy {
  color: #ffd0d0;
}

/* ============ Main Layout ============ */
.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 0;
  min-height: calc(100vh - 36px - 40px);
}

.main-content {
  min-width: 0;
}

/* ============ Gallery Header ============ */
.gallery-header {
  background: #fff;
  border: 1px solid #ccc;
  border-bottom: 2px solid #3b4890;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.gallery-icon {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.gallery-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.gallery-info {
  flex: 1;
  min-width: 0;
}

.gallery-title {
  font-size: 17px;
  font-weight: 700;
  color: #333;
  letter-spacing: -0.02em;
}

.gallery-desc {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.gallery-manager {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.gallery-manager strong {
  color: #3b4890;
  font-weight: 600;
}

/* ============ Stats Bar ============ */
.stats-bar {
  background: #f8f8f8;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ddd;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.stats-total {
  font-size: 12px;
  color: #555;
}

.stats-total strong {
  color: #3b4890;
  font-weight: 700;
}

.stats-counts {
  display: flex;
  gap: 12px;
}

.stat-item {
  font-size: 11px;
  color: #777;
  display: flex;
  align-items: center;
  gap: 3px;
}

.stat-text {
  margin-left: 1px;
}

.stat-value {
  margin-left: 2px;
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.stat-dot-allow {
  background: #2e7d32;
}

.stat-dot-deny {
  background: #999;
}

.stat-dot-review {
  background: #e65100;
}

.stat-dot-filtered {
  background: #c62828;
}

.stat-dot-forced {
  background: #9e9e9e;
}

/* ============ Filter Tabs ============ */
.filter-tabs {
  background: #fff;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ddd;
  padding: 0 12px;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}

.filter-tab:hover {
  color: #333;
  text-decoration: none;
}

.filter-tab.active {
  color: #3b4890;
  border-bottom-color: #3b4890;
}

/* ============ Board Table ============ */
.record-list {
  background: #fff;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
}

.board-table thead {
  background: #f2f3f5;
}

.board-table th {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #777;
  text-align: center;
  border-bottom: 1px solid #ddd;
  white-space: nowrap;
}

.board-table td {
  padding: 7px 10px;
  font-size: 13px;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.board-table tbody tr:hover {
  background: #f5f7ff;
}

/* Column alignment */
.col-no {
  width: 56px;
  text-align: center;
}

.col-decision {
  width: 72px;
  text-align: center;
}

.col-policy {
  width: 56px;
  text-align: center;
}

.col-reason {
  width: 80px;
  text-align: center;
}

.col-date {
  width: 80px;
  text-align: center;
}

.col-title {
  text-align: left;
}

.cell-no {
  color: #999;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.cell-title {
  text-align: left;
  word-break: break-word;
}

.cell-title a {
  color: #333;
}

.cell-title a:hover {
  color: #3b4890;
  text-decoration: underline;
}

.cell-decision {
  text-align: center;
  white-space: nowrap;
}

.cell-policy {
  color: #3b4890;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.cell-reason {
  color: #666;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.cell-date {
  color: #999;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

/* ============ Decision Badges ============ */
.badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-allow {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.badge-deny {
  background: #eaf3ff;
  color: #2f5f9d;
  border: 1px solid #c8daf3;
}

.badge-review {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
}

.badge-pending {
  background: #ffe7e7;
  color: #b22222;
  border: 1px solid #f2b4b4;
}

.badge-unknown {
  background: #f5f5f5;
  color: #9e9e9e;
  border: 1px solid #e0e0e0;
}

.badge-filtered {
  background: #fdecea;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.badge-forced {
  background: #e0e0e0;
  color: #212121;
  border: 1px solid #616161;
}

.badge-done {
  background: #e0f2f1;
  color: #00695c;
  border: 1px solid #80cbc4;
}

/* ============ Pager ============ */
.pager {
  display: flex;
  justify-content: center;
  padding: 12px 0;
  background: #fff;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
}

.pager-link {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  font-size: 12px;
}

.pager-link:hover {
  background: #f0f4ff;
  color: #3b4890;
  text-decoration: none;
}

/* ============ Empty State ============ */
.empty-state {
  background: #fff;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  padding: 50px 20px;
  text-align: center;
  color: #999;
}

/* ============ Sidebar ============ */
.sidebar {
  padding-top: 0;
}

.sidebar-box {
  background: #fff;
  border: 1px solid #ccc;
  margin-bottom: 8px;
}

.sidebar-box-title {
  background: #f2f3f5;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #555;
  border-bottom: 1px solid #ddd;
}

.sidebar-box-body {
  padding: 10px 12px;
}

.sidebar-box-body-ranking {
  padding-top: 4px;
}

.sidebar-info-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 12px;
  color: #666;
  border-bottom: 1px solid #f5f5f5;
}

.sidebar-info-row:last-child {
  border-bottom: none;
}

.sidebar-info-label {
  color: #999;
}

.ranking-row {
  padding: 8px 0;
  border-bottom: 1px solid #f1f1f1;
}

.ranking-row:first-child {
  padding-top: 4px;
}

.ranking-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ranking-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ranking-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 18px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.ranking-badge-1 {
  background: #fff4d8;
  border-color: #e4cb84;
  color: #9a6a00;
}

.ranking-badge-2 {
  background: #eef2f6;
  border-color: #c8d2dc;
  color: #54606c;
}

.ranking-badge-3 {
  background: #f8ece4;
  border-color: #dcbca8;
  color: #8c5a3c;
}

.ranking-label {
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
}

.ranking-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #777;
  line-height: 1.5;
}

.ranking-empty {
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}

.sidebar-info-value {
  font-weight: 600;
  color: #333;
}

.sidebar-policy-list {
  font-size: 11px;
  color: #666;
}

.policy-accordion {
  border-bottom: 1px solid #f0f0f0;
}

.policy-accordion:last-child {
  border-bottom: none;
}

.policy-accordion summary {
  padding: 5px 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  line-height: 1.6;
  user-select: none;
}

.policy-accordion summary::-webkit-details-marker {
  display: none;
}

.policy-accordion summary::after {
  content: '▸';
  color: #ccc;
  font-size: 9px;
  margin-left: auto;
  padding-left: 6px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.policy-accordion[open] summary::after {
  transform: rotate(90deg);
  color: #999;
}

.policy-accordion summary:hover {
  color: #333;
}

.policy-detail {
  padding: 4px 0 8px 22px;
  font-size: 11px;
  color: #888;
  line-height: 1.7;
}

.policy-penalty {
  color: #c44;
  font-size: 10px;
  font-weight: 600;
}

.sidebar-policy-id {
  color: #3b4890;
  font-weight: 700;
  margin-right: 4px;
}

/* ============ Footer ============ */
.site-footer {
  background: #2b2d42;
  padding: 12px 16px;
  text-align: center;
  font-size: 11px;
  color: #8a8da0;
}

/* ============================================================
   Detail Page
   ============================================================ */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 12px 0 8px;
  font-size: 12px;
  color: #3b4890;
}

.back-link::before {
  content: "◀";
  font-size: 9px;
}

.detail-view {
  background: #fff;
  border: 1px solid #ccc;
}

.detail-header {
  padding: 14px 20px;
  border-bottom: 1px solid #ddd;
}

.detail-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.detail-title {
  font-size: 17px;
  font-weight: 700;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  font-size: 12px;
  color: #888;
}

.detail-meta-label {
  color: #aaa;
  margin-right: 2px;
}

.detail-body {
  padding: 20px;
}

.post-content {
  padding: 16px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #eee;
  min-height: 60px;
}

.post-body {
  font-size: 14px;
  line-height: 1.8;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-thumb-area {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: #fafafa;
  border: 1px solid #eee;
}

.detail-thumb-area h3 {
  margin: 0 0 10px;
  font-size: 12px;
  color: #999;
  font-weight: 400;
}

.detail-thumb {
  max-width: 100%;
  width: auto;
  max-height: 300px;
  border: 1px solid #ddd;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table th,
.info-table td {
  padding: 9px 14px;
  font-size: 13px;
  border: 1px solid #e5e5e5;
  vertical-align: top;
  line-height: 1.6;
}

.info-table th {
  width: 100px;
  background: #f2f3f5;
  color: #555;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.info-table td {
  color: #333;
  word-break: break-word;
}

.reason-box {
  padding: 18px 20px;
  border-top: 1px solid #e5e5e5;
}

.reason-box h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #333;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 5px;
}

.gemini-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  flex-shrink: 0;
}

.reason-text {
  font-size: 13px;
  line-height: 1.8;
  color: #444;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fafafa;
  padding: 12px 14px;
  border: 1px solid #eee;
}

.debug-reason-box {
  margin-top: 12px;
  border: 1px solid #ececec;
  background: #fcfcfc;
}

.debug-reason-box summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 12px;
  color: #666;
  user-select: none;
}

.debug-reason-text {
  margin: 0;
  padding: 0 12px 12px;
  font-size: 12px;
  line-height: 1.7;
  color: #666;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-footer {
  display: flex;
  justify-content: flex-start;
  padding: 10px 20px;
  background: #f2f3f5;
  border-top: 1px solid #e5e5e5;
  font-size: 12px;
}

.detail-footer a {
  color: #3b4890;
}

/* ============ Ranking Toggle (hidden on desktop) ============ */
.ranking-toggle {
  display: none;
}

/* ============ Ranking Modal ============ */
.ranking-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: flex-end;
  justify-content: center;
}

.ranking-modal.open {
  display: flex;
}

.ranking-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.2s ease;
}

.ranking-modal-content {
  position: relative;
  z-index: 1;
  background: #fff;
  width: 100%;
  max-width: 400px;
  max-height: 70vh;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.25s ease;
}

.ranking-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  font-weight: 700;
  color: #333;
}

.ranking-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.ranking-modal-close:hover {
  color: #333;
}

.ranking-modal-body {
  padding: 12px 16px 20px;
  overflow-y: auto;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ============ Responsive ============ */
@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
    padding: 0 6px;
  }

  .sidebar {
    display: none;
  }

  .nav-link-history {
    display: none;
  }

  .ranking-toggle {
    display: inline-block;
    color: #ffefc2;
    background: rgba(255, 193, 7, 0.18);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 193, 7, 0.35);
    letter-spacing: -0.02em;
  }

  .ranking-toggle:hover {
    color: #fff;
    background: rgba(255, 193, 7, 0.3);
    text-decoration: none;
  }

  .stats-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .stats-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    width: 100%;
  }

  .stat-item {
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 48px;
  }

  .stat-value {
    margin-left: 0;
    font-size: 11px;
    color: #555;
    font-weight: 600;
  }

  .stat-value::before {
    content: '(';
  }

  .stat-value::after {
    content: ')';
  }

  .gallery-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .board-table td,
  .board-table th {
    padding: 6px 4px;
    font-size: 11px;
  }

  .col-no {
    width: 38px;
  }

  .col-decision {
    width: 48px;
  }

  .col-policy {
    width: 36px;
  }

  .col-reason {
    width: 36px;
  }


  .col-date,
  .cell-date {
    display: none;
  }

  .badge {
    font-size: 10px;
    padding: 1px 3px;
  }

  .gallery-title {
    font-size: 15px;
  }

  /* Detail page mobile */
  .detail-header {
    padding: 12px 14px;
  }

  .detail-title {
    font-size: 15px;
  }

  .detail-meta {
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
  }

  .detail-body {
    padding: 12px 14px;
  }

  .post-content {
    padding: 10px 0;
    margin-bottom: 12px;
    min-height: 40px;
  }

  .post-body {
    font-size: 13px;
    line-height: 1.7;
  }

  .info-table th {
    width: 76px;
    font-size: 12px;
    padding: 7px 8px;
  }

  .info-table td {
    font-size: 12px;
    padding: 7px 10px;
  }

  .reason-box {
    padding: 12px 14px;
  }

  .reason-box h3 {
    font-size: 12px;
  }

  .reason-text {
    font-size: 12px;
    padding: 10px 12px;
  }

  .debug-reason-box summary,
  .debug-reason-text {
    font-size: 11px;
  }

  .detail-footer {
    padding: 10px 14px;
  }
}
