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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* 头部样式 */
.header {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

/* 必填标记 */
.required {
    color: #e74c3c;
}

/* 表单容器 */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* 文件上传样式 */
.file-input {
    padding: 10px;
    border: 2px dashed #e1e5e9;
    cursor: pointer;
}

.file-input:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

/* 图片预览 */
.image-preview {
    margin-top: 15px;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
}

.image-preview img {
    display: block;
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.preview-hint {
    margin-top: 8px;
    font-size: 14px;
    color: #999;
}

.error-text {
    color: #e74c3c;
    font-size: 14px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    text-align: center;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

/* 提示消息 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

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

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

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 20px;
}

.admin-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 14px;
}

.admin-link:hover {
    text-decoration: underline;
}

/* 登录页面 */
.login-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 450px;
    margin: 50px auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.login-hint {
    margin-top: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.login-hint p {
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
}

.login-hint ul {
    list-style: none;
    padding: 0;
}

.login-hint li {
    padding: 5px 0;
    color: #888;
}

.login-hint strong {
    color: #667eea;
}

.footer-links {
    text-align: center;
    margin-top: 20px;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* 管理后台样式 */
.admin-header {
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.admin-header h1 {
    color: #333;
    font-size: 1.8em;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-actions span {
    color: #666;
}

/* 标签样式 */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-main {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-role {
    background: #e8f5e9;
    color: #2e7d32;
}

/* 按钮颜色扩展 */
.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.text-muted {
    color: #999;
    font-size: 14px;
}

/* 添加用户表单 */
.add-user-form .form-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

@media (max-width: 768px) {
    .add-user-form .form-row-4 {
        grid-template-columns: 1fr;
    }
}

/* 用户表格 */
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.user-table th,
.user-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.user-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.user-table tr:hover {
    background: #f8f9fa;
}

.user-table .row-main {
    background: #f0f4ff;
}

.user-table code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #667eea;
}

/* 设置提示 */
.setting-hint {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.setting-hint a {
    color: #667eea;
}

/* 表单操作按钮组 */
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.section h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

/* 设置分组 */
.setting-group {
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.setting-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-group h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

/* 内联表单 */
.inline-form .form-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: end;
}

/* 密码表单 */
.password-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

@media (max-width: 768px) {
    .inline-form .form-row,
    .password-form .form-row {
        grid-template-columns: 1fr;
    }
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.filter-bar > span {
    font-weight: 600;
    color: #666;
}

.filter-btn {
    display: inline-block;
    padding: 6px 14px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* 问题数量 */
.question-count {
    color: #999;
    font-size: 14px;
    margin-bottom: 15px;
}

/* 问题列表 */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.question-item {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.question-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.question-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-number {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1em;
}

.question-recipient {
    display: inline-block;
    padding: 2px 8px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.question-time {
    color: #999;
    font-size: 0.9em;
}

.question-content {
    color: #333;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 问题图片样式 */
.question-image {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.image-label {
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
}

/* 缩略图容器 - 防止图片超出 */
.question-image .image-link {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
}

.thumbnail {
    display: block;
    max-width: 200px;
    max-height: 150px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    object-fit: contain;
}

.thumbnail:hover {
    transform: scale(1.02);
}

/* 图片查看模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: auto;
}

.modal-content {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 4px;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ccc;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 响应式 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .form-container,
    .section,
    .login-container {
        padding: 20px;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .filter-bar {
        padding: 10px;
    }
    
    .thumbnail {
        max-width: 100%;
        max-height: 120px;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
    
    .image-preview img {
        max-height: 200px;
    }
}
