/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* ========== 容器 ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== 头部 ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ========== 按钮 ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-primary:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-admin {
    background-color: #27ae60;
    color: white;
}

.btn-admin:hover {
    background-color: #229954;
}

/* ========== 板块切换 ========== */
.board-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.board-btn {
    padding: 10px 18px;
    border: 2px solid #e0e0e0;
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 40px;
}

.board-btn:hover {
    border-color: #2c3e50;
    color: #2c3e50;
}

.board-btn.active {
    background-color: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.person-section {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.person-section.hidden {
    display: none;
}

.person-label {
    font-size: 14px;
    color: #666;
}

.person-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.person-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background-color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-height: 40px;
}

.person-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.person-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* ========== 模块 ========== */
.module.hidden {
    display: none;
}

.direct-panel {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.direct-title {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.direct-list {
    margin-top: 10px;
}

/* ========== 搜索和过滤 ========== */
.search-section {
    margin-bottom: 30px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

.filter-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background-color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-height: 40px;
}

.tag-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.tag-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* ========== 卡片 ========== */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.card.selected {
    outline: 3px solid #e74c3c;
}

.card-select-indicator {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 8px;
    font-weight: 600;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.card-details {
    display: none;
}

.modal-answer {
    max-width: 700px;
}

.answer-modal-body {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    font-size: 14px;
    color: #333;
}

.answer-modal-meta {
    margin-top: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2c3e50;
    line-height: 1.4;
}

.card-answer {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    flex-grow: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

.card-meta {
    font-size: 12px;
    color: #888;
    line-height: 1.6;
    margin-top: 10px;
}

.card-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
    width: fit-content;
}

.status-answered {
    background-color: #d4edda;
    color: #155724;
}

.status-unanswered {
    background-color: #fff3cd;
    color: #856404;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.card-actions button {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
}

/* ========== 模态框 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-small {
    max-width: 300px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    justify-content: flex-end;
}

.modal-footer button {
    flex: 1;
    max-width: 150px;
}

/* ========== 表单元素 ========== */
.input-field,
.textarea-field,
.password-input,
.file-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.input-field:focus,
.textarea-field:focus,
.password-input:focus {
    outline: none;
    border-color: #3498db;
}

.textarea-field {
    resize: vertical;
    min-height: 100px;
}

/* ========== 标签页 ========== */
.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #999;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== 消息 ========== */
.error-message,
.success-message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error-message.hidden,
.success-message.hidden {
    display: none;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ========== 加载和空状态 ========== */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

.empty-state.hidden {
    display: none;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 16px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

.toast.success {
    background-color: #27ae60;
}

.toast.error {
    background-color: #e74c3c;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .header h1 {
        font-size: 24px;
    }

    .cards-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer button {
        max-width: none;
    }

    .filter-tags {
        justify-content: flex-start;
    }

    .toast {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 20px;
    }

    .search-input {
        font-size: 16px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .card {
        padding: 15px;
    }

    .card-title {
        font-size: 15px;
    }

    .card-answer {
        font-size: 13px;
    }

    .modal-header h2 {
        font-size: 16px;
    }

    .input-field,
    .textarea-field,
    .password-input {
        font-size: 16px;
    }
}
