/* 现代化留言板样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.container > p {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
}

.message-form {
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fafbfc;
    outline: none;
}

input[type="text"]:focus,
textarea:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 15px 35px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:disabled::before {
    display: none;
}

hr {
    border: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    margin: 40px 0;
    border-radius: 1px;
    opacity: 0.3;
}

#loading {
    text-align: center;
    color: #667eea;
    padding: 30px;
    font-size: 1.1rem;
}

.message-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-left: 5px solid #667eea;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.message-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.message-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.message-card:hover::before {
    transform: scaleX(1);
}

.message-card .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.message-card .username {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
    padding: 5px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.message-card .timestamp {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 500;
    padding: 4px 10px;
    background: rgba(127, 140, 141, 0.1);
    border-radius: 15px;
}

.message-card .content {
    word-wrap: break-word;
    color: #2c3e50;
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
}

/* 点赞功能样式 */
.like-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    margin-top: 15px;
}

.like-button {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 50px;
    justify-content: center;
}

.like-button:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.like-button.liked {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border-color: #ff6b6b;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.like-button.liked:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 82, 82, 0.4);
}

.like-button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.like-count {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 25px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .message-form {
        padding: 20px;
    }
    
    .message-card {
        padding: 20px;
    }
    
    .message-card .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    button {
        padding: 12px 25px;
        font-size: 14px;
    }

    .like-section {
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    input[type="text"],
    textarea {
        padding: 12px 15px;
    }
    
    .message-form {
        padding: 15px;
    }
    
    .message-card {
        padding: 15px;
    }

    .like-button {
        padding: 6px 10px;
        font-size: 14px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
}

/* 空状态样式 */
#messages-container:empty::after {
    content: '暂无留言，快来抢沙发吧！🎉';
    display: block;
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    padding: 40px 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 15px;
    border: 2px dashed rgba(102, 126, 234, 0.2);
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

#loading {
    animation: pulse 1.5s ease-in-out infinite;
}