/* =============================================
   吐槽吧 - 全局样式
   ============================================= */

:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --primary-light: #ff6b6b;
    --secondary: #2c3e50;
    --accent: #3498db;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e8ecf1;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
    --max-width: 680px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(231,76,60,0.3);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo:hover { text-decoration: none; }

.logo-icon {
    font-size: 26px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-select {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.lang-select option { color: #333; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-ghost { background: rgba(255,255,255,0.2); color: white; }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Main Content */
.app-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    align-items: center;
}

.category-tab {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: white;
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.category-tab:hover { border-color: var(--primary); color: var(--primary); }
.category-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Complaint Card */
.complaint-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s;
}

.complaint-card:hover { transform: translateY(-2px); }

.complaint-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.complaint-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.complaint-meta {
    flex: 1;
}

.complaint-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.complaint-time {
    font-size: 12px;
    color: var(--text-light);
}

.complaint-category {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: #fef0f0;
    color: var(--primary);
}

.complaint-category.cat-work { background: #e8f4fd; color: var(--accent); }
.complaint-category.cat-life { background: #e8faf5; color: var(--success); }
.complaint-category.cat-study { background: #fef9e7; color: var(--warning); }
.complaint-category.cat-other { background: #f0f0f0; color: var(--text-light); }

.complaint-content {
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 10px;
    word-break: break-word;
}

.complaint-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.complaint-footer span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.complaint-footer .action-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.complaint-footer .action-btn:hover {
    background: #f0f0f0;
    color: var(--primary);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 4px;
}

.modal-body { padding: 20px; }

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus { border-color: var(--primary); }

textarea.form-input {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.code-input-group {
    display: flex;
    gap: 8px;
}

.code-input-group .form-input { flex: 1; }

.code-btn {
    white-space: nowrap;
    min-width: 110px;
}

.form-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 12px;
}

.form-footer a { font-weight: 500; }

.category-select {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-select label {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.category-select input { display: none; }
.category-select input:checked + span { color: var(--primary); font-weight: 500; }

.category-select label:has(input:checked) {
    border-color: var(--primary);
    background: #fef0f0;
}

/* Detail View */
.detail-view {
    display: none;
}

.detail-view.active {
    display: block;
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 16px;
    background: none;
    border: none;
    padding: 4px 0;
}

.detail-back:hover { color: var(--primary); }

.detail-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.detail-content {
    font-size: 16px;
    line-height: 1.8;
    margin: 16px 0;
    word-break: break-word;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* Comments */
.comments-section {
    margin-top: 20px;
}

.comments-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child { border-bottom: none; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.comment-author {
    font-size: 13px;
    font-weight: 500;
}

.comment-time {
    font-size: 12px;
    color: var(--text-light);
}

.comment-content {
    font-size: 14px;
    line-height: 1.6;
    padding-left: 36px;
}

/* Comment Form */
.comment-form {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.comment-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.anonymous-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
}

.anonymous-toggle input { cursor: pointer; }

/* Share Menu */
.share-menu {
    display: flex;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.share-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Ad Slot */
.ad-slot {
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-slot-label {
    display: block;
    font-size: 10px;
    color: #bbb;
    margin-bottom: 4px;
}

/* User Info Bar */
.user-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.free-count-badge {
    background: #fef0f0;
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

/* Publish FAB */
.publish-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(231,76,60,0.4);
    z-index: 50;
    border: none;
    transition: transform 0.2s;
}

.publish-fab:hover { transform: scale(1.1); }

/* Toast */
.toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--secondary);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

.loading-spinner::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* =============================================
   响应式断点 - Responsive Breakpoints
   Desktop  : > 1024px
   Tablet   : 600px ~ 1024px
   Mobile   : < 600px
   ============================================= */

/* --- 桌面端：宽屏双列增强 --- */
@media (min-width: 1024px) {
    :root { --max-width: 760px; }

    .app-main { padding: 24px 16px; }

    .complaint-card {
        padding: 20px;
    }

    .detail-card {
        padding: 28px;
    }

    .modal {
        max-width: 520px;
    }

    .publish-fab {
        bottom: 40px;
        right: 40px;
        width: 60px;
        height: 60px;
        font-size: 30px;
}

/* --- 平板端：680px ~ 1024px --- */
@media (min-width: 680px) and (max-width: 1023px) {
    :root { --max-width: 640px; }

    .app-main { padding: 20px 16px; }

    .header-inner { height: 60px; }

    .logo { font-size: 20px; }

    .complaint-card { padding: 18px; }

    .modal { max-width: 500px; }
}

/* --- 手机端：< 600px --- */
@media (max-width: 599px) {
    :root { --max-width: 100%; }

    .app-main { padding: 10px; }

    /* Header：logo宣传语在小屏隐藏，避免挤压 */
    .logo-tagline { display: none; }

    .logo { font-size: 18px; gap: 6px; }
    .logo-icon svg { width: 22px; height: 22px; }

    /* 语言选择器缩小 */
    .lang-select { font-size: 12px; padding: 3px 6px; max-width: 90px; }

    /* 卡片 */
    .complaint-card { padding: 12px 12px 10px; border-radius: 10px; margin-bottom: 10px; }
    .complaint-content { font-size: 14px; }
    .complaint-footer { gap: 10px; font-size: 12px; }

    /* 用户栏 */
    .user-bar { padding: 10px 12px; border-radius: 10px; }
    .free-count-badge { font-size: 11px; }

    /* 分类标签 */
    .category-tab { padding: 5px 12px; font-size: 12px; }

    /* 详情页 */
    .detail-card { padding: 14px; }
    .detail-content { font-size: 15px; }
    .detail-actions { flex-wrap: wrap; gap: 8px; }

    /* 分享按钮 */
    .share-menu { gap: 6px; }
    .share-btn { padding: 6px 10px; font-size: 12px; }

    /* 弹窗：底部全屏抽屉样式 */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
    }

    /* 表单 */
    .code-btn { min-width: 90px; font-size: 12px; }
    .btn { padding: 9px 14px; font-size: 14px; }

    /* 评论 */
    .comment-content { padding-left: 0; margin-top: 6px; }

    /* 浮动按钮 */
    .publish-fab {
        bottom: 72px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 26px;
    }
    /* 评论表单操作栏竖排 */
    .comment-form-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .comment-form-actions .btn { width: 100%; justify-content: center; }
}

/* --- 极小屏：< 360px（折叠屏/旧机型）--- */
@media (max-width: 359px) {
    .logo { font-size: 16px; }
    .header-actions { gap: 6px; }
    .btn-ghost { padding: 6px 10px; font-size: 12px; }
    .complaint-card { padding: 10px; }
    .publish-fab { right: 10px; bottom: 68px; }
}

/* Nickname edit */
.nickname-edit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nickname-edit input {
    border: none;
    border-bottom: 1.5px solid var(--primary);
    outline: none;
    font-size: 14px;
    padding: 2px 4px;
    width: 120px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }
