/* 徽章锻造系统 - 样式表 */

:root {
    /* 主色调 */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    
    /* 背景色 */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    
    /* 文字色 */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* 状态色 */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* 卡片 */
    --card-bg: #1e293b;
    --card-border: #334155;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

/* 亮色主题 */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* 导航栏 */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--card-border);
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--primary-light);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-link {
    color: var(--warning) !important;
}

/* 主内容区 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 120px);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: var(--card-border);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* 表单 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
}

/* 徽章样式 */
.badge-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.badge-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.badge-icon {
    font-size: 4rem;
}

.badge-id {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.badge-level {
    color: var(--text-secondary);
}

/* 稀有度颜色 */
.rarity-1 { color: #94a3b8; }
.rarity-2 { color: #22c55e; }
.rarity-3 { color: #3b82f6; }
.rarity-4 { color: #a855f7; }
.rarity-5 { color: #fbbf24; }

/* 列表页 */
.list-page {
    max-width: 800px;
    margin: 0 auto;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.table tr:hover {
    background: var(--bg-secondary);
}

/* 徽章锻造页 */
.forge-page {
    max-width: 800px;
    margin: 0 auto;
}

.forge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.bonus-display {
    background: var(--card-bg);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.beta-badge {
    background: var(--warning);
    color: #000;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* 创建徽章区域 */
.create-badge-section {
    text-align: center;
}

.create-preview {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 3rem;
    margin-bottom: 2rem;
    border: 2px dashed var(--card-border);
}

.preview-content {
    text-align: center;
}

.badge-icon-lg {
    font-size: 6rem;
}

.create-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.create-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* 升级面板 */
.upgrade-section {
    display: grid;
    gap: 2rem;
}

.badge-display {
    text-align: center;
}

.badge-main {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: inline-block;
}

.badge-level-lg {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.bonus-rate {
    color: var(--success);
    font-size: 1rem;
    margin-left: 0.5rem;
}

.lucky-badge {
    color: var(--warning);
    margin-top: 0.5rem;
}

.protection-active {
    color: var(--success);
    margin-top: 0.5rem;
}

.upgrade-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.upgrade-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat {
    text-align: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
    max-width: 100%;
    line-height: 1.2;
    white-space: nowrap;
}

.stat-value.large {
    font-size: 1.1rem;
}

.stat-value.danger {
    color: var(--danger);
}

.stat-value.cost-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-break: keep-all;
    display: inline-block;
    min-width: fit-content;
}

.cooldown-warning {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    color: var(--warning);
    margin-bottom: 1rem;
}

.upgrade-actions {
    text-align: center;
    margin-top: 1.5rem;
}

.max-level-badge {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border-radius: var(--radius-lg);
}

.max-level-badge h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* 道具 */
.items-section {
    margin-top: 2rem;
}

.item-list {
    display: grid;
    gap: 1rem;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.item-card .item-count {
    margin-left: auto;
}

.item-card .use-item-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.item-card .use-item-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

.item-card .use-item-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.item-icon {
    font-size: 2rem;
}

.item-name {
    font-weight: 600;
}

.item-desc {
    color: var(--text-secondary);
    flex: 1;
}

.item-count {
    background: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
}

/* 排行榜 */
.rank-page {
    max-width: 1000px;
    margin: 0 auto;
}

.rank-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.rank-tab {
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.rank-tab.active {
    background: var(--primary);
    border-color: var(--primary);
}

.rank-list {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-position {
    width: 40px;
    font-size: 1.5rem;
    font-weight: 700;
}

.rank-position.gold { color: #fbbf24; }
.rank-position.silver { color: #94a3b8; }
.rank-position.bronze { color: #cd7f32; }

.rank-badge {
    width: 60px;
    text-align: center;
}

.rank-info {
    flex: 1;
    margin-left: 1rem;
}

.rank-username {
    font-weight: 600;
}

.rank-value {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 管理后台 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--card-border);
    padding: 1.5rem 0;
}

.sidebar-header h3 {
    padding: 0 1.5rem;
    margin-bottom: 1rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: var(--card-bg);
    color: var(--text-primary);
}

.nav-divider {
    height: 1px;
    background: var(--card-border);
    margin: 1rem 0;
}

.admin-main {
    flex: 1;
    padding: 1.5rem 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.admin-header h1 {
    font-size: 1.5rem;
}

.header-user {
    color: var(--text-secondary);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .nav-menu {
        gap: 1rem;
    }
    
    .forge-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .create-actions {
        flex-direction: column;
    }
    
    .upgrade-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .admin-sidebar {
        display: none;
    }
}

/* ========================
   首页样式
   ======================== */
.home-page {
    text-align: center;
}

/* 英雄区 */
.hero {
    padding: 4rem 1rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* 功能卡片 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 系统概览 */
.stats-preview {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.stats-preview h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.stats-preview .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.stats-preview .stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.stats-preview .stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stats-preview .stat-card .stat-label {
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .stats-preview .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
