/* ========================================
   一呼网 - 主样式文件
   ======================================== */

/* --- CSS Variables --- */
:root {
    --primary-color: #4361ee;
    --primary-light: #e8edff;
    --sidebar-width: 220px;
    --right-panel-width: 280px;
    --navbar-height: 64px;
    --card-radius: 12px;
    --transition-speed: 0.2s;
}

/* --- Base --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: #f5f7fa;
    padding-top: var(--navbar-height);
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    transition: color var(--transition-speed);
}
a:hover {
    color: #3a56d4;
}

/* --- Navbar --- */
.navbar {
    height: var(--navbar-height);
    z-index: 1030;
}
.navbar .logo-mark {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), #7209b7);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.navbar .input-group {
    border-radius: 20px;
    overflow: hidden;
}
.navbar .input-group .form-control {
    border: 1px solid #e0e0e0;
    box-shadow: none;
}
.navbar .input-group .input-group-text {
    border: 1px solid #e0e0e0;
    border-right: none;
}

/* --- Layout --- */
.main-wrapper {
    display: flex;
    flex: 1;
    padding-top: 16px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Footer */
.site-footer {
    background-color: #f5f7fa;
    flex-shrink: 0;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 0 12px;
    position: sticky;
    top: calc(var(--navbar-height) + 16px);
    height: fit-content;
    max-height: calc(100vh - var(--navbar-height) - 32px);
    overflow-y: auto;
}
.sidebar-section {
    margin-bottom: 20px;
}
.sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #adb5bd;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 0 12px;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-speed);
}
.sidebar-item:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}
.sidebar-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}
.sidebar-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Content Area */
.content-area {
    flex: 1;
    min-width: 0;
    padding: 0 20px;
}

/* Right Panel */
.right-panel {
    width: var(--right-panel-width);
    flex-shrink: 0;
    padding: 0 12px;
    position: sticky;
    top: calc(var(--navbar-height) + 16px);
    height: fit-content;
    max-height: calc(100vh - var(--navbar-height) - 32px);
    overflow-y: auto;
}

/* --- Cards --- */
.card {
    border: none;
    border-radius: var(--card-radius);
    transition: box-shadow var(--transition-speed);
}
.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

/* WenDui Card */
.wendui-card {
    border-radius: var(--card-radius);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.wendui-card:hover {
    transform: translateY(-2px);
}
.wendui-card .card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wendui-card .card-text {
    font-size: 13px;
    color: #6c757d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wendui-card .tag-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 500;
}

/* --- Hot Items (Ranking) --- */
.hot-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.hot-item:last-child {
    border-bottom: none;
}
.hot-rank {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #f0f0f0;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
}
.hot-rank.top3 {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
}
.hot-text {
    font-size: 13px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #333;
}
.hot-text:hover {
    color: var(--primary-color);
}

/* --- Ranking Badge --- */
.rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f0f0f0;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.rank-badge.top3 {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #fff;
}

/* --- Category --- */
.category-card {
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.category-card:hover {
    transform: translateY(-3px);
}
.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 20px;
}
.category-icon-lg {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* --- Topic --- */
.topic-card {
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.topic-card:hover {
    transform: translateY(-2px);
}
.topic-hash {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}
.topic-hash-lg {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

/* --- Notifications --- */
.notif-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

/* --- WenDui Detail --- */
.wendui-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}
.wendui-content p {
    margin-bottom: 1em;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #6c757d;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-speed);
}
.action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--primary-light);
}
.action-btn.active {
    border-color: var(--primary-color);
    color: #fff;
    background-color: var(--primary-color);
}

/* --- Answer Section --- */
.answer-item {
    border-left: 3px solid #e0e0e0;
    padding-left: 16px;
    margin-bottom: 16px;
}
.answer-item:hover {
    border-left-color: var(--primary-color);
}

/* --- Comment Section --- */
.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.comment-item:last-child {
    border-bottom: none;
}

/* --- Auth Pages --- */
.auth-container {
    max-width: 420px;
    margin: 60px auto;
}
.auth-card {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}
.auth-card .card-body {
    padding: 40px;
}
.auth-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), #7209b7);
    color: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    margin: 0 auto 16px;
}

/* --- Data Panel --- */
.data-panel {
    display: flex;
    gap: 24px;
    padding: 16px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.data-item {
    text-align: center;
}
.data-item .data-value {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}
.data-item .data-label {
    font-size: 12px;
    color: #adb5bd;
}

/* --- Pagination --- */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 3px;
    border: none;
    color: #495057;
}
.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    color: #fff;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .right-panel {
        display: none;
    }
}
@media (max-width: 992px) {
    .sidebar {
        display: none;
    }
    .content-area {
        padding: 0 12px;
    }
    .site-footer {
        margin-left: 0 !important;
    }
}
@media (max-width: 768px) {
    .main-wrapper {
        padding-top: 8px;
    }
    .content-area {
        padding: 0 8px;
    }
}

/* --- Utilities --- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.gap-row {
    margin-bottom: 12px;
}

/* --- Loading Spinner --- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #adb5bd;
}
.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
}
