/* index_styles.css - Magazine Style Layout with View-Tier System */

:root {
    --bg-primary: #1a1f2e;
    --bg-secondary: #2d3748;
    --bg-card: #4a5568;
    --bg-hover: #5a6578;
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --text-subtle: #718096;
    --accent-main: #68d391;
    --accent-second: #81e6d9;
    --accent-warm: #f6e05e;
    --accent-soft: #9ae6b4;
    --border-primary: #4a5568;
    --border-secondary: #5a6578;
    
    /* Magazine specific */
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 12px 40px rgba(0,0,0,0.15);
    --text-dark: #1a202c;
    --text-body: #4a5568;
    --text-caption: #718096;
}

/* ==================== BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
}

/* ==================== TAB NAVIGATION ==================== */
.tab-navigation {
    background: rgba(45, 55, 72, 0.95);
    border-bottom: 1px solid rgba(104, 211, 145, 0.1);
    padding: 0 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    backdrop-filter: blur(10px);
}

.tab-navigation::-webkit-scrollbar { display: none; }

.tab-container {
    display: flex;
    gap: 2px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 50px;
    align-items: center;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px 8px 0 0;
    position: relative;
    white-space: nowrap;
    background: transparent;
    border-bottom: 2px solid transparent;
}

.tab-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-main), var(--accent-second));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.tab-item:hover::before { width: 80%; }
.tab-item:hover { color: var(--text-secondary); background: rgba(104, 211, 145, 0.05); }
.tab-item.active { color: var(--text-primary); background: rgba(104, 211, 145, 0.08); border-bottom-color: var(--accent-main); }
.tab-item.active::before { width: 100%; }
.tab-item i { font-size: 16px; opacity: 0.8; transition: all 0.3s ease; }
.tab-item:hover i, .tab-item.active i { opacity: 1; color: var(--accent-main); }

/* ==================== LAYOUT ==================== */
.content-wrapper { padding: 20px; }

.main-content {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    gap: 20px;
}

/* ==================== SIDEBARS ==================== */
.left-sidebar, .right-sidebar {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    height: fit-content;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.left-sidebar h3, .right-sidebar h3 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(104, 211, 145, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--accent-main), var(--accent-second));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==================== LEFT SIDEBAR CARDS ==================== */
.left-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
}

.left-card:hover {
    border-color: rgba(104, 211, 145, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.left-image {
    width: 100%;
    height: 110px;
    overflow: hidden;
    position: relative;
}

.left-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.left-card:hover .left-image img {
    transform: scale(1.05);
}

/* Ribbon badge for left cards */
.left-card-ribbon {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 9px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 12px;
    color: white;
    letter-spacing: 0.04em;
    z-index: 3;
    pointer-events: none;
}

.left-content {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.left-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.45;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.left-meta {
    font-size: 11px;
    color: var(--text-caption);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.meta-channel {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    color: #4a5568;
}

.meta-time {
    color: #94a3b8;
    font-size: 10px;
}

/* ==================== RIGHT SIDEBAR CARDS ==================== */
.right-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
}

.right-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.right-image {
    width: 100%;
    height: 130px;
    overflow: hidden;
}

.right-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.right-card:hover .right-image img {
    transform: scale(1.05);
}

.right-content {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.right-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.4;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.right-meta {
    font-size: 10px;
    color: var(--text-caption);
    margin-top: 4px;
}

/* ==================== CENTER MAIN ==================== */
.center-main {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* ==================== MAGAZINE MAIN CARD ==================== */
.main-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.35s ease;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
    position: relative;
}

.main-card:hover {
    border-color: rgba(104, 211, 145, 0.5);
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

/* Image wrapper with badge support */
.main-img-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.main-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.main-card:hover .main-img-wrapper img {
    transform: scale(1.03);
}

/* ==================== PREMIUM VIEW TIER SYSTEM ==================== */

/* ── Corner Stamp (icon only, top-right of image) ── */
.tier-corner-stamp {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    font-size: 12px;
    color: white;
    border: 1.5px solid rgba(255,255,255,0.4);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
    transition: transform 0.22s ease;
    pointer-events: none;
}

.tier-corner-stamp-sm {
    width: 22px;
    height: 22px;
    font-size: 9px;
    top: 7px;
    right: 7px;
}

.main-img-wrapper:hover .tier-corner-stamp,
.double-img-wrapper:hover .tier-corner-stamp {
    transform: scale(1.12);
}

/* ── Readability Score Badge (bottom-left of image) ── */

/* Stamp colours per tier */
.tier-corner-stamp-legendary {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    box-shadow: 0 0 0 0 rgba(124,58,237,0.5);
    animation: stampPulse-legendary 2s ease-in-out infinite;
}
.tier-corner-stamp-viral {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 0 0 0 rgba(220,38,38,0.5);
    animation: stampPulse-viral 2s ease-in-out infinite;
}
.tier-corner-stamp-hot {
    background: linear-gradient(135deg, #ea580c, #f97316);
    box-shadow: 0 0 0 0 rgba(234,88,12,0.45);
    animation: stampPulse-hot 2.3s ease-in-out infinite;
}
.tier-corner-stamp-trending {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}
.tier-corner-stamp-rising {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}
.tier-corner-stamp-fresh {
    background: linear-gradient(135deg, #059669, #10b981);
}

@keyframes stampPulse-legendary {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.5), 0 2px 10px rgba(124,58,237,0.3); }
    50%       { box-shadow: 0 0 0 7px rgba(124,58,237,0), 0 2px 18px rgba(124,58,237,0.5); }
}
@keyframes stampPulse-viral {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.5), 0 2px 10px rgba(220,38,38,0.3); }
    50%       { box-shadow: 0 0 0 7px rgba(220,38,38,0), 0 2px 18px rgba(220,38,38,0.5); }
}
@keyframes stampPulse-hot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234,88,12,0.45), 0 2px 8px rgba(234,88,12,0.3); }
    50%       { box-shadow: 0 0 0 6px rgba(234,88,12,0), 0 2px 16px rgba(234,88,12,0.4); }
}

/* ── Tier Badge Bar (below image, above card content) ── */
.tier-badge-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* Bar accent line on the left */
.tier-badge-bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
}

/* Badge bar backgrounds per tier */
.tier-badge-bar-legendary {
    background: linear-gradient(90deg, rgba(124,58,237,0.10) 0%, rgba(168,85,247,0.05) 100%);
    border-bottom-color: rgba(124,58,237,0.12);
}
.tier-badge-bar-viral {
    background: linear-gradient(90deg, rgba(220,38,38,0.09) 0%, rgba(239,68,68,0.04) 100%);
    border-bottom-color: rgba(220,38,38,0.12);
}
.tier-badge-bar-hot {
    background: linear-gradient(90deg, rgba(234,88,12,0.09) 0%, rgba(249,115,22,0.04) 100%);
    border-bottom-color: rgba(234,88,12,0.12);
}
.tier-badge-bar-trending {
    background: linear-gradient(90deg, rgba(217,119,6,0.09) 0%, rgba(245,158,11,0.04) 100%);
    border-bottom-color: rgba(217,119,6,0.12);
}
.tier-badge-bar-rising {
    background: linear-gradient(90deg, rgba(37,99,235,0.08) 0%, rgba(59,130,246,0.04) 100%);
    border-bottom-color: rgba(37,99,235,0.10);
}
.tier-badge-bar-fresh {
    background: linear-gradient(90deg, rgba(5,150,105,0.08) 0%, rgba(16,185,129,0.04) 100%);
    border-bottom-color: rgba(5,150,105,0.10);
}

/* ── Tier Pill (label inside bar) ── */
.tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 7px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    color: white;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.tier-pill i { font-size: 9px; }

.tier-pill-legendary {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    box-shadow: 0 1px 6px rgba(124,58,237,0.35);
}
.tier-pill-viral {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 1px 6px rgba(220,38,38,0.3);
}
.tier-pill-hot {
    background: linear-gradient(135deg, #ea580c, #f97316);
    box-shadow: 0 1px 6px rgba(234,88,12,0.3);
}
.tier-pill-trending {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 1px 6px rgba(217,119,6,0.3);
}
.tier-pill-rising {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 1px 6px rgba(37,99,235,0.3);
}
.tier-pill-fresh {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 1px 6px rgba(5,150,105,0.3);
}

/* ── View count in badge bar ── */
.tier-view-count {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.tier-view-count i { font-size: 10px; color: #94a3b8; }

/* ── Score bar (right side of tier bar) ── */
.tier-score-bar {
    width: 64px;
    height: 4px;
    background: rgba(0,0,0,0.07);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.tier-score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.tier-score-fill-legendary { background: linear-gradient(90deg, #7c3aed, #a855f7); }
.tier-score-fill-viral      { background: linear-gradient(90deg, #dc2626, #ef4444); }
.tier-score-fill-hot        { background: linear-gradient(90deg, #ea580c, #f97316); }
.tier-score-fill-trending   { background: linear-gradient(90deg, #d97706, #f59e0b); }
.tier-score-fill-rising     { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.tier-score-fill-fresh      { background: linear-gradient(90deg, #059669, #10b981); }

/* ==================== CARD TIER BACKGROUNDS ==================== */
/* สีพื้นหลังเข้มชัด แยกความแตกต่างของแต่ละ tier ได้ชัดเจน */

/* < 1K — ขาวธรรมดา */
.card-tier-normal {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.card-tier-normal .main-title,
.card-tier-normal .double-title,
.card-tier-normal .left-title,
.card-tier-normal .right-title { color: #1a202c; }
.card-tier-normal .main-description,
.card-tier-normal .double-description { color: #4a5568; }
.card-tier-normal .card-source-label,
.card-tier-normal .news-stats,
.card-tier-normal .left-meta,
.card-tier-normal .right-meta { color: #718096; }

/* ≥ 1K — เขียวมรกต สดใส */
.card-tier-fresh {
    background: linear-gradient(145deg, #e6fffa 0%, #b2f5ea 50%, #c6f6d5 100%);
    border: 1px solid rgba(49,151,149,0.35);
    box-shadow: 0 3px 16px rgba(49,151,149,0.18), 0 1px 4px rgba(0,0,0,0.05);
}
.card-tier-fresh:hover {
    border-color: rgba(49,151,149,0.6);
    box-shadow: 0 8px 28px rgba(49,151,149,0.28), 0 2px 8px rgba(0,0,0,0.07);
    transform: translateY(-3px);
}
.card-tier-fresh .main-title,
.card-tier-fresh .double-title,
.card-tier-fresh .left-title,
.card-tier-fresh .right-title { color: #1a4a3a; font-weight: 700; }
.card-tier-fresh .main-description,
.card-tier-fresh .double-description { color: #276749; }
.card-tier-fresh .card-source-label { color: #2f855a; }
.card-tier-fresh .news-stats,
.card-tier-fresh .left-meta,
.card-tier-fresh .right-meta { color: #38a169; }
.card-tier-fresh .action-bar { background: linear-gradient(90deg, #c6f6d5, #b2f5ea); border-top-color: rgba(49,151,149,0.2); }

/* ≥ 10K — น้ำเงินอินดิโก้ สะอาดน่าเชื่อถือ */
.card-tier-rising {
    background: linear-gradient(145deg, #ebf8ff 0%, #bee3f8 50%, #c3dafe 100%);
    border: 1px solid rgba(49,130,206,0.38);
    box-shadow: 0 3px 16px rgba(49,130,206,0.18), 0 1px 4px rgba(0,0,0,0.05);
}
.card-tier-rising:hover {
    border-color: rgba(49,130,206,0.6);
    box-shadow: 0 8px 28px rgba(49,130,206,0.28), 0 2px 8px rgba(0,0,0,0.07);
    transform: translateY(-3px);
}
.card-tier-rising .main-title,
.card-tier-rising .double-title,
.card-tier-rising .left-title,
.card-tier-rising .right-title { color: #1a365d; font-weight: 700; }
.card-tier-rising .main-description,
.card-tier-rising .double-description { color: #2a4a8a; }
.card-tier-rising .card-source-label { color: #2b6cb0; }
.card-tier-rising .news-stats,
.card-tier-rising .left-meta,
.card-tier-rising .right-meta { color: #3182ce; }
.card-tier-rising .action-bar { background: linear-gradient(90deg, #bee3f8, #c3dafe); border-top-color: rgba(49,130,206,0.2); }

/* ≥ 50K — ทอง/อำพัน สะดุดตา */
.card-tier-trending {
    background: linear-gradient(145deg, #fffff0 0%, #fefcbf 45%, #fbd38d 100%);
    border: 1px solid rgba(214,158,46,0.45);
    box-shadow: 0 4px 18px rgba(214,158,46,0.22), 0 1px 5px rgba(0,0,0,0.06);
}
.card-tier-trending:hover {
    border-color: rgba(214,158,46,0.65);
    box-shadow: 0 10px 32px rgba(214,158,46,0.32), 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}
.card-tier-trending .main-title,
.card-tier-trending .double-title,
.card-tier-trending .left-title,
.card-tier-trending .right-title { color: #5f370e; font-weight: 700; }
.card-tier-trending .main-description,
.card-tier-trending .double-description { color: #744210; }
.card-tier-trending .card-source-label { color: #975a16; }
.card-tier-trending .news-stats,
.card-tier-trending .left-meta,
.card-tier-trending .right-meta { color: #b7791f; }
.card-tier-trending .action-bar { background: linear-gradient(90deg, #fefcbf, #fbd38d); border-top-color: rgba(214,158,46,0.25); }

/* ≥ 100K — ส้มแดง เร่าร้อน HOT */
.card-tier-hot {
    background: linear-gradient(145deg, #fff5f0 0%, #ffd5b8 45%, #feb2a8 100%);
    border: 1px solid rgba(221,107,32,0.45);
    box-shadow: 0 4px 20px rgba(221,107,32,0.22), 0 1px 5px rgba(0,0,0,0.06);
}
.card-tier-hot:hover {
    border-color: rgba(221,107,32,0.65);
    box-shadow: 0 10px 36px rgba(221,107,32,0.32), 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}
.card-tier-hot .main-title,
.card-tier-hot .double-title,
.card-tier-hot .left-title,
.card-tier-hot .right-title { color: #5a1e06; font-weight: 800; }
.card-tier-hot .main-description,
.card-tier-hot .double-description { color: #7b2d00; }
.card-tier-hot .card-source-label { color: #9c4221; }
.card-tier-hot .news-stats,
.card-tier-hot .left-meta,
.card-tier-hot .right-meta { color: #c05621; }
.card-tier-hot .action-bar { background: linear-gradient(90deg, #ffd5b8, #feb2a8); border-top-color: rgba(221,107,32,0.25); }

/* ≥ 1M — แดงเข้ม VIRAL พลังสูง */
.card-tier-viral {
    background: linear-gradient(145deg, #fff0f0 0%, #fed7d7 40%, #fc8181 100%);
    border: 1px solid rgba(197,48,48,0.50);
    box-shadow: 0 5px 22px rgba(197,48,48,0.25), 0 1px 6px rgba(0,0,0,0.07);
}
.card-tier-viral:hover {
    border-color: rgba(197,48,48,0.70);
    box-shadow: 0 12px 40px rgba(197,48,48,0.35), 0 3px 10px rgba(0,0,0,0.08);
    transform: translateY(-5px);
}
.card-tier-viral .main-title,
.card-tier-viral .double-title,
.card-tier-viral .left-title,
.card-tier-viral .right-title { color: #63171b; font-weight: 800; }
.card-tier-viral .main-description,
.card-tier-viral .double-description { color: #822727; }
.card-tier-viral .card-source-label { color: #9b2c2c; }
.card-tier-viral .news-stats,
.card-tier-viral .left-meta,
.card-tier-viral .right-meta { color: #c53030; }
.card-tier-viral .action-bar { background: linear-gradient(90deg, #fed7d7, #fc8181); border-top-color: rgba(197,48,48,0.25); }

/* ≥ 10M — ม่วงเข้ม LEGENDARY สุดพรีเมียม */
.card-tier-legendary {
    background: linear-gradient(145deg, #faf5ff 0%, #d6bcfa 40%, #b794f4 100%);
    border: 1px solid rgba(107,70,193,0.50);
    box-shadow: 0 5px 24px rgba(107,70,193,0.28), 0 1px 6px rgba(0,0,0,0.07);
    position: relative;
    overflow: hidden;
}
.card-tier-legendary::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at 85% -10%, rgba(237,100,166,0.25) 0%, transparent 55%),
                radial-gradient(ellipse at 10% 100%, rgba(118,169,250,0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}
.card-tier-legendary:hover {
    border-color: rgba(107,70,193,0.70);
    box-shadow: 0 14px 44px rgba(107,70,193,0.38), 0 3px 10px rgba(0,0,0,0.10);
    transform: translateY(-5px);
}
.card-tier-legendary .main-title,
.card-tier-legendary .double-title,
.card-tier-legendary .left-title,
.card-tier-legendary .right-title { color: #322659; font-weight: 800; }
.card-tier-legendary .main-description,
.card-tier-legendary .double-description { color: #44337a; }
.card-tier-legendary .card-source-label { color: #553c9a; }
.card-tier-legendary .news-stats,
.card-tier-legendary .left-meta,
.card-tier-legendary .right-meta { color: #6b46c1; }
.card-tier-legendary .action-bar { background: linear-gradient(90deg, #d6bcfa, #b794f4); border-top-color: rgba(107,70,193,0.25); }
.card-tier-legendary .main-card-content,
.card-tier-legendary .double-card-content,
.card-tier-legendary .left-content,
.card-tier-legendary .right-content { position: relative; z-index: 1; }

/* ── Category badge (on image, top-left) ── */
.card-category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    backdrop-filter: blur(8px);
    box-shadow: 0 1px 6px rgba(0,0,0,0.18);
    z-index: 2;
    opacity: 0.92;
}

/* ── Right card tier background + text (right sidebar cards) ── */
.right-card.card-tier-fresh    { background: linear-gradient(160deg, #e6fffa, #b2f5ea); border-color: rgba(49,151,149,0.35); }
.right-card.card-tier-rising   { background: linear-gradient(160deg, #ebf8ff, #bee3f8); border-color: rgba(49,130,206,0.38); }
.right-card.card-tier-trending { background: linear-gradient(160deg, #fffff0, #fefcbf); border-color: rgba(214,158,46,0.42); }
.right-card.card-tier-hot      { background: linear-gradient(160deg, #fff5f0, #ffd5b8); border-color: rgba(221,107,32,0.42); }
.right-card.card-tier-viral    { background: linear-gradient(160deg, #fff0f0, #fed7d7); border-color: rgba(197,48,48,0.45); }
.right-card.card-tier-legendary{ background: linear-gradient(160deg, #faf5ff, #d6bcfa); border-color: rgba(107,70,193,0.45); }

.right-card.card-tier-fresh .right-title    { color: #1a4a3a; }
.right-card.card-tier-rising .right-title   { color: #1a365d; }
.right-card.card-tier-trending .right-title { color: #5f370e; }
.right-card.card-tier-hot .right-title      { color: #5a1e06; }
.right-card.card-tier-viral .right-title    { color: #63171b; }
.right-card.card-tier-legendary .right-title{ color: #322659; }

/* ── News stats default text ── */
.news-stats { color: #64748b; }
.news-stats i { color: #94a3b8; }

/* ==================== SOURCE LABEL ==================== */
.card-source-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.source-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.main-card-content {
    padding: 18px 20px 12px;
    position: relative;
    z-index: 1;
}

/* Magazine-style headline */
.main-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1.35;
    letter-spacing: -0.02em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Magazine body text */
.main-description {
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 12px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================== DOUBLE ROW CARDS ==================== */
.double-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.double-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    position: relative;
    display: flex;
    flex-direction: column;
}

.double-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.double-img-wrapper {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.double-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.double-card:hover .double-img-wrapper img {
    transform: scale(1.05);
}

.double-card-content {
    padding: 14px 16px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.double-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.4;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Double card short description */
.double-description {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.double-meta {
    font-size: 11px;
    color: var(--text-caption);
    display: flex;
    justify-content: space-between;
}

/* ==================== HASHTAGS ==================== */
.hashtag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
}

.hashtag-tag {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.1), rgba(129, 230, 217, 0.1));
    color: #065f46;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(104, 211, 145, 0.3);
    letter-spacing: 0.02em;
}

.hashtag-tag:hover {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.2), rgba(129, 230, 217, 0.2));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(104, 211, 145, 0.2);
}

/* ==================== NEWS STATS ==================== */
.news-stats {
    display: flex;
    gap: 12px;
    margin: 8px 0 4px;
    font-size: 11px;
    color: #94a3b8;
    padding: 8px 0 4px;
    border-top: 1px solid #f1f5f9;
}

.news-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-stats i {
    font-size: 10px;
    color: #cbd5e1;
}

/* Engagement score indicator */
.stat-engagement {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
    opacity: 0.85;
    letter-spacing: 0.02em;
}
.stat-engagement i { font-size: 9px; }

/* ==================== SCORE BAR + READ BAR (below image) ==================== */

/* Wrapper */
.score-wrap { display: flex; flex-direction: column; }

/* ── Shared row layout — ทั้ง 2 แถวใช้ layout เดียวกัน ── */
.score-bar,
.read-bar {
    display: grid;
    grid-template-columns: 76px 1fr 38px;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    position: relative;
    border-left: 3px solid transparent;
}

/* ── Score bar — น้ำเงิน ── */
.score-bar {
    background: linear-gradient(90deg, rgba(37,99,235,0.10) 0%, rgba(37,99,235,0.03) 100%);
    border-bottom-color: rgba(37,99,235,0.12);
    border-left-color: #2563eb;
}

/* ── Read bar — แดง ── */
.read-bar {
    background: linear-gradient(90deg, rgba(220,38,38,0.10) 0%, rgba(220,38,38,0.03) 100%);
    border-bottom-color: rgba(220,38,38,0.12);
    border-left-color: #dc2626;
}

/* ── Labels (column 1, fixed width) ── */
.score-bar-lbl,
.read-bar-lbl {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}
.score-bar-lbl { color: #1e40af; }
.read-bar-lbl  { color: #991b1b; }
.score-bar-lbl i { font-size: 9px; color: #3b82f6; }
.read-bar-lbl  i { font-size: 9px; color: #ef4444; }

/* ── Track (column 2) ── */
.score-bar-track,
.read-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

/* Score bar fill — น้ำเงินไล่สีตามคะแนน */
.score-bar-fill-high { background: linear-gradient(90deg, #1d4ed8, #60a5fa); }
.score-bar-fill-mid  { background: linear-gradient(90deg, #2563eb, #93c5fd); }
.score-bar-fill-low  { background: linear-gradient(90deg, #3b82f6, #bfdbfe); }
.score-bar-fill-zero { background: #93c5fd; }
.score-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

/* Read bar fill — แดงไล่สีตามเวลา */
.read-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #b91c1c, #f87171);
    transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

/* Tick marks on read bar */
.read-bar-marks {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-evenly;
    pointer-events: none;
}
.read-bar-marks span {
    width: 1px;
    height: 100%;
    background: rgba(255,255,255,0.5);
}

/* ── Value (column 3, fixed width, right-aligned) ── */
.score-bar-num,
.read-bar-time {
    font-size: 12px;
    font-weight: 800;
    text-align: right;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}
.score-bar-num  { color: #1e40af; }
.read-bar-time  { color: #991b1b; }

.score-bar-denom,
.read-bar-unit {
    font-size: 8px;
    font-weight: 500;
    opacity: 0.65;
}

/* ── Compact mode (left/right sidebar) ── */
.score-bar.score-bar-compact,
.read-bar.read-bar-compact {
    grid-template-columns: 18px 1fr 30px;
    padding: 4px 10px 4px 8px;
    gap: 6px;
}
.score-bar-compact .score-bar-track,
.read-bar-compact  .read-bar-track { height: 4px; }

.score-bar-lbl-sm,
.read-bar-lbl-sm {
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.score-bar-lbl-sm { color: #3b82f6; }
.read-bar-lbl-sm  { color: #ef4444; }

.score-bar-compact .score-bar-pct,
.read-bar-compact  .read-bar-time {
    font-size: 10px;
    font-weight: 700;
    text-align: right;
}
.score-bar-compact .score-bar-pct { color: #1e40af; }

/* Remove old level-specific label/num colors — unified blue/red */
.score-bar-high .score-bar-lbl,
.score-bar-mid  .score-bar-lbl,
.score-bar-low  .score-bar-lbl,
.score-bar-zero .score-bar-lbl { color: #1e40af; }

.score-bar-high .score-bar-num,
.score-bar-mid  .score-bar-num,
.score-bar-low  .score-bar-num,
.score-bar-zero .score-bar-num { color: #1e40af; }

.score-bar-high .score-bar-lbl-sm,
.score-bar-mid  .score-bar-lbl-sm,
.score-bar-low  .score-bar-lbl-sm,
.score-bar-zero .score-bar-lbl-sm { color: #3b82f6; }

.score-bar-high.score-bar-compact .score-bar-pct,
.score-bar-mid.score-bar-compact  .score-bar-pct,
.score-bar-low.score-bar-compact  .score-bar-pct,
.score-bar-zero.score-bar-compact .score-bar-pct { color: #1e40af; }

/* ==================== ACTION BAR ==================== */
.action-bar {
    display: flex;
    justify-content: space-around;
    padding: 8px 12px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    gap: 4px;
}


.action-btn {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 30px;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.action-btn i { font-size: 11px; }

.comment-btn:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: #93c5fd;
    color: #3b82f6;
}

.like-btn:hover {
    background: rgba(236, 72, 153, 0.05);
    border-color: #f9a8d4;
    color: #ec4899;
}

.share-btn:hover {
    background: rgba(104, 211, 145, 0.05);
    border-color: #6ee7b7;
    color: #10b981;
}

/* Active/Liked states */
.like-btn.active, .like-btn.liked {
    background: rgba(236, 72, 153, 0.1) !important;
    border-color: #f9a8d4 !important;
    color: #ec4899 !important;
}

.share-btn.active {
    background: rgba(104, 211, 145, 0.1) !important;
    border-color: #6ee7b7 !important;
    color: #10b981 !important;
}

.comment-btn.active, .comment-btn.commented {
    background: rgba(139, 92, 246, 0.1) !important;
    border-color: #c4b5fd !important;
    color: #8b5cf6 !important;
}

.like-btn:disabled {
    background: rgba(236, 72, 153, 0.08) !important;
    border-color: #f9a8d4 !important;
    color: #ec4899 !important;
    cursor: not-allowed;
}

/* Compact action bars for sidebars */
.right-card .action-bar,
.left-card .action-bar {
    padding: 6px 8px;
    background: #f8fafc;
}

.right-card .action-btn,
.left-card .action-btn {
    padding: 5px 6px;
    font-size: 10px;
    min-height: 26px;
    border-radius: 6px;
}

/* ==================== MINI STATS WIDGET ==================== */
.mini-stats {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(104, 211, 145, 0.2);
}

.mini-stats h4 {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--accent-main), var(--accent-second));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mini-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mini-stat-item {
    text-align: center;
    padding: 8px 6px;
    background: rgba(74, 85, 104, 0.4);
    border: 1px solid rgba(104, 211, 145, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mini-stat-item:hover {
    border-color: rgba(104, 211, 145, 0.3);
    background: rgba(104, 211, 145, 0.08);
    transform: translateY(-1px);
}

.mini-stat-label {
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.mini-stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-main);
    line-height: 1;
}

/* ==================== POPULAR HASHTAGS ==================== */
.popular-hashtags-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(104, 211, 145, 0.2);
}

.popular-hashtags-section h4 {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--accent-main), var(--accent-second));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.popular-hashtag {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 4px;
    background: rgba(74, 85, 104, 0.3);
    border: 1px solid rgba(104, 211, 145, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.popular-hashtag:hover {
    background: rgba(104, 211, 145, 0.1);
    border-color: rgba(104, 211, 145, 0.3);
    transform: translateX(4px);
}

.popular-hashtag span:first-child {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-main);
}

.hashtag-count {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 10px;
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--bg-secondary);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-primary);
    margin-top: 30px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.footer-links { display: flex; gap: 15px; }

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s ease;
}

.footer-links a:hover { color: var(--accent-main); }

/* ==================== COMMENT POPUP ==================== */
.comment-popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999; display: none;
}

.comment-popup {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; max-width: 600px; max-height: 80vh;
    background: #f8fafc;
    border: 1px solid var(--border-primary);
    border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.comment-popup-header {
    background: var(--bg-card);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex; justify-content: space-between; align-items: center;
}

.comment-popup-header h3 { font-size: 16px; color: var(--text-primary); }

.comment-popup-close {
    background: none; border: none; font-size: 18px;
    cursor: pointer; color: var(--text-muted); transition: color 0.3s ease;
}

.comment-popup-close:hover { color: var(--text-primary); }

.comment-popup-news {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-card);
}

.comment-news-title {
    font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px;
}

.comment-news-meta { font-size: 11px; color: var(--text-muted); }

.comments-list {
    flex: 1; padding: 20px; overflow-y: auto; max-height: 300px; background: #f1f5f9;
}

.comment-item {
    background: #ffffff; padding: 12px; margin-bottom: 8px;
    border-radius: 8px; border-left: 3px solid var(--accent-main);
    transition: all 0.3s ease; border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.comment-item:hover {
    background: #fefefe; transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.comment-item.reply { margin-left: 20px; border-left-color: var(--accent-second); }

.comment-header {
    display: flex; justify-content: space-between; margin-bottom: 6px;
}

.comment-author { font-weight: 500; font-size: 12px; color: var(--text-primary); }
.comment-time { font-size: 11px; color: var(--text-muted); }
.comment-content { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.4; }
.comment-actions { display: flex; gap: 8px; }

.comment-like-btn, .comment-reply-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 11px; cursor: pointer; padding: 2px 4px; transition: color 0.3s ease;
}

.comment-like-btn:hover { color: var(--accent-second); }
.comment-reply-btn:hover { color: var(--accent-main); }

.comment-form {
    background: var(--bg-card); padding: 15px 20px; border-top: 1px solid var(--border-primary);
}

.comment-form-group input,
.comment-form-group textarea {
    width: 100%; padding: 12px 16px; border: 2px solid #e2e8f0;
    border-radius: 12px; font-size: 14px; font-family: inherit;
    transition: all 0.3s ease; background: #ffffff; color: #1e293b;
    resize: vertical; min-height: 100px;
}

.comment-form-group input:focus,
.comment-form-group textarea:focus {
    outline: none; border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: #fefffe;
}

.comment-form-group input::placeholder,
.comment-form-group textarea::placeholder { color: #94a3b8; }

.comment-submit-btn {
    background: linear-gradient(135deg, var(--accent-main), var(--accent-second));
    color: white; border: none; padding: 8px 16px;
    border-radius: 6px; cursor: pointer; font-size: 12px; transition: all 0.3s ease;
}

.comment-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(104, 211, 145, 0.3);
}

.no-comments {
    text-align: center; color: var(--text-muted); padding: 30px; font-size: 13px;
}

/* ==================== ADVANCED REACTIONS ==================== */
.comment-reactions-container {
    margin: 10px 0 8px 0; display: flex; flex-direction: column; gap: 8px;
    background: rgba(74, 85, 104, 0.1); border-radius: 12px; padding: 8px;
    border: 1px solid rgba(104, 211, 145, 0.08); transition: all 0.3s ease;
}

.comment-reactions-container:hover {
    background: rgba(74, 85, 104, 0.15);
    border-color: rgba(104, 211, 145, 0.12);
}

.comment-reactions-display { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 24px; }

.reaction-summary {
    display: flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.12), rgba(129, 230, 217, 0.08));
    border: 1px solid rgba(104, 211, 145, 0.2); border-radius: 16px; padding: 4px 10px;
    font-size: 12px; color: var(--text-primary); cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.reaction-summary:hover {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.18), rgba(129, 230, 217, 0.12));
    border-color: rgba(104, 211, 145, 0.35);
    transform: scale(1.05) translateY(-1px);
}

.reaction-summary-emojis { display: flex; gap: 2px; font-size: 14px; }
.reaction-summary-count { font-weight: 700; margin-left: 4px; color: var(--accent-main); }

.comment-reactions-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 2px; }

.reaction-btn {
    background: rgba(74, 85, 104, 0.4); border: 1.5px solid rgba(160, 174, 192, 0.25);
    border-radius: 20px; padding: 6px 10px; cursor: pointer; font-size: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; position: relative; overflow: hidden;
    backdrop-filter: blur(15px); user-select: none;
}

.reaction-btn:hover { transform: scale(1.2) rotate(5deg); z-index: 10; }
.reaction-btn:active { transform: scale(1.1) rotate(0deg); }

.reaction-btn.active {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.25), rgba(129, 230, 217, 0.15));
    border-color: var(--accent-main);
    box-shadow: 0 0 20px rgba(104, 211, 145, 0.5);
    transform: scale(1.15);
}

.reaction-count {
    background: rgba(15, 23, 42, 0.9); color: white; font-size: 10px; font-weight: 700;
    padding: 2px 6px; border-radius: 10px; position: absolute; top: -8px; right: -8px;
    min-width: 18px; text-align: center; opacity: 0;
    transform: scale(0) rotate(-15deg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.reaction-btn.has-count .reaction-count { opacity: 1; transform: scale(1) rotate(0deg); }

.reaction-btn.just-reacted { animation: reactionPop 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes reactionPop {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.4) rotate(10deg); }
    50% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.3) rotate(5deg); }
    100% { transform: scale(1.15) rotate(0deg); }
}

.reaction-btn.loading { opacity: 0.6; pointer-events: none; cursor: wait; }

.no-reactions {
    color: var(--text-muted); font-size: 11px; font-style: italic;
    padding: 6px 0; text-align: center; opacity: 0.7;
}

/* Compact reaction buttons */
.reactions-summary {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.1), rgba(129, 230, 217, 0.08));
    border: 1px solid rgba(104, 211, 145, 0.2); border-radius: 12px;
    padding: 2px 8px; font-size: 11px; color: #10b981; font-weight: 600; margin-right: 4px;
}

.reaction-btn-compact {
    background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b;
    font-size: 11px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
    transition: all 0.3s ease; display: flex; align-items: center; gap: 2px; font-weight: 500; position: relative;
}

.reaction-btn-compact:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(104, 211, 145, 0.2);
    border-color: #68d391; background: #f0fdf4;
}

.reaction-btn-compact.active {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.15), rgba(129, 230, 217, 0.1));
    border-color: #10b981; color: #10b981;
    box-shadow: 0 2px 8px rgba(104, 211, 145, 0.3);
    transform: scale(1.05);
}

.reaction-btn-compact .count {
    background: rgba(16, 185, 129, 0.2); color: #10b981; font-size: 9px; font-weight: 700;
    padding: 1px 4px; border-radius: 4px; min-width: 14px; text-align: center;
}

.reaction-btn-compact.active .count { background: #10b981; color: white; }

/* ==================== LOADING ==================== */
.loading { text-align: center; padding: 40px; display: none; }

.loading-spinner {
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top: 3px solid var(--accent-main);
    border-radius: 50%; width: 30px; height: 30px;
    animation: spin 1s linear infinite; margin: 0 auto 10px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.loading-text { color: var(--text-muted); font-size: 14px; }

/* ==================== COMMENT INTEGRATION ==================== */
.comment-btn.comment-updated { background: rgba(40, 167, 69, 0.2) !important; border-color: #28a745 !important; color: #28a745 !important; }
.comment-btn.comment-added { background: rgba(0, 123, 255, 0.2) !important; border-color: #007bff !important; color: #007bff !important; }

@keyframes commentPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ==================== MOBILE RESPONSIVE ==================== */
/* ==================== MOBILE FEED CARDS ==================== */

/* Hero card — ภาพใหญ่ full-width */
.mfeed-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 14px;
    box-shadow: var(--card-shadow);
}
.mfeed-card:active { transform: scale(0.985); }

.mfeed-hero-img {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}
.mfeed-hero-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.mfeed-card:active .mfeed-hero-img img { transform: scale(1.02); }

.mfeed-hero-body {
    padding: 14px 16px 10px;
}
.mfeed-hero-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mfeed-hero-desc {
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.6;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Row card — ภาพซ้าย + ข้อความขวา */
.mfeed-row-inner {
    display: flex;
    gap: 0;
    align-items: stretch;
}
.mfeed-row-img {
    position: relative;
    width: 120px;
    min-width: 120px;
    height: 90px;
    overflow: hidden;
    flex-shrink: 0;
}
.mfeed-row-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mfeed-row-info {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}
.mfeed-row-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    color: white;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: fit-content;
    margin-bottom: 2px;
}
.mfeed-row-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-dark);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}
.mfeed-row-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-caption);
    margin-top: 4px;
}
.mfeed-row-meta i { opacity: 0.7; margin-right: 2px; }

@media (max-width: 768px) {
    .main-content { grid-template-columns: 1fr; gap: 0; }
    .content-wrapper { padding: 10px; }

    /* center คือ feed หลัก อยู่บนสุด */
    .center-main { order: 1; padding: 0; background: transparent; border: none; box-shadow: none; }
    .left-sidebar  { order: 2; }
    .right-sidebar { order: 3; }

    /* sidebar ที่ถูกซ่อนโดย JS */
    .left-sidebar[style*="display: none"],
    .right-sidebar[style*="display: none"] { display: none !important; }

    /* ซ่อน double-row desktop */
    .double-row { grid-template-columns: 1fr; }

    .main-img-wrapper { height: 180px; }
    .main-title { font-size: 18px; }
    .main-description { font-size: 13px; -webkit-line-clamp: 2; }

    .comment-popup { width: 95%; max-height: 90vh; }
    .footer-content { flex-direction: column; gap: 10px; }
    .action-btn { font-size: 11px; padding: 7px 8px; }

    .comment-reactions-container { padding: 6px; gap: 6px; }
    .comment-reactions-actions { gap: 2px; justify-content: center; }
    .reaction-btn { min-width: 28px; height: 28px; font-size: 14px; }

    .tier-badge-bar { padding: 5px 10px; gap: 8px; }
    .tier-corner-stamp { width: 30px; height: 30px; font-size: 12px; }
    .tier-score-bar { width: 48px; }
}

@media (max-width: 480px) {
    .mfeed-hero-img { height: 180px; }
    .mfeed-hero-title { font-size: 15px; }
    .mfeed-row-img { width: 100px; min-width: 100px; height: 80px; }
    .mfeed-row-title { font-size: 13px; -webkit-line-clamp: 2; }

    .main-img-wrapper { height: 160px; }
    .main-title { font-size: 16px; -webkit-line-clamp: 2; }
    .card-category-badge { font-size: 8px; padding: 2px 7px; }
    .tier-corner-stamp { width: 26px; height: 26px; font-size: 11px; }
    .tier-pill { font-size: 9px; padding: 2px 7px 2px 6px; }
    .tier-score-bar { display: none; }
    .reaction-btn { min-width: 26px; height: 26px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .main-card, .double-card, .left-card, .right-card { transition: none; }
    .main-card:hover, .double-card:hover, .left-card:hover, .right-card:hover { transform: none; }
    .tier-corner-stamp { animation: none; }
    .reaction-btn { transition: none; }
}

@media print {
    .comment-reactions-container, .action-bar, .tier-badge-bar { display: none !important; }
}
