/* ============================================================
   HAEBAN — 해외 네티즌 반응 커뮤니티 Design System
   ============================================================ */
:root {
    --font: 'Noto Sans KR', 'Malgun Gothic', sans-serif;

    /* Brand */
    --brand:         #0f172a;
    --brand-accent:  #38bdf8;

    /* Surface */
    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;

    /* Primary (interactive) */
    --primary:       #0ea5e9;
    --primary-hover: #0284c7;
    --primary-light: #e0f2fe;

    /* Hot */
    --hot:           #f43f5e;
    --hot-light:     #fff1f2;

    /* Text */
    --text-1:        #0f172a;
    --text-2:        #334155;
    --text-3:        #64748b;
    --text-4:        #94a3b8;

    /* Borders */
    --border:        #e2e8f0;
    --border-dark:   #cbd5e1;

    /* Shadow */
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.06);
    --shadow:        0 2px 10px rgba(0,0,0,0.08);
    --shadow-md:     0 8px 30px rgba(0,0,0,0.14);
    --shadow-lg:     0 20px 60px rgba(0,0,0,0.18);

    /* Radius */
    --radius:        12px;
    --radius-sm:     8px;
    --radius-xs:     4px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-2);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Header ─────────────────────────────────────────────── */
.top-header {
    background: var(--brand);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 16px rgba(0,0,0,0.24);
}

.header-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-main {
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 1.5px;
}

.logo-sub {
    font-size: 9.5px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.1px;
    margin-top: 3px;
    white-space: nowrap;
}

/* ── Nav Dropdown ──────────────────────────────────────── */
.main-nav { display: flex; align-items: center; }

.nav-dropdown { position: relative; }

.nav-cat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.nav-cat-btn:hover,
.nav-cat-btn[aria-expanded="true"] {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.3);
}

.chevron {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.75;
    flex-shrink: 0;
}
.nav-cat-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 172px;
    z-index: 300;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.drop-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    font-family: var(--font);
    transition: background 0.1s, color 0.1s;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.drop-item:last-child { border-bottom: none; }

.drop-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.drop-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.drop-icon { font-size: 14px; flex-shrink: 0; }

/* ── Header Right ──────────────────────────────────────── */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: background 0.15s, border-color 0.15s;
}

.search-box:focus-within {
    background: rgba(255,255,255,0.18);
    border-color: var(--brand-accent);
}

.search-box input {
    border: none;
    outline: none;
    padding: 8px 12px;
    width: 180px;
    font-size: 13px;
    font-family: var(--font);
    color: #ffffff;
    background: transparent;
}

.search-box input::placeholder { color: rgba(255,255,255,0.4); }

.search-box button {
    padding: 0 12px;
    height: 36px;
    color: rgba(255,255,255,0.55);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.search-box button:hover { color: var(--brand-accent); }

.login-btn {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    padding: 7px 15px;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    transition: all 0.15s;
    white-space: nowrap;
}

.login-btn:hover {
    background: var(--brand-accent);
    color: var(--brand);
    border-color: var(--brand-accent);
}

/* ── Layout ─────────────────────────────────────────────── */
.layout {
    max-width: 1160px;
    margin: 28px auto 80px;
    padding: 0 24px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ── Board Section ──────────────────────────────────────── */
.board-section {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.board-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.board-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.board-header h2 {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.3px;
}

.board-count {
    font-size: 11.5px;
    color: var(--text-4);
    font-weight: 500;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 20px;
}

.board-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.board-tabs button {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    padding: 5px 12px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: var(--font);
}

.board-tabs button.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ── Board Items ────────────────────────────────────────── */
.board-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    border-left: 3px solid transparent;
}

.board-item:last-child { border-bottom: none; }

.board-item:hover {
    background: #f0f9ff;
    border-left-color: var(--primary);
}

img.item-flag {
    width: 30px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 3px;
    object-fit: cover;
}

span.item-flag.globe {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.item-main {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
    word-break: keep-all;
    margin-bottom: 5px;
}

.item-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.item-region {
    font-size: 11px;
    color: var(--text-4);
    letter-spacing: -0.1px;
}

.item-category {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--primary-light);
    color: var(--primary);
    white-space: nowrap;
}

.item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.item-time {
    font-size: 11px;
    color: var(--text-4);
    white-space: nowrap;
}

/* Source Platform Badges */
.source-badge {
    display: inline-flex;
    align-items: center;
    font-size: 9.5px;
    font-weight: 800;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.source-badge.reddit   { background: #ff4500; }
.source-badge.youtube  { background: #ff0000; }
.source-badge.weibo    { background: #e6162d; }
.source-badge.yahoo    { background: #6001d2; }
.source-badge.fivech   { background: #0a7a3a; }
.source-badge.hn       { background: #f60; }
.source-badge.ptt      { background: #007bff; }
.source-badge.bilibili { background: #00a1d6; }
.source-badge.other    { background: #64748b; }

.comment-count {
    font-size: 11px;
    color: var(--hot);
    font-weight: 700;
    white-space: nowrap;
}

.new-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 800;
    color: white;
    background: var(--hot);
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Loading / Empty / Error ────────────────────────────── */
.loading-state,
.empty-state,
.error-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-3);
}

.loading-state p,
.empty-state p {
    font-size: 14px;
    margin-top: 14px;
    color: var(--text-3);
}

.empty-state .sub {
    font-size: 12.5px;
    color: var(--text-4);
    margin-top: 6px;
}

.empty-item {
    font-size: 12.5px;
    color: var(--text-4);
    padding: 6px 0;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
    padding: 18px;
    display: flex;
    justify-content: center;
    gap: 4px;
    border-top: 1px solid var(--border);
}

.pagination button {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-3);
    padding: 0 8px;
    transition: all 0.15s;
    font-family: var(--font);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 700;
}

.page-ellipsis {
    display: flex;
    align-items: center;
    padding: 0 4px;
    color: var(--text-4);
    font-size: 13px;
    user-select: none;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: 288px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.widget-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.widget-header h3 {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 5px;
}

.hot-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.hot-list li:last-child { border-bottom: none; padding-bottom: 0; }
.hot-list li:first-child { padding-top: 0; }

.hot-list .rank {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--text-4);
    min-width: 16px;
    padding-top: 1px;
    flex-shrink: 0;
}

.hot-list .rank.top { color: var(--hot); }

.hot-list .title {
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.48;
    word-break: keep-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.12s;
}

.hot-list li:hover .title { color: var(--primary); }

/* CTA Widget */
.cta-widget {
    text-align: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    border-color: #1e3a5f;
    padding: 24px 18px;
}

.cta-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.cta-title {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.cta-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    line-height: 1.7;
    margin-bottom: 16px;
    word-break: keep-all;
}

.primary-btn {
    width: 100%;
    background: var(--brand-accent);
    color: var(--brand);
    padding: 10px;
    font-size: 13px;
    font-weight: 800;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    transition: all 0.15s;
    letter-spacing: -0.2px;
}

.primary-btn:hover {
    background: #7dd3fc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56,189,248,0.35);
}

/* Ad Widget */
.ad-widget {
    height: 250px;
    background: var(--bg);
    border: 1.5px dashed var(--border-dark);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-4);
    font-size: 12.5px;
    font-weight: 500;
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
    background: var(--brand);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 20px 24px;
}

.footer-inner {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-logo {
    font-size: 13px;
    font-weight: 800;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1.5px;
}

.footer-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 960px) {
    .layout { flex-direction: column; padding: 0 16px; margin-top: 20px; }
    .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .sidebar .widget { flex: 1; min-width: 240px; }
    .ad-widget { display: none; }
}

@media (max-width: 640px) {
    .header-inner { padding: 0 16px; gap: 12px; }
    .logo-sub { display: none; }
    .search-box input { width: 120px; font-size: 12px; }
    .login-btn { display: none; }
    .layout { margin: 14px auto 60px; gap: 14px; }
    .board-item { padding: 11px 14px; gap: 10px; }
    img.item-flag { width: 26px; height: 19px; }
    span.item-flag.globe { font-size: 20px; }
    .item-title { font-size: 13px; }
    .board-count { display: none; }
    .footer-inner { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (max-width: 400px) {
    .logo-main { font-size: 14px; letter-spacing: 0.5px; }
    .search-box input { width: 90px; }
    .nav-cat-btn { padding: 7px 10px; font-size: 12.5px; }
}
