/* ============================================================
   CommunityHub CSS - chuing.net
   Rich modern design + Tailwind supplements
   ============================================================ */

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* --- Tabs (pill style) --- */
.ch-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.ch-tab:hover {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.05);
}

.ch-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.ch-tab svg {
    flex-shrink: 0;
}

/* --- Card --- */
.ch-card {
    transition: all 0.2s ease;
    position: relative;
}

.ch-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    border-color: #c7d2fe;
    transform: translateY(-1px);
}

.ch-card-pinned {
    border-left: 4px solid #f59e0b !important;
    background: linear-gradient(135deg, #fffbeb, #fff) !important;
}

/* --- Vote buttons --- */
.ch-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 700;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    color: #9ca3af;
}

.ch-vote-btn:hover {
    transform: scale(1.05);
}

.ch-vote-btn.active-up {
    border-color: #4f46e5;
    color: #4f46e5;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.ch-vote-btn.active-down {
    border-color: #ef4444;
    color: #ef4444;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.ch-vote-btn svg {
    width: 18px;
    height: 18px;
}

/* --- Badge styles --- */
.ch-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    line-height: 1.5;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.ch-badge-cat1 {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
}

.ch-badge-cat2 {
    background: #f3f4f6;
    color: #6b7280;
}

.ch-badge-status {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.ch-badge-fb-uiux     { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4338ca; }
.ch-badge-fb-feature   { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
.ch-badge-fb-bug       { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #991b1b; }
.ch-badge-fb-etc       { background: #f3f4f6; color: #6b7280; }

/* Feedback status badges */
.ch-badge-fb-status-default   { background: #f3f4f6; color: #6b7280; }
.ch-badge-fb-status-submitted { background: #e0e7ff; color: #4338ca; }
.ch-badge-fb-status-planned   { background: #fef3c7; color: #92400e; }
.ch-badge-fb-status-progress  { background: #d1fae5; color: #065f46; }
.ch-badge-fb-status-done      { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* --- Detail content typography --- */
.ch-detail-content {
    font-size: 15px;
    line-height: 1.85;
    color: #374151;
    word-break: break-word;
}

/* Headings - must override Tailwind preflight reset */
.ch-detail-content h1 {
    font-size: 26px !important;
    font-weight: 800 !important;
    color: #111827 !important;
    margin: 28px 0 14px !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #e5e7eb !important;
    line-height: 1.3 !important;
}

.ch-detail-content h2 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
    margin: 24px 0 12px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #e5e7eb !important;
    line-height: 1.35 !important;
}

.ch-detail-content h3 {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
    margin: 20px 0 10px !important;
    line-height: 1.4 !important;
}

.ch-detail-content h4 {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    margin: 16px 0 8px !important;
    line-height: 1.4 !important;
}

.ch-detail-content h5 {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    margin: 14px 0 6px !important;
}

.ch-detail-content h6 {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #6b7280 !important;
    margin: 14px 0 6px !important;
}

/* Paragraph */
.ch-detail-content p {
    margin: 0 0 12px !important;
}

/* Lists */
.ch-detail-content ul {
    list-style-type: disc !important;
    margin: 8px 0 16px !important;
    padding-left: 24px !important;
}

.ch-detail-content ol {
    list-style-type: decimal !important;
    margin: 8px 0 16px !important;
    padding-left: 24px !important;
}

.ch-detail-content li {
    margin-bottom: 6px !important;
    line-height: 1.7 !important;
}

.ch-detail-content li::marker {
    color: #6b7280;
}

/* Links */
.ch-detail-content a {
    color: #4f46e5 !important;
    text-decoration: underline !important;
}

.ch-detail-content a:hover {
    color: #4338ca !important;
}

/* Horizontal rule */
.ch-detail-content hr {
    border: none !important;
    border-top: 1px solid #e5e7eb !important;
    margin: 24px 0 !important;
}

/* Bold / Strong */
.ch-detail-content strong,
.ch-detail-content b {
    font-weight: 700 !important;
    color: #111827;
}

/* Code */
.ch-detail-content code {
    display: inline;
    background: #f3f4f6;
    color: #c0392b;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', Courier, monospace;
}

.ch-detail-content pre {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 18px;
    overflow-x: auto;
    margin: 12px 0;
    line-height: 1.5;
}

.ch-detail-content pre code {
    background: none;
    color: #333;
    padding: 0;
}

/* Images */
.ch-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Tables */
.ch-detail-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
}

.ch-detail-content table th,
.ch-detail-content table td {
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    text-align: left;
}

.ch-detail-content table th {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    font-weight: 700;
    color: #374151;
}

/* Blockquote */
.ch-detail-content blockquote {
    border-left: 4px solid #4f46e5;
    margin: 16px 0;
    padding: 12px 18px;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    color: #4b5563;
    border-radius: 0 8px 8px 0;
}

/* Responsive */
@media (max-width: 640px) {
    .ch-detail-content h1 { font-size: 22px !important; }
    .ch-detail-content h2 { font-size: 19px !important; }
    .ch-detail-content h3 { font-size: 16px !important; }
}

/* --- Comment --- */
.ch-comment-item {
    transition: background 0.15s ease;
    border-radius: 8px;
    padding: 12px !important;
    margin: 0 -4px;
}

.ch-comment-item:hover {
    background: #f8fafc;
}

/* --- Skeleton animation --- */
@keyframes ch-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ch-skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 400% 100%;
    animation: ch-shimmer 1.5s ease infinite;
    border-radius: 6px;
}

/* --- Fade-in --- */
.ch-fade-in {
    animation: ch-fadeIn 0.3s ease;
}

@keyframes ch-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Filter pills --- */
.ch-filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ch-filter-btn:hover {
    color: #4f46e5;
    border-color: #a5b4fc;
    background: #eef2ff;
}

.ch-filter-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

/* --- Sort toggle --- */
.ch-sort-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ch-sort-btn.active {
    color: #4f46e5;
    border-color: #a5b4fc;
    background: #eef2ff;
}

/* --- Publish button --- */
.ch-publish-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.ch-publish-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.ch-publish-btn:disabled {
    background: #d1d5db;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.ch-publish-btn-admin {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.ch-publish-btn-admin:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.ch-publish-btn-admin:disabled {
    background: #d1d5db;
}

/* --- Pagination --- */
.ch-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 8px;
}

.ch-page-btn:hover {
    color: #4f46e5;
    border-color: #a5b4fc;
    background: #eef2ff;
}

.ch-page-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
    pointer-events: none;
}

.ch-page-btn.disabled {
    color: #d1d5db;
    pointer-events: none;
}

/* --- Write button glow --- */
.ch-write-btn {
    position: relative;
    overflow: hidden;
}

.ch-write-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ch-write-btn:hover::after {
    opacity: 1;
}

/* --- Vote score indicator --- */
.ch-vote-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 20px;
    line-height: 1.6;
}

.ch-vote-score-positive {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
}

.ch-vote-score-negative {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
}

.ch-vote-score-neutral {
    background: #f3f4f6;
    color: #9ca3af;
}

/* --- Sub-Nav Bar --- */
.ch-subnav {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    padding: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ch-subnav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 36px;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ch-subnav-inner::-webkit-scrollbar {
    display: none;
}

.ch-subnav a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    white-space: nowrap;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.ch-subnav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.ch-subnav a.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
    font-weight: 700;
}

.ch-subnav a svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.ch-subnav-sep {
    width: 1px;
    height: 16px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
    flex-shrink: 0;
}

.ch-subnav-dark {
    cursor: pointer;
}

/* --- List vote (Reddit-style) --- */
.ch-list-vote-btn {
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
    padding: 2px;
}

.ch-list-vote-btn:active {
    transform: scale(1.2);
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .ch-tab {
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
    }

    .ch-tab svg {
        width: 14px;
        height: 14px;
    }

    .ch-detail-content {
        font-size: 14px;
    }

    .ch-subnav-inner {
        padding: 0 12px;
        gap: 2px;
    }

    .ch-subnav a {
        padding: 4px 10px;
        font-size: 11px;
        gap: 4px;
    }
}
