/* 公共样式 - 明亮风格 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 基础色板 - 明亮风格 */
    --bg-base: #f5f5f5;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #f0f0f0;
    --bg-active: #e8e8e8;

    /* 边框与分割 */
    --border-light: #e0e0e0;
    --border-default: #cccccc;
    --border-dark: #999999;

    /* 文字层级 */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --text-muted: #bbbbbb;

    /* 盟军 - 蓝色系 */
    --allied-primary: #2196F3;
    --allied-light: #BBDEFB;
    --allied-dark: #1976D2;
    --allied-bg: #E3F2FD;

    /* 苏军 - 红色系 */
    --soviet-primary: #F44336;
    --soviet-light: #FFCDD2;
    --soviet-dark: #D32F2F;
    --soviet-bg: #FFEBEE;

    /* 尤里 - 紫色系 */
    --yuri-primary: #9C27B0;
    --yuri-light: #E1BEE7;
    --yuri-dark: #7B1FA2;
    --yuri-bg: #F3E5F5;

    /* 强调色 */
    --accent-gold: #FF9800;
    --accent-green: #4CAF50;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
}

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

/* 顶部导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.navbar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--soviet-primary), var(--allied-primary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.navbar-title-group {
    display: flex;
    flex-direction: column;
}

.navbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
}

.navbar-back {
    margin-left: auto;
    padding: 8px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.navbar-back:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* 主内容区 */
.main-content {
    margin-top: 60px;
    padding: 32px 24px;
    min-height: calc(100vh - 60px);
}

/* 页面标题 */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--soviet-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* 标签 */
.country-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 4px;
}

/* 分类区域 */
.category-section {
    margin-bottom: 30px;
}

.category-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

.category-section-icon {
    font-size: 20px;
}

.category-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.category-section-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* 单位图标容器 */
.unit-icon-wrap {
    position: relative;
    width: var(--icon-size, 48px);
    height: var(--icon-size, 48px);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.unit-icon-wrap[data-category="建筑"] { background: linear-gradient(135deg, #FFF3E0, #FFE0B2); }
.unit-icon-wrap[data-category="兵种"] { background: linear-gradient(135deg, #E8F5E9, #C8E6C9); }
.unit-icon-wrap[data-category="战车"] { background: linear-gradient(135deg, #EFEBE9, #D7CCC8); }
.unit-icon-wrap[data-category="舰船"] { background: linear-gradient(135deg, #E3F2FD, #BBDEFB); }
.unit-icon-wrap[data-category="飞行器"] { background: linear-gradient(135deg, #E0F7FA, #B2EBF2); }

.unit-icon-img {
    display: block;
    width: 60%;
    height: 60%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.unit-card:hover .unit-icon-img,
.faction-card:hover .unit-icon-img,
.country-card:hover .unit-icon-img,
.detail-header:hover .unit-icon-img {
    transform: scale(1.1);
}

/* 图片加载失败降级兜底 */
.unit-icon-fallback {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--icon-size, 48px) * 0.55);
    z-index: 0;
}

.unit-icon-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* 图片淡入动画 */
.unit-icon-img {
    animation: icon-fade-in 0.3s ease forwards;
}

@keyframes icon-fade-in {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    .navbar-subtitle {
        display: none;
    }

    .main-content {
        padding: 20px 16px;
    }

    .page-header h1 {
        font-size: 22px;
    }
}
