/**
 * 留言板项目 - 样式表
 * 浅色系设计风格，清新简约
 */

/* ========== CSS 变量 - 浅色系配色 ========== */
:root {
    --primary-color: #7eb8da;
    --primary-hover: #6aacce;
    --primary-light: #eaf4fb;
    --primary-gradient: linear-gradient(135deg, #a8d8ea, #7eb8da);
    --success-color: #81c784;
    --success-bg: #f1f8f1;
    --success-border: #c8e6c9;
    --success-text: #2e7d32;
    --error-color: #ef9a9a;
    --error-bg: #fef0f0;
    --error-border: #ffcdd2;
    --error-text: #c62828;
    --warning-color: #ffcc80;
    --text-color: #4a5568;
    --text-light: #718096;
    --text-muted: #a0aec0;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e8ecf1;
    --shadow-sm: 0 1px 4px rgba(160, 174, 192, 0.15);
    --shadow-md: 0 4px 16px rgba(160, 174, 192, 0.2);
    --shadow-lg: 0 8px 30px rgba(160, 174, 192, 0.25);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ========== 基础重置 ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== 布局容器 ========== */
.container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== 头部 ========== */
.site-header {
    background: var(--primary-gradient);
    color: white;
    padding: 52px 0 44px;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.6;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    letter-spacing: 1px;
}

.site-title a {
    color: white;
    text-decoration: none;
}

.site-title a:hover {
    opacity: 0.95;
    transform: none;
}

.site-description {
    font-size: 1.05rem;
    opacity: 0.95;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

/* ========== 全屏加载蒙版 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.loading-overlay.visible {
    opacity: 1;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 18px;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.05rem;
    color: var(--text-color);
    font-weight: 500;
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    padding: 40px 0 52px;
}

/* ========== 留言表单区域 ========== */
.message-form-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 28px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--primary-light);
    display: inline-block;
}

/* ========== 表单样式 ========== */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 10px;
}

.required {
    color: var(--error-color);
    margin-left: 2px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-family: var(--font-family);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-color);
    transition: var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    transition: color 0.2s ease;
}

/* ========== 验证码 ========== */
.captcha-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.captcha-input {
    width: 150px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 6px;
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
}

.captcha-image {
    height: 48px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1.5px solid var(--border-color);
    transition: var(--transition);
    object-fit: cover;
}

.captcha-image:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.btn-refresh {
    width: 48px;
    height: 48px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-refresh:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 36px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    user-select: none;
    -webkit-user-select: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(126, 184, 218, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(126, 184, 218, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(126, 184, 218, 0.35);
}

.btn-primary:disabled {
    background: #d0d8e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-submit {
    text-align: center;
    margin-top: 32px;
}

.btn-loading {
    display: none;
}

/* ========== 表单消息 ========== */
.form-message {
    margin-top: 24px;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    text-align: center;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-message.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.form-message.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

/* ========== 页脚 ========== */
.site-footer {
    background: var(--card-bg);
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========== 响应式设计 ========== */

/* 平板设备 */
@media (max-width: 768px) {
    .site-header {
        padding: 44px 0 36px;
    }

    .site-title {
        font-size: 1.75rem;
    }

    .site-description {
        font-size: 1rem;
    }

    .main-content {
        padding: 32px 0 44px;
    }

    .message-form-section {
        padding: 28px;
    }

    .section-title {
        font-size: 1.25rem;
        margin-bottom: 24px;
    }

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

    .btn {
        padding: 12px 28px;
    }
}

/* 手机设备 */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 16px;
    }

    .site-header {
        padding: 36px 0 30px;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .site-description {
        font-size: 0.95rem;
    }

    .main-content {
        padding: 24px 0 36px;
    }

    .message-form-section {
        padding: 22px;
        border-radius: var(--radius-md);
    }

    .section-title {
        font-size: 1.15rem;
        margin-bottom: 20px;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .form-input,
    .form-textarea {
        padding: 12px 14px;
        font-size: 1rem;
    }

    .form-textarea {
        min-height: 120px;
    }

    /* 验证码在小屏幕上垂直排列 */
    .captcha-group {
        flex-wrap: wrap;
    }

    .captcha-input {
        width: 100%;
        letter-spacing: 8px;
        font-size: 1.2rem;
    }

    .captcha-image {
        height: 44px;
        flex: 1;
    }

    .btn-refresh {
        width: 44px;
        height: 44px;
    }

    .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 1rem;
    }

    .form-submit {
        margin-top: 28px;
    }

    .form-message {
        padding: 14px 16px;
        font-size: 0.9rem;
    }

    .site-footer {
        padding: 20px 0;
    }

    .copyright {
        font-size: 0.8rem;
    }
}

/* 超小屏幕 */
@media (max-width: 360px) {
    .site-header {
        padding: 30px 0 26px;
    }

    .site-title {
        font-size: 1.35rem;
    }

    .message-form-section {
        padding: 18px;
    }

    .captcha-group {
        gap: 10px;
    }
}

/* ========== 触摸设备优化 ========== */
@media (hover: none) and (pointer: coarse) {
    .btn-primary:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(126, 184, 218, 0.35);
    }

    .captcha-image:hover {
        transform: none;
    }

    .btn-refresh:hover {
        background: var(--card-bg);
        color: var(--text-light);
        border-color: var(--border-color);
    }
}
