/* =====================================================
   改枪码分享平台 - 主样式表
   ===================================================== */

/* CSS变量 */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #26344d;
    --bg-input: #334155;
    --bg-overlay: rgba(15, 23, 42, 0.85);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-link: #60a5fa;
    
    --border-color: #334155;
    --border-light: #475569;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    
    --header-height: 64px;
    --container-max: 1280px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 重置 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

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

/* 容器 */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    background: transparent;
    color: var(--text-primary);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
}
.btn-primary:hover { box-shadow: 0 4px 15px rgba(59,130,246,0.4); }

.btn-outline {
    border-color: var(--border-light);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(59,130,246,0.1); }

.btn-outline-light {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.9);
}
.btn-outline-light:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

/* 导航栏 */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

.logo i {
    font-size: 26px;
    color: var(--primary);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
    overflow: hidden;
    z-index: 100;
}

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

.dropdown-menu.dropdown-right { left: auto; right: 0; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.dropdown-item i { font-size: 16px; }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger:hover { color: #ff6b6b; }

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 搜索 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 200px;
    transition: var(--transition);
}

.search-form:focus-within {
    border-color: var(--primary);
    width: 260px;
}

.search-form input {
    flex: 1;
    padding: 7px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.search-form input::placeholder { color: var(--text-muted); }

.search-form button {
    padding: 7px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}
.search-form button:hover { color: var(--primary); }

/* 用户下拉 */
.user-dropdown { position: relative; }
.user-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-primary);
}
.user-trigger:hover { border-color: var(--border-light); }

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* 移动端菜单 */
.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
}

/* 消息提示 */
.flash-messages { margin-top: 16px; }
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    font-size: 14px;
    position: relative;
}
.alert-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.alert-error { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.alert-info { background: rgba(6,182,212,0.15); color: var(--info); border: 1px solid rgba(6,182,212,0.3); }

.alert-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
}
.alert-close:hover { opacity: 1; }

/* Hero区域 */
.hero-section {
    position: relative;
    padding: 80px 0 60px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59,130,246,0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(139,92,246,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    text-align: center;
}

.hero-title {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 36px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* 区块通用 */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h2 i { color: var(--primary); }

.section-more {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-muted);
}
.section-more:hover { color: var(--primary); }

.section-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-link {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}
.filter-link:hover, .filter-link.active {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(59,130,246,0.1);
}

.section-footer {
    text-align: center;
    margin-top: 32px;
}

/* 分类区块 */
.category-section { padding: 40px 0; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.category-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-2px);
    border-color: var(--cat-color, var(--primary));
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.category-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.category-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.category-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.category-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* 改枪码卡片 */
.loadout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.loadout-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
}

.loadout-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

.card-image-wrap {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-input);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.loadout-card:hover .card-image { transform: scale(1.05); }

.card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 6px;
}
.card-image-placeholder i { font-size: 36px; opacity: 0.5; }
.card-image-placeholder span { font-size: 13px; }

.card-category {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    display: flex;
    align-items: center;
    gap: 3px;
}

.card-body { padding: 16px; }

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}
.card-title a:hover { color: var(--primary-light); }

.card-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.card-weapon, .card-price {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-price { color: var(--warning); }

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.card-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.card-author img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}
.card-author:hover { color: var(--text-primary); }

.card-stats {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}
.card-stats span { display: flex; align-items: center; gap: 3px; }

/* 特色区块 */
.featured-section { padding: 40px 0; background: rgba(59,130,246,0.03); }
.hot-section { padding: 40px 0; }
.latest-section { padding: 40px 0; }
.users-section { padding: 40px 0; background: rgba(139,92,246,0.03); }

/* 用户网格 */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.user-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    text-align: center;
}

.user-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid var(--border-color);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.user-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* 分页 */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition);
}

.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

/* 页脚 */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 50px 0 20px;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 12px 0;
    line-height: 1.6;
}

.footer-social {
    display: flex;
    gap: 12px;
}
.footer-social a {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
}
.footer-social a:hover { background: var(--primary); color: white; }

.footer-links h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-links a {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    padding: 5px 0;
}
.footer-links a:hover { color: var(--primary); }

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* 卡片面板 */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-panel-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* 标签 */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: rgba(59,130,246,0.15);
    color: var(--primary-light);
    border: 1px solid rgba(59,130,246,0.3);
}

/* 响应式 */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .main-nav { display: none; }
    .search-form { width: 140px !important; }
    .search-form:focus-within { width: 180px !important; }
    .mobile-toggle { display: block; }
    .hero-section { padding: 50px 0 40px; }
    .hero-stats { gap: 24px; }
    .stat-num { font-size: 22px; }
    .loadout-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .footer-brand { text-align: center; }
    .footer-social { justify-content: center; }
    .user-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
    .loadout-grid { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: 1fr; }
    .user-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; max-width: 280px; justify-content: center; }
}
