/**
 * Emoji Hub - Main Stylesheet
 * 本地化版本 - 原内联样式提取
 */

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== 字体定义 ==================== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/Inter-Light.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/Inter-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/Inter-Medium.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/Inter-SemiBold.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/Inter-Bold.woff2') format('woff2');
}

/* ==================== 基础样式 ==================== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8fafc;
    color: #0f172a;
    transition: background 0.2s ease, color 0.2s ease;
}

/* ==================== 深色模式 ==================== */
body.dark {
    background: #0f172a;
    color: #e2e8f0;
}

body.dark .app-sidebar {
    background: #111827;
    border-right-color: #1f2937;
}

body.dark .category-item {
    color: #cbd5e1;
}

body.dark .category-item.active {
    background: #1e293b;
    color: #60a5fa;
    border-left-color: #3b82f6;
}

body.dark .search-input,
body.dark .lang-select,
body.dark .theme-toggle,
body.dark .recent-icon-btn {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark .card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

body.dark .card:hover {
    background: #334155;
    border-color: #475569;
}

body.dark .recent-item {
    background: #1e293b;
    border-color: #334155;
}

body.dark .recent-item:hover {
    background: #334155;
}

body.dark .toast-message,
body.dark .recent-popup {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark .top-bar {
    background-color: rgba(15, 23, 42, 0.85);
    border-bottom-color: rgba(255,255,255,0.05);
}

/* 深色模式下的结果计数 */
body.dark .result-count {
    background: #1e293b;
    color: #94a3b8;
}

/* 深色模式下的分类标题 */
body.dark .category-heading {
    color: #e2e8f0;
    border-bottom-color: #334155;
}

body.dark .category-heading i {
    color: #60a5fa;
}

body.dark .category-count {
    color: #94a3b8;
}

/* 深色模式下的 emoji 名称 */
body.dark .emoji-name {
    color: #cbd5e1;
}

/* 深色模式下的空状态 */
body.dark .empty-state {
    color: #94a3b8;
}

/* 深色模式下的搜索图标 */
body.dark .search-icon {
    color: #64748b;
}

/* 深色模式下的 logo 区域描述文字 */
body.dark .logo-area p {
    color: #94a3b8;
}

/* 深色模式下的加载提示 */
body.dark .loading-trigger {
    color: #94a3b8;
}

/* 深色模式下的页脚 */
body.dark footer {
    color: #64748b;
}

/* ==================== 主布局 ==================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==================== 侧边栏 ==================== */
.app-sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #eef2ff;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: hidden;
    transition: background 0.2s;
    z-index: 20;
}

.logo-area {
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
    flex-shrink: 0;
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-area p {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 4px;
}

/* ==================== 分类菜单 ==================== */
.category-menu {
    flex: 1;
    margin-bottom: 1rem;
    overflow-y: visible;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 1rem;
    margin: 0.2rem 0;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #334155;
    border-left: 3px solid transparent;
}

.category-item i {
    width: 24px;
    font-size: 1.2rem;
}

.category-item:hover {
    background: #f1f5f9;
}

.category-item.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #3b82f6;
}

/* ==================== 最近使用区域 ==================== */
.recent-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    flex-shrink: 0;
}

.recent-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.recent-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    padding: 0.4rem;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
}

.recent-item:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 0 2rem 2rem 2rem;
    min-height: 100vh;
}

/* ==================== 顶部栏 ==================== */
.top-bar {
    position: fixed;
    top: 0;
    right: 0;
    left: 260px;
    background: inherit;
    backdrop-filter: blur(12px);
    background-color: rgba(248, 250, 252, 0.85);
    z-index: 15;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.2s;
}

.content-area {
    margin-top: 80px;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    border-radius: 40px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.top-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.lang-select, .theme-toggle, .recent-icon-btn {
    padding: 0.5rem 1rem;
    border-radius: 40px;
    border: 1px solid #cbd5e1;
    background: white;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==================== 最近使用浮层 ==================== */
.recent-popup {
    position: fixed;
    top: 80px;
    right: 30px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 35px rgba(0,0,0,0.2);
    width: 340px;
    padding: 1rem;
    z-index: 1000;
    border: 1px solid #e2e8f0;
    transition: opacity 0.2s;
}

.recent-popup.hidden {
    display: none;
}

.recent-popup-title {
    font-weight: 600;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.recent-popup-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    overflow: visible;
}

.popup-emoji-item {
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.1s ease;
}

.popup-emoji-item:hover {
    background: #f1f5f9;
    transform: scale(1.08);
}

/* ==================== 结果计数 ==================== */
.result-count {
    font-size: 0.85rem;
    background: #eef2ff;
    color: #475569;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

/* ==================== 分类区块 ==================== */
.category-section {
    margin-bottom: 2rem;
}

.category-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    scroll-margin-top: 100px;
}

.category-heading i {
    color: #3b82f6;
    font-size: 1rem;
}

.category-count {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 400;
    margin-left: auto;
}

/* ==================== Emoji 网格 ==================== */
.emoji-grid-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 100px));
    gap: 1rem;
    margin-top: 0.5rem;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 1rem 0.5rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid #eef2ff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 18px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

.emoji-char {
    font-size: 2.8rem;
    line-height: 1.2;
}

.emoji-name {
    font-size: 0.7rem;
    margin-top: 0.5rem;
    color: #475569;
    font-weight: 500;
    word-break: break-word;
}

/* ==================== 加载指示器 ==================== */
.loading-trigger {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(59,130,246,0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 4rem;
    font-size: 1.1rem;
    color: #64748b;
}

/* ==================== Toast 提示 ==================== */
.toast-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: opacity 0.2s;
    pointer-events: none;
    font-size: 0.85rem;
}

/* ==================== 页脚 ==================== */
footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* ==================== 移动端适配 ==================== */
@media (max-width: 768px) {
    /* 整体布局改为上下结构 */
    .app-layout {
        flex-direction: column;
        min-height: 100vh;
    }
    
    /* 顶部栏固定 */
    .app-sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        border-right: none;
        border-bottom: 1px solid #eef2ff;
        padding: 0.5rem 0.75rem;
        overflow-y: visible;
        z-index: 100;
        background: white;
    }
    
    body.dark .app-sidebar {
        border-bottom-color: #1f2937;
        background: #111827;
    }
    
    .logo-area {
        display: none; /* 移动端隐藏logo节省空间 */
    }
    
    /* 分类菜单横向滚动 */
    .category-menu {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.3rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
    }
    
    .category-menu::-webkit-scrollbar {
        display: none;
    }
    
    .category-item {
        flex: 0 0 auto;
        padding: 0.3rem 0.6rem;
        border-left: none;
        border-radius: 40px;
        font-size: 0.8rem;
        white-space: nowrap;
        margin: 0;
    }
    
    .category-item i {
        width: auto;
        font-size: 0.9rem;
        margin-right: 0.3rem;
    }
    
    .category-item.active {
        background: #3b82f6;
        color: white;
        border-left: none;
    }
    
    body.dark .category-item.active {
        background: #3b82f6;
        color: white;
    }
    
    .recent-section {
        display: none;
    }
    
    /* 主内容区 */
    .main-content {
        margin-left: 0;
        padding: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        padding-top: 50px; /* 给固定顶部栏留空间 */
        padding-bottom: 60px; /* 给底部最近使用留空间 */
    }
    
    /* 搜索栏 */
    .top-bar {
        position: sticky;
        left: 0;
        right: 0;
        top: 0;
        padding: 0.5rem 0.75rem;
        background: inherit;
        flex-wrap: nowrap;
        gap: 0.5rem;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    body.dark .top-bar {
        background-color: rgba(15, 23, 42, 0.95);
        border-bottom-color: rgba(255,255,255,0.05);
    }
    
    .content-area {
        margin-top: 0;
        flex: 1;
        overflow-y: auto;
        padding: 0.75rem;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 隐藏原来的最近使用浮层按钮 */
    .recent-icon-btn {
        display: none;
    }
    
    /* 底部固定最近使用栏 */
    .recent-popup {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        border-radius: 0;
        border-top: 1px solid #e2e8f0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
        padding: 0.5rem 0.75rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        max-height: 60px;
    }
    
    .recent-popup.hidden {
        display: none;
    }
    
    body.dark .recent-popup {
        background: #1e293b;
        border-color: #334155;
    }
    
    .recent-popup-title {
        font-size: 0.75rem;
        font-weight: 600;
        color: #64748b;
        white-space: nowrap;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
        flex-shrink: 0;
    }
    
    body.dark .recent-popup-title {
        color: #94a3b8;
    }
    
    .recent-popup-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.4rem;
        flex: 1;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .recent-popup-list::-webkit-scrollbar {
        display: none;
    }
    
    .popup-emoji-item {
        font-size: 1.6rem;
        padding: 0.2rem 0.4rem;
        background: #f1f5f9;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    body.dark .popup-emoji-item {
        background: #334155;
    }
    
    .category-heading {
        scroll-margin-top: 110px;
        margin-top: 0.5rem;
        font-size: 1rem;
        padding-bottom: 0.4rem;
    }
    
    /* 移动端深色模式下的搜索框 */
    body.dark .search-input:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 2px rgba(96,165,250,0.2);
    }
    
    /* 移动端 emoji 网格优化 */
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        gap: 0.4rem;
    }
    
    .card {
        padding: 0.5rem 0.25rem;
        border-radius: 12px;
    }
    
    .emoji-char {
        font-size: 1.8rem;
    }
    
    .emoji-name {
        font-size: 0.6rem;
        margin-top: 0.2rem;
    }
    
    /* 移动端顶部操作按钮优化 */
    .top-actions {
        gap: 0.4rem;
        flex-shrink: 0;
    }
    
    .lang-select, .theme-toggle {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
        border-radius: 40px;
    }
    
    /* 移动端搜索框优化 */
    .search-wrapper {
        max-width: none;
        flex: 1;
    }
    
    .search-input {
        padding: 0.5rem 0.75rem 0.5rem 2rem;
        font-size: 0.9rem;
    }
    
    .search-icon {
        left: 0.75rem;
    }
    
    /* 移动端 Toast 位置调整 - 在底部栏上方 */
    .toast-message {
        bottom: 70px;
        font-size: 0.8rem;
        padding: 8px 16px;
    }
    
    /* 移动端结果计数 */
    .result-count {
        font-size: 0.75rem;
        padding: 0.2rem 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    /* 移动端页脚 */
    footer {
        font-size: 0.65rem;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }
}
