/* ========== post.css - 发布页样式 ========== */
/* CSS 变量已在 common.css 中统一定义，此处不再重复 */

body.post-page {
    font-family: 'Microsoft YaHei', 'PingFang SC', system-ui, -apple-system, sans-serif;
    background: linear-gradient(145deg, #020617 0%, #0a0f1c 40%, #0d1520 100%);
    min-height: 100vh;
    letter-spacing: 0.01em;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

/* 无障碍：键盘焦点 */
body.post-page :focus-visible {
    outline: 2px solid var(--emerald);
    outline-offset: 2px;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    body.post-page *, body.post-page *::before, body.post-page *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* 屏幕阅读器专用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.glass-card {
    background: rgba(18, 25, 45, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 2.2rem;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
}

.file-upload-area {
    position: relative;
    transition: all 0.25s;
}

.file-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: rgba(30, 41, 59, 0.7);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 1.2rem;
    color: #94a3b8;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
    user-select: none;
}

.file-upload-area:hover .file-label,
.file-upload-area.drag-over .file-label {
    border-color: var(--emerald);
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.85);
}

.file-upload-area.drag-over .file-label {
    border-style: solid;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.preview-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 0.9rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #1e293b;
    transition: transform 0.2s;
}

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

.preview-item .remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    opacity: 0.8;
}

.preview-item .remove-btn:hover {
    background: #ef4444;
    opacity: 1;
}

.submit-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.02em;
}

.submit-btn:disabled {
    opacity: 0.65;
    pointer-events: none;
}

.submit-btn .spinner {
    display: none;
    margin-right: 0.4rem;
}

.submit-btn.loading .spinner {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

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

/* 发布页 Toast */
.post-toast {
    position: fixed;
    bottom: calc(2rem + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #10b981;
    color: #fff;
    padding: 0.8rem 2rem;
    border-radius: 2.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.4);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

.post-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.post-toast.error {
    background: #ef4444;
    box-shadow: 0 15px 30px rgba(239, 68, 68, 0.4);
}

/* 发布页模态框 */
.mini-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mini-modal-content {
    background: #111827;
    border-radius: 1.8rem;
    padding: 2rem;
    width: 90%;
    max-width: 380px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.8);
}

.char-count {
    font-size: 0.8rem;
    color: #64748b;
    text-align: right;
    margin-top: 0.3rem;
    padding-right: 0.3rem;
}

.char-count.warning {
    color: #f59e0b;
}

.char-count.error {
    color: #ef4444;
}

.rules-panel {
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1.2rem;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.4);
    overflow: hidden;
    transition: all 0.3s;
}

.rules-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.8rem;
    cursor: pointer;
    color: #94a3b8;
    font-weight: 500;
    user-select: none;
    transition: background 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.rules-trigger:hover {
    background: rgba(255, 255, 255, 0.03);
}

.rules-trigger .fa-chevron-down {
    transition: transform 0.3s;
}

.rules-trigger[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

.rules-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    padding: 0 1.8rem;
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.7;
    background: rgba(0, 0, 0, 0.2);
}

.rules-content.open {
    max-height: 600px;
    padding: 1.2rem 1.8rem 1.5rem;
}

.rules-content ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.rules-content li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.rules-content li:last-child {
    margin-bottom: 0;
}
