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

html, body {
    width: 100%;
    height: 100%;
    font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 头部导航栏样式 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #ffffff;
    color: rgb(0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-bottom: 1px solid #9e9e9e;
}

.header-left {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgb(0, 0, 0);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.nav-tabs {
    display: flex;
    height: 100%;
}

.nav-tab {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 100%;
    transition: background-color 0.3s;
    position: relative;
}

.nav-tab:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-tab.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #8ab4f8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 6px 15px;
    width: 250px;
}

.search-box input {
    background: none;
    border: none;
    color: white;
    outline: none;
    width: 100%;
    padding-right: 10px;
    font-size: 14px;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-box .fa-search {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.3s;
}

.user-avatar:hover {
    transform: scale(1.1);
}

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

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100%;
    background-color: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 99;
    padding-top: 60px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid #eaeaea;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.sidebar-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.sidebar-section {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.section-title {
    padding: 10px 20px;
    color: #666;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #333;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #f5f5f5;
}

.menu-item i {
    width: 24px;
    margin-right: 10px;
    text-align: center;
    color: #4a6491;
}

/* 主内容区域样式 */
.main-content {
    margin-top: 60px;
    padding: 12px 20px;
    transition: margin-left 0.3s ease;
}

.main-content.sidebar-active {
    margin-left: 240px;
}

.tools-section {
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #eaeaea;
}

.section-heading {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    font-weight: bold;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

/* 常用工具样式 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.tool-card {
    background-color: white;
    border-radius: 6px;
    padding: 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #eaeaea;
}

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

.tool-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 1.2rem;
    color: white;
}

.calculator-icon {
    background-color: #4a90e2;
}

.exchange-icon {
    background-color: #50c878;
}

.timer-icon {
    background-color: #9c59b6;
}

.json-icon {
    background-color: #e67e22;
}

.code-icon {
    background-color: #3498db;
}

.api-icon {
    background-color: #f1c40f;
}

.tool-info {
    flex: 1;
}

.tool-info h3 {
    font-size: 1rem;
    margin-bottom: 3px;
    color: #333;
}

.tool-info p {
    font-size: 0.8rem;
    color: #666;
}

.tool-usage {
    font-size: 0.75rem;
    color: #999;
    margin-top: 3px;
}

/* 游戏区域样式 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.game-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid #eaeaea;
}

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

.game-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.game-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-info {
    padding: 10px;
}

.game-info h3 {
    font-size: 0.9rem;
    margin-bottom: 3px;
    color: #333;
}

.game-info p {
    font-size: 0.8rem;
    color: #666;
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
    display: none;
}

.overlay.active {
    display: block;
}

/* iframe容器样式 */
.iframe-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: white;
    z-index: 97;
    display: none;
    flex-direction: column;
    transition: all 0.3s ease;
}

.iframe-container.active {
    display: flex;
}

.iframe-header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background-color: #f4f6f8;
    border-bottom: 1px solid #e0e0e0;
}

.iframe-close {
    background: none;
    border: none;
    color: #4a6491;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.iframe-close:hover {
    background-color: rgba(74, 100, 145, 0.1);
}

.iframe-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
    margin-left: 20px;
    flex: 1;
}

.content-frame {
    flex: 1;
    border: none;
    width: 100%;
    height: 100%;
}

/* 左侧侧边栏显示时的iframe容器适配 */
.sidebar.active ~ .iframe-container.active {
    left: 240px;
}

.main-content.sidebar-active ~ .iframe-container.active {
    left: 240px;
}

/* 空状态占位符样式 */
.empty-placeholder {
    padding: 50px 20px;
    margin: 40px auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
    max-width: 600px;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.placeholder-content i {
    font-size: 4rem;
    color: #4a6491;
    margin-bottom: 20px;
    opacity: 0.6;
}

.placeholder-content h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.placeholder-content p {
    color: #666;
    font-size: 1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-tabs {
        display: none;
    }
    
    .search-box {
        width: 180px;
    }
    
    .sidebar.active ~ .iframe-container.active,
    .main-content.sidebar-active ~ .iframe-container.active {
        left: 0;
    }
}

@media (max-width: 576px) {
    .header {
        padding: 0 10px;
    }
    
    .search-box {
        display: none;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .tools-grid, .games-grid {
        grid-template-columns: 1fr;
    }
}