/* 夏日留言板 v3 - 悬浮发布按钮与底部 Sheet 面板 */
/* ==================== ćŹćľŽĺĺ¸ćéŽ ==================== */
.fab {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--mdb-primary), var(--mdb-dark));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-fab);
    transition: transform 0.3s var(--transition-spring), opacity 0.3s;
    z-index: 90;
    animation: fabBreathe 3s ease-in-out infinite;
}

.fab svg {
    width: 26px;
    height: 26px;
}

@keyframes fabBreathe {
    0%, 100% { box-shadow: 0 6px 24px rgba(77, 208, 225, 0.35); transform: scale(1); }
    50% { box-shadow: 0 8px 32px rgba(77, 208, 225, 0.45); transform: scale(1.03); }
}

/* FJD 用户的 FAB 按钮使用橘红色 */
body[data-identity="FJD"] .fab {
    background: linear-gradient(135deg, var(--fjd-primary), var(--fjd-dark));
    box-shadow: 0 6px 24px rgba(255, 138, 101, 0.35);
    animation: fabBreatheFJD 3s ease-in-out infinite;
}

@keyframes fabBreatheFJD {
    0%, 100% { box-shadow: 0 6px 24px rgba(255, 138, 101, 0.35); transform: scale(1); }
    50% { box-shadow: 0 8px 32px rgba(255, 138, 101, 0.45); transform: scale(1.03); }
}

.fab:active {
    transform: scale(0.92) !important;
}

/* FAB 点击后跳转前的即时反馈（JS 手动加 class，让页面跳转前用户能看到） */
.fab.tapped {
    animation: none !important;
    transform: scale(0.88) !important;
    opacity: 0.65 !important;
    transition: transform 0.1s ease, opacity 0.1s ease !important;
}

.fab.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* ==================== 全屏页面跳转 Loading ==================== */
.page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(240, 255, 254, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: pageLoadingFadeIn 0.12s ease forwards;
    pointer-events: all;
}

html[data-theme="night"] .page-loading-overlay {
    background: rgba(10, 28, 40, 0.82);
}

@keyframes pageLoadingFadeIn {
    to { opacity: 1; }
}

.page-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(77, 208, 225, 0.25);
    border-top-color: var(--mdb-primary);
    border-radius: 50%;
    animation: sheet-spin 0.75s linear infinite;
}

body[data-identity="FJD"] .page-loading-spinner {
    border-color: rgba(255, 138, 101, 0.25);
    border-top-color: var(--fjd-primary);
}

/* ==================== ĺşé¨ Sheet é˘ćż ==================== */
.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sheet {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-sheet);
    z-index: 160;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sheet.active {
    transform: translateY(0);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--text-tertiary);
    border-radius: 2px;
    margin: 10px auto 6px;
    opacity: 0.35;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.nickname-selector {
    display: flex;
    background: rgba(0,0,0,0.03);
    border-radius: var(--radius-pill);
    padding: 3px;
    gap: 3px;
}

.nickname-btn {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.nickname-btn.active[data-value="MDB"] {
    background: linear-gradient(135deg, var(--mdb-primary), var(--mdb-dark));
    color: white;
    box-shadow: 0 3px 12px rgba(77, 208, 225, 0.3);
}

.nickname-btn.active[data-value="FJD"] {
    background: linear-gradient(135deg, var(--fjd-primary), var(--fjd-dark));
    color: white;
    box-shadow: 0 3px 12px rgba(255, 138, 101, 0.35);
}

.sheet-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0,0,0,0.03);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sheet-close svg {
    width: 18px;
    height: 18px;
}

.sheet-close:active {
    background: rgba(0,0,0,0.06);
    transform: scale(0.92);
}

.sheet-form {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.sheet-textarea {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.7;
    resize: none;
    min-height: 100px;
    font-family: inherit;
    outline: none;
}

.sheet-textarea::placeholder {
    color: var(--text-tertiary);
}

.sheet-char-count {
    text-align: right;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
}

/* ==================== Sheet ĺĺžçé˘č§ç˝ć ?==================== */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
}

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

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

.preview-remove:active {
    background: rgba(239, 68, 68, 0.85);
}

.preview-add-btn {
    aspect-ratio: 1;
    border: 2px dashed rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.preview-add-btn:active {
    border-color: var(--mdb-primary);
    color: var(--mdb-dark);
    background: rgba(77, 208, 225, 0.06);
}

/* FJD 用户的图片添加按钮使用橘红色 */
body[data-identity="FJD"] .preview-add-btn:active {
    border-color: var(--fjd-primary);
    color: var(--fjd-dark);
    background: rgba(255, 138, 101, 0.06);
}

.preview-add-btn svg {
    width: 24px;
    height: 24px;
}

.add-text {
    font-size: 11px;
    font-weight: 500;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.sheet-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--mdb-primary), var(--mdb-dark));
    border: none;
    border-radius: var(--radius-pill);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
    box-shadow: 0 4px 16px rgba(77, 208, 225, 0.3);
}

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

/* ==================== 发布按钮 Loading 状态 ==================== */
@keyframes sheet-spin {
    to { transform: rotate(360deg); }
}

.sheet-submit.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: not-allowed;
    opacity: 0.75;
    pointer-events: none;
}

.sheet-submit.loading .submit-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: sheet-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.sheet-submit:active:not(:disabled) {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(77, 208, 225, 0.25);
}

/* FJD 用户的发送按钮使用橘红色 */
body[data-identity="FJD"] .sheet-submit {
    background: linear-gradient(135deg, var(--fjd-primary), var(--fjd-dark));
    box-shadow: 0 4px 16px rgba(255, 138, 101, 0.3);
}

body[data-identity="FJD"] .sheet-submit:active:not(:disabled) {
    box-shadow: 0 2px 10px rgba(255, 138, 101, 0.25);
}

