/* 全局重置 & 字体 */
* {
    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, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 800px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    margin-top: 20px;
}

/* 头部 */
header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.subtitle {
    color: #888;
    font-size: 14px;
    margin-bottom: 28px;
}

/* 表单区域 */
.form-section {
    background: #f8f9fc;
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 32px;
}

.form-section h2 {
    font-size: 18px;
    color: #1a1a2e;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.35);
}

button[type="submit"]:active {
    transform: translateY(0);
}

button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-message {
    margin-top: 12px;
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    display: none;
}

.form-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 留言列表 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.list-header h2 {
    font-size: 18px;
    color: #1a1a2e;
}

#totalCount {
    font-size: 14px;
    color: #888;
    background: #f0f0f0;
    padding: 2px 14px;
    border-radius: 20px;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 单条留言卡片 */
.message-card {
    background: white;
    padding: 18px 22px;
    border-radius: 14px;
    border: 1px solid #eaeef5;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.message-card:hover {
    border-color: #d0d9e8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.message-card .body {
    flex: 1;
    min-width: 0;
}

.message-card .meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.message-card .user {
    font-weight: 600;
    color: #2d3748;
    font-size: 15px;
}

.message-card .index-badge {
    font-size: 12px;
    color: #aaa;
    background: #f5f5f5;
    padding: 0 12px;
    border-radius: 12px;
    font-weight: 500;
}

.message-card .content {
    font-size: 15px;
    color: #4a5568;
    line-height: 1.6;
    word-break: break-word;
}

.message-card .delete-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.message-card .delete-btn:hover {
    color: #e53e3e;
    background: #fff5f5;
}

.loading,
.empty {
    text-align: center;
    color: #aaa;
    padding: 40px 0;
    font-size: 15px;
}

.empty {
    color: #ccc;
}

/* 响应式 */
@media (max-width: 600px) {
    .container {
        padding: 24px 16px;
    }

    .form-section {
        padding: 18px 16px;
    }

    header h1 {
        font-size: 26px;
    }

    .message-card {
        flex-wrap: wrap;
    }

    .message-card .delete-btn {
        align-self: flex-start;
        margin-top: 4px;
    }
}