/**
 * 主样式文件 - 一方穗月Minecraft服务器网站
 * 包含全局样式、动画效果和组件样式
 */

/* ========================================
   全局样式和重置
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========================================
   自定义工具类
======================================== */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.glass {
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.85);
}

/* 深色主题适配 */
[data-theme="dark"] .glass {
    background-color: rgba(42, 42, 42, 0.95);
    border-color: rgba(255, 119, 168, 0.4);
}

/* ========================================
   滚动条样式
======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #FFFBF7;
}

::-webkit-scrollbar-thumb {
    background: #FF77A8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #E65C8E;
}

/* ========================================
   动画效果
======================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes bounce-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes slideUp {
    0% { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes meritGain {
    0% { 
        opacity: 0; 
        transform: translateY(0) scale(0.8); 
    }
    50% { 
        opacity: 1; 
        transform: translateY(-40px) scale(1.1); 
    }
    100% { 
        opacity: 0; 
        transform: translateY(-60px) scale(0.9); 
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   导航栏样式
======================================== */
#navbar {
    transition: all 0.3s ease;
}

#navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(255, 119, 168, 0.1);
}

.nav-link {
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #FF77A8;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ========================================
   状态指示器
======================================== */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-online {
    background-color: #34D399;
    animation: pulse 2s infinite;
}

.status-offline {
    background-color: #F87171;
}

.status-loading {
    background-color: #FBBF24;
    animation: spin 1.5s linear infinite;
}

.status-error {
    background-color: #9CA3AF;
}

/* ========================================
   卡片样式
======================================== */
.card-hover {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255, 119, 168, 0.15);
}

/* ========================================
   按钮样式
======================================== */
.btn-primary {
    background: linear-gradient(135deg, #FF77A8 0%, #E65C8E 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 119, 168, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 2px solid #FF77A8;
    color: #FF77A8;
    padding: 12px 24px;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #FF77A8;
    color: white;
    transform: translateY(-2px);
}

/* ========================================
   表单样式
======================================== */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #FF77A8;
    box-shadow: 0 0 0 3px rgba(255, 119, 168, 0.1);
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    color: #4A443F;
}

/* ========================================
   消息通知样式
======================================== */
.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: #f9fafb;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-unread {
    background-color: #FFF7ED;
    border-left: 4px solid #FF77A8;
}

/* ========================================
   功德系统样式
======================================== */
.merit-display {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #34D399;
    font-weight: 600;
    font-size: 0.875rem;
}

.merit-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1000;
}

/* ========================================
   音乐播放器样式
======================================== */
#music-player {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 30;
}

#music-player-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 119, 168, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#music-player-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* 音乐控制按钮动画 */
.music-btn {
    transition: all 0.2s ease;
}

.music-btn:active {
    transform: scale(0.95);
}

/* 播放器展开/收起动画 */
.music-player-expand {
    animation: slideUp 0.3s ease-out;
}

/* ========================================
   视频播放器样式
======================================== */
.video-card {
    cursor: pointer;
    overflow: hidden;
}

.video-card .play-button {
    transition: all 0.3s ease;
}

.video-card:hover .play-button {
    transform: scale(1.1);
}

#video-modal video {
    max-height: 70vh;
    border-radius: 12px;
}

/* ========================================
   社区帖子样式
======================================== */
.post-card {
    background: white;
    border: 1px solid rgba(255, 119, 168, 0.1);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

.post-card:hover {
    border-color: rgba(255, 119, 168, 0.3);
    box-shadow: 0 4px 20px rgba(255, 119, 168, 0.1);
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FF77A8;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #B8B0A8;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.post-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.125rem;
    color: #4A443F;
    margin-bottom: 8px;
}

.post-content {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 12px;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.post-action {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #9ca3af;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.post-action:hover {
    color: #FF77A8;
}

/* ========================================
   弹窗样式
======================================== */
.modal {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    background: white;
    border-radius: 24px;
    border: 1px solid rgba(255, 119, 168, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
}

/* ========================================
   加载动画
======================================== */
#page-loader {
    background: #FFFBF7;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid #FFEAF1;
    border-top: 4px solid #FF77A8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 移动端优化 */
@media (max-width: 768px) {
    /* 导航栏移动端适配 */
    #navbar nav {
        margin: 16px;
        padding: 12px 16px;
    }
    
    /* 卡片间距调整 */
    .grid {
        gap: 16px;
    }
    
    /* 按钮尺寸调整 */
    .btn-primary,
    .btn-secondary {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* 表单输入框调整 */
    .form-input {
        padding: 10px 14px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 音乐播放器移动端适配 */
    #music-player {
        bottom: 16px;
        right: 16px;
    }
    
    #music-player-content {
        width: calc(100vw - 32px);
        max-width: 320px;
    }
    
    /* 视频播放器移动端适配 */
    #video-modal .bg-black {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
    
    #video-modal video {
        max-height: 60vh;
    }
    
    /* 文字大小调整 */
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    .text-lg {
        font-size: 1rem;
    }
}

/* 平板端适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 大屏幕优化 */
@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
    
    /* 更大的圆角 */
    .rounded-3xl {
        border-radius: 2rem;
    }
}

/* ========================================
   深色主题适配
======================================== */
[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --card-bg: rgba(26, 26, 26, 0.95);
    --border-color: rgba(255, 119, 168, 0.3);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .bg-white {
    background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .text-neutral-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-neutral-light {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-100 {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .form-input {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-input:focus {
    border-color: #FF77A8;
}

/* ========================================
   打印样式
======================================== */
@media print {
    .fixed,
    #navbar,
    #music-player,
    .top-toast,
    button {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .bg-white {
        background: white !important;
    }
    
    .text-primary {
        color: black !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;
}

/* 焦点样式 */
*:focus {
    outline: 2px solid #FF77A8;
    outline-offset: 2px;
}

/* 减少动画效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .text-neutral-light {
        color: #374151 !important;
    }
    
    .border-primary\/20 {
        border-color: #FF77A8 !important;
    }
    
    .bg-primary\/10 {
        background-color: #FF77A8 !important;
    }
}