/* 赛博诗会样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    color: #00a8ff;
    font-size: 28px;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #e0e0e0;
}

/* 发表区域 */
.publish-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.publish-section h2 {
    color: #333;
    margin-bottom: 20px;
}

.poem-form .form-group {
    margin-bottom: 20px;
}

.poem-form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.poem-form input[type="text"],
.poem-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

.poem-form input:focus,
.poem-form textarea:focus {
    outline: none;
    border-color: #00a8ff;
}

.ai-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.btn-ai:hover {
    opacity: 0.9;
}

.btn-ai-small {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-ai-small:hover {
    background: #5a67d8;
}

.btn-ai-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.ai-model-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.ai-model-select:hover {
    border-color: #00a8ff;
}

.ai-model-select:focus {
    outline: none;
    border-color: #00a8ff;
}

.ai-input-group input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 1;
}

.hint {
    color: #666;
    font-size: 13px;
}

.form-actions {
    margin-top: 20px;
}

.btn-submit {
    background: #00a8ff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-submit:hover {
    background: #0096e0;
}

/* 诗作列表 */
.poems-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.poems-section h2 {
    color: #333;
    margin-bottom: 20px;
}

.poem-card {
    padding: 20px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    position: relative;
    min-height: 200px;
}

.poem-card:hover {
    background: #fafafa;
}

.poem-card:last-child {
    border-bottom: none;
}

.poem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.poem-header h3 {
    color: #333;
    font-size: 20px;
}

.ai-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* 诗作内容 - */
.poem-content {
    color: #555;
    margin-bottom: 15px;
    white-space: pre-wrap;   /* 恢复，保留用户输入的空格 */
    font-family: 'Georgia', serif;
    font-size: 16px;
    line-height: 1.8;
    text-indent: 0 !important;
    padding-left: 0 !important;
}

.poem-content p {
    margin: 0;
    padding: 0;
    text-indent: 0 !important;
}

/* ===== 诗作首行缩进彻底修复 ===== */
.poems-section .poem-content,
.poem-card .poem-content,
.poem-content {
    text-indent: 0 !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* 如果内容被包裹在<p>标签内（虽然你没有用p，但防止某些情况） */
.poems-section .poem-content p,
.poem-card .poem-content p,
.poem-content p {
    text-indent: 0 !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* 针对第一行（包括由nl2br产生的） */
.poem-content:first-line,
.poem-content > *:first-child {
    text-indent: 0 !important;
    padding-left: 0 !important;
}

/* 作者信息 - 蓝色 */
.author-info {
    color: #00a8ff;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

/* 时间戳样式 */
.poem-time {
    color: #999;
    font-size: 12px;
    font-weight: normal;
    margin-left: 5px;
}

/* 操作栏：评论数和删除按钮 - 放在作者下方，左对齐 */
.poem-actions {
    display: flex;
    align-items: center;
    gap: 2em;
    margin-bottom: 0;
}

/* 评论数链接 */
.comment-count-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.comment-count-link:hover {
    color: #00a8ff;
    text-decoration: underline;
}

/* 删除按钮 - 无框，垃圾桶图标 */
.delete-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.3s ease;
}

.delete-btn:hover {
    color: #ff5252;
}

/* 底部投票区 - 绝对定位在右下角 */
.poem-bottom-actions {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

/* 投票按钮 - 无框 */
.vote-buttons {
    display: flex;
    gap: 15px;
}

.vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    padding: 0;
}

.vote-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.vote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vote-btn.liked {
    color: #00a8ff;
    font-weight: 500;
}

.vote-btn.disliked {
    color: #ff6b6b;
    font-weight: 500;
}

.vote-count {
    font-weight: bold;
    margin-left: 2px;
}

/* 评论区 */
.comment-section {
    margin-top: 50px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    animation: slideDown 0.3s ease;
    clear: both;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.comment-form textarea {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    font-size: 14px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #00a8ff;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
}

.comment-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    transition: background 0.2s;
}

.comment-item:hover {
    background: white;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-author {
    font-weight: bold;
    color: #00a8ff;
    margin-right: 10px;
}

.comment-date {
    color: #999;
    font-size: 12px;
}

.comment-content {
    margin-top: 5px;
    line-height: 1.5;
    color: #555;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 消息提示 */
.error, .success, .info-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.success {
    background: #dfd;
    color: #090;
    border: 1px solid #beb;
}

.info-message {
    background: #e2f0ff;
    color: #0066cc;
    border: 1px solid #b8daff;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
}

.info-message a {
    color: #0066cc;
    font-weight: bold;
    text-decoration: underline;
}

.info-message a:hover {
    color: #004999;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.page-header h1 {
    margin: 0;
    color: #333;
    font-size: 28px;
}

.back-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.back-arrow:hover {
    transform: translateX(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background: #f8f9fa;
}

.back-arrow .arrow-icon {
    font-size: 20px;
    color: #666;
    transition: all 0.3s ease;
}

.back-arrow:hover .arrow-icon {
    color: #00a8ff;
}

#aiLoading {
    color: #666;
    font-size: 13px;
    padding: 5px 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .publish-section,
    .poems-section {
        padding: 20px;
    }
    
    .ai-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .poem-actions {
        flex-wrap: wrap;
    }
    
    .vote-buttons {
        gap: 10px;
    }
    
    .comment-form {
        flex-direction: column;
    }
    
    .page-header {
        flex-wrap: wrap;
    }
    
    .poem-bottom-actions {
        position: static;
        display: flex;
        justify-content: flex-end;
        margin-top: 15px;
        margin-bottom: 10px;
    }
    
    .comment-section {
        margin-top: 15px;
    }
}