/* 全局样式 - 移动端优先设计 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --border-radius: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* 相册网格 */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* 相册卡片 */
.album-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.album-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.album-card.pinned::before {
    content: '📌';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.album-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #ddd;
}

.album-info {
    padding: 15px;
}

.album-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-color);
}

.album-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.album-time {
    font-size: 13px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 相册详情页 */
.album-detail {
    max-width: 1000px;
    margin: 0 auto;
}

.album-header {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.album-header h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.media-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: #ddd;
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.media-item:hover img,
.media-item:hover video {
    transform: scale(1.1);
}

.media-item.video::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* 全屏查看器 */
.fullscreen-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.fullscreen-viewer.active {
    display: flex;
}

.fullscreen-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.fullscreen-content img,
.fullscreen-content video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.fullscreen-close:hover {
    background: rgba(255,255,255,0.3);
}

.fullscreen-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.fullscreen-nav:hover {
    background: rgba(255,255,255,0.3);
}

.fullscreen-prev {
    left: 20px;
}

.fullscreen-next {
    right: 20px;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
}

.btn-primary {
    background: var(--primary-color);
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-back {
    margin-bottom: 20px;
}

/* 客服按钮 */
.chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-button .chat-icon {
    font-size: 24px;
    line-height: 1;
}

.chat-button .chat-text {
    font-size: 16px;
    line-height: 1;
}

.chat-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.chat-button.has-unread::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid white;
}

/* 客服窗口 */
.chat-window {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.chat-window.active {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 16px;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
}

.chat-close:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.message.sent {
    flex-direction: row-reverse;
}

.message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    word-wrap: break-word;
}

.message.received .message-content {
    background: white;
    border-bottom-left-radius: 5px;
}

.message.sent .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.chat-input-area {
    padding: 15px;
    background: var(--card-bg);
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.chat-input-area input:focus {
    border-color: var(--primary-color);
}

.chat-input-area button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.chat-input-area button:hover {
    background: #2980b9;
}

.chat-attach-btn {
    padding: 10px 15px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-attach-btn:hover {
    background: #7f8c8d;
    transform: rotate(45deg);
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 20px;
    }

    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    /* 移动端客服按钮稍微小一点，避免遮挡内容 */
    .chat-button {
        padding: 10px 20px;
        font-size: 14px;
        bottom: 15px;
        right: 15px;
    }

    .chat-button .chat-icon {
        font-size: 20px;
    }

    .chat-button .chat-text {
        font-size: 14px;
    }

    .chat-window {
        width: calc(100% - 20px);
        height: calc(100% - 100px);
        right: 10px;
        bottom: 80px;
    }

    .fullscreen-close {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    /* 移动端隐藏左右导航按钮，使用滑动代替 */
    .fullscreen-nav {
        display: none;
    }

    /* 移动端提示文字 */
    .fullscreen-viewer::before {
        content: '← 滑动切换 | 点击图片关闭 →';
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.7);
        font-size: 14px;
        background: rgba(0, 0, 0, 0.5);
        padding: 8px 16px;
        border-radius: 20px;
        backdrop-filter: blur(10px);
        z-index: 10000;
        pointer-events: none;
        animation: fadeInOut 3s ease-in-out;
    }

    @keyframes fadeInOut {
        0% { opacity: 0; }
        10% { opacity: 1; }
        90% { opacity: 1; }
        100% { opacity: 0; }
    }
}

/* 平板设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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