/* 留言板样式 - 与主站风格保持一致 */

/* 留言板区域 */
.guestbook-section {
    position: relative;
    padding: 60px 20px;
    max-width: 800px;
    margin: 0 auto;
}

/* 标题区 */
.guestbook-header {
    text-align: center;
    margin-bottom: 40px;
}

.guestbook-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 8px;
}

.guestbook-subtitle {
    font-size: 16px;
    color: var(--text-secondary, #666);
    margin: 0;
}

/* 浮动按钮 */
.guestbook-fab {
    position: fixed;
    bottom: 80px;
    left: 20px;  /* 改为左边 */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color, #ff6b6b);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
}

.guestbook-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.guestbook-fab svg {
    width: 24px;
    height: 24px;
}

.guestbook-fab-text {
    display: none;
}

/* 留言输入区 */
.guestbook-composer {
    background: var(--bg-card, #fff);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: none;
}

.guestbook-composer.active {
    display: block;
}

.composer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.composer-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin: 0;
}

.composer-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #666);
    transition: color 0.2s;
}

.composer-close:hover {
    color: var(--text-primary, #333);
}

.composer-close svg {
    width: 20px;
    height: 20px;
}

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

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #333);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #ff6b6b);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    max-height: 300px;
}

.char-counter {
    text-align: right;
    font-size: 14px;
    color: var(--text-secondary, #666);
    margin-top: 4px;
}

.form-error {
    color: #ff4444;
    font-size: 14px;
    margin-top: 4px;
    min-height: 20px;
}

/* 图片上传区域 */
.image-upload-area {
    margin-top: 16px;
}

.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.upload-slot {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-input, #f5f5f5);
    border: 2px dashed var(--border-color, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.upload-slot:hover {
    border-color: var(--primary-color, #ff6b6b);
}

.upload-input {
    display: none;
}

.upload-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.upload-icon {
    font-size: 32px;
    color: var(--text-secondary, #999);
}

.upload-preview {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.upload-preview.active {
    display: block;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
}

.remove-image:hover {
    background: rgba(0, 0, 0, 0.8);
}

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary, #666);
    margin: 0;
}

/* 提交按钮 */
.form-actions {
    margin-top: 24px;
}

.submit-button {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color, #ff6b6b);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-button:hover:not(:disabled) {
    background: var(--primary-hover, #ff5252);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-cooldown {
    text-align: center;
    color: var(--text-secondary, #666);
    font-size: 14px;
    margin-top: 12px;
}

/* 留言列表 */
.guestbook-list {
    margin-top: 40px;
}

.loading-state,
.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #666);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid var(--border-color, #e0e0e0);
    border-top-color: var(--primary-color, #ff6b6b);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.retry-button {
    margin-top: 16px;
    padding: 8px 20px;
    background: var(--primary-color, #ff6b6b);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.retry-button:hover {
    background: var(--primary-hover, #ff5252);
}

/* 留言卡片 */
.blessing-card {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.blessing-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.blessing-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.blessing-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color, #ff6b6b);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.blessing-info {
    flex: 1;
}

.blessing-author {
    font-weight: 500;
    color: var(--text-primary, #333);
    margin-bottom: 2px;
}

.blessing-time {
    font-size: 14px;
    color: var(--text-secondary, #666);
}

.blessing-content {
    color: var(--text-primary, #333);
    line-height: 1.6;
    margin-bottom: 12px;
    word-wrap: break-word;
}

.blessing-images {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.blessing-images.count-1 {
    grid-template-columns: 1fr;
}

.blessing-images.count-2 {
    grid-template-columns: 1fr 1fr;
}

.blessing-images.count-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.blessing-image {
    width: 100%;
    padding-bottom: 100%;
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

.blessing-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 图片预览模态框 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.image-modal.active {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-close svg {
    width: 24px;
    height: 24px;
}

.image-modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-modal-nav {
    position: absolute;
    top: 50%;
    left: -60px;
    right: -60px;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
}

.image-modal-prev,
.image-modal-next {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.image-modal-prev:hover,
.image-modal-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 暗色模式支持 */
[data-theme="dark"] .guestbook-section {
    --bg-card: #1e1e1e;
    --bg-input: #2a2a2a;
    --border-color: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
}

/* Toast提示样式 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.toast-success {
    background: #4caf50;
}

.toast-error {
    background: #f44336;
}

.toast-info {
    background: #2196f3;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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

/* 图片加载动画 */
.blessing-image img {
    transition: opacity 0.3s ease;
}

.blessing-image img[data-loaded="false"] {
    opacity: 0;
}

.blessing-image img[data-loaded="true"] {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .guestbook-section {
        padding: 40px 16px;
    }

    .guestbook-title {
        font-size: 24px;
    }

    .guestbook-subtitle {
        font-size: 14px;
    }

    .guestbook-composer {
        padding: 20px;
    }

    .image-upload-grid {
        gap: 8px;
    }

    .image-modal-nav {
        left: -20px;
        right: -20px;
    }

    .image-modal-prev,
    .image-modal-next {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .guestbook-fab {
        bottom: 20px;
        left: 20px;  /* 保持左边 */
        width: 64px;
        height: 64px;
    }

    .guestbook-fab svg {
        width: 28px;
        height: 28px;
    }

    .guestbook-fab-text {
        display: none;
    }
}