/**
 * Cartoon Animator 素材分享平台
 * 全局样式
 */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

a {
    text-decoration: none;
    color: var(--nav-font-color);
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input, textarea, select {
    font-family: inherit;
}

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

/* 头部 - 不再强制白色背景，由 header.php 内联样式控制 */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    height: 40px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    /* 使用继承色，不覆盖header.php中的color设置 */
    color: var(--nav-font-color);
}

/* 导航 */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    gap: 30px;
}

.nav-item a {
    display: block;
    padding: 8px 0;
    color: var(--nav-font-color);
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-item a:hover,
.nav-item a.active {
    color: var(--theme-color);
}

.nav-item a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--theme-color);
    transition: width 0.3s;
}

.nav-item a:hover::after {
    width: 100%;
}

/* 用户菜单 */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-login {
    padding: 8px 24px;
    background: var(--theme-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-login:hover {
    background: var(--theme-color2);
    transform: translateY(-2px);
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 180px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    margin-top: 10px;
}

.user-menu:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: #f5f7fa;
}

.dropdown-menu a:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-menu a:last-child {
    border-radius: 0 0 8px 8px;
}

/* 公告栏 */
.announcement-bar {
    background: linear-gradient(90deg, var(--theme-gradient-start), var(--theme-gradient-end));
    color: #fff;
    padding: 8px 0;
    overflow: hidden;
}

.announcement-content {
    display: flex;
    gap: 50px;
    white-space: nowrap;
}

.announcement-item {
    display: inline-block;
    animation: scroll-left 30s linear infinite;
}

.announcement-item a {
    color: #fff;
}

@keyframes scroll-left {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* 英雄区域 */
.hero-section {
    position: relative;
    height: 400px;
    background: linear-gradient(135deg, var(--theme-gradient-start), var(--theme-gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 15px;
}

.hero-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 30px;
}

/* 搜索框 */
.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto 20px;
    background: #fff;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.search-input {
    flex: 1;
    padding: 15px 25px;
    border: none;
    font-size: 16px;
    outline: none;
    caret-color: var(--theme-color);
}

.search-btn {
    padding: 15px 30px;
    background: var(--theme-color);
    color: #fff;
    border: none;
    font-size: 18px;
    transition: background 0.2s;
}

.search-btn:hover {
    background: var(--theme-color2);
}

.hot-tags {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hot-tags span {
    font-size: 14px;
    opacity: 0.8;
}

.tag-item {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    transition: transform 0.2s;
}

.tag-item:hover {
    transform: scale(1.05);
}

/* 区域标题 */
.section-title {
    font-size: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.more-link {
    color: var(--theme-color);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.more-link:hover {
    text-decoration: underline;
}

/* 分类卡片 */
.categories-section,
.materials-section,
.stats-section {
    padding: 40px 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.category-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--theme-gradient-start), var(--theme-gradient-end));
    color: #fff;
    font-size: 24px;
}

.category-card h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.category-card p {
    font-size: 13px;
    color: #999;
}

/* 素材网格 */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.materials-grid-sm {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.material-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
}

.material-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.material-thumb {
    aspect-ratio: 16 / 10;
    height: auto;
    position: relative;
    height: 150px;
    background: #f0f0f0;
    overflow: hidden;
}

.material-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.material-card:hover .material-thumb img {
    transform: scale(1.05);
}

.tag-free, .tag-recommend {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
}

.tag-free {
    background: #4caf50;
}

.tag-recommend {
    left: auto;
    right: 10px;
    background: #ff9800;
}

.material-info {
    padding: 12px 15px;
    background: #fff;
}

.material-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.material-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.material-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.material-downloads {
    display: flex;
    align-items: center;
    gap: 3px;
}

.material-copyright {
    padding: 8px 15px;
    background: #f9f9f9;
    font-size: 12px;
    color: #999;
    border-top: 1px solid #f0f0f0;
}

/* 素材列表 */
.materials-list {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.material-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

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

.material-list-item:hover {
    background: #f9f9f9;
}

.item-rank {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
}

.rank-1 { background: #ff4d4f; }
.rank-2 { background: #ff9800; }
.rank-3 { background: #ffc107; color: #333; }
.rank-4, .rank-5, .rank-6, .rank-7, .rank-8 { background: #8c8c8c; }

.item-thumb {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

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

.item-info {
    flex: 1;
}

.item-info h4 {
    font-size: 15px;
    margin-bottom: 5px;
}

.item-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #999;
}

.item-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* 统计区域 */
.bg-light {
    background: #fff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-item i {
    font-size: 36px;
    color: var(--theme-color);
    margin-bottom: 15px;
}

.stat-num {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    color: #999;
    font-size: 14px;
}

/* 弹窗 */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #ddd;
}

/* 登录框 */
.login-box {
    width: 400px;
    padding: 40px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.login-box input:focus {
    outline: none;
    border-color: var(--theme-color);
}

.remember-row {
    display: flex;
    align-items: center;
}

.remember-row input {
    margin-right: 5px;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--theme-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-submit:hover {
    background: var(--theme-color2);
    transform: translateY(-2px);
}

.form-tips {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: #ff4d4f;
}

/* 悬浮客服 - 现代化无边框设计 */
.floating-service {
    position: fixed;
    right: 30px;
    bottom: 120px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color2));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 0 rgba(33, 150, 243, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    animation: serviceFloat 3s ease-in-out infinite;
}

@keyframes serviceFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.floating-service:hover {
    transform: scale(1.15) translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 0 8px rgba(33, 150, 243, 0.15);
    animation: none;
}

.floating-service.dragging {
    cursor: move !important;
    opacity: 0.9;
    animation: none;
}

.service-pulse {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    background: #ff4d4f;
    border-radius: 50%;
    border: 3px solid #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.7);
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
        box-shadow: 0 0 0 10px rgba(255, 77, 79, 0);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(255, 77, 79, 0);
    }
}

/* 客服面板 - 现代化无边框悬浮设计 */
.service-panel {
    position: fixed;
    right: 105px;
    bottom: 120px;
    width: 340px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.1);
    z-index: 1000;
    overflow: hidden;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color2));
    color: #fff;
    position: relative;
}

.panel-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

.panel-header span {
    font-size: 18px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.panel-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.panel-body {
    padding: 24px;
    max-height: 450px;
    overflow-y: auto;
}

.service-item {
    margin-bottom: 24px;
    padding: 16px;
    background: linear-gradient(135deg, #f8faff, #fff);
    border-radius: 12px;
    border: 1px solid rgba(33, 150, 243, 0.1);
    transition: all 0.3s;
}

.service-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.1);
    border-color: rgba(33, 150, 243, 0.2);
}

.service-item:last-child {
    margin-bottom: 0;
}

.service-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
    display: block;
    color: #1a1a1a;
}

.service-qr {
    text-align: center;
}

.service-qr img {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.service-qr img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.qr-tip {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

.service-value {
    font-size: 16px;
    color: var(--theme-color);
    font-weight: 600;
    cursor: pointer;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    border: 2px solid rgba(33, 150, 243, 0.1);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.service-value:hover {
    border-color: var(--theme-color);
    background: rgba(33, 150, 243, 0.05);
}

.copy-icon {
    font-size: 14px;
    color: #999;
    transition: all 0.3s;
}

.service-value:hover .copy-icon {
    color: var(--theme-color);
}

/* 页脚 */
.site-footer {
    background: #fff;
    padding: 30px 0;
    margin-top: 60px;
    border-top: 1px solid #eee;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copyright {
    color: #333;
    font-size: 14px;
}

.icp a {
    color: #666;
    font-size: 13px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: #666;
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--theme-color);
}

/* 移动端菜单 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: none;
    border: none;
}

.mobile-menu-btn span {
    width: 25px;
    height: 2px;
    background: #333;
    transition: all 0.3s;
}

/* 响应式 */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: #fff;
        padding: 20px;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }
    
    .main-nav.show {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 15px;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .search-box {
        flex-direction: column;
        border-radius: 12px;
    }
    
    .search-btn {
        border-radius: 0 0 12px 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}
