/* 移动端工具箱样式 */

/* 基础重置和变量 */
:root {
    --primary-color: #6C5CE7;
    --secondary-color: #00CEFF;
    --accent-color: #FF2E63;
    --dark-bg: #0f0c29;
    --sidebar-bg: #1a1a2e;
    --card-bg: rgba(30, 28, 44, 0.8);
    --header-height: 60px;
    --bottom-nav-height: 60px;
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #302b63 50%, #24243e 100%);
    color: #e0e0ff;
    min-height: 100vh;
    overflow-x: hidden;
    transition: all 0.3s ease;
    padding-top: var(--header-height);
    padding-bottom: var(--bottom-nav-height);
}

/* 浅色主题 */
.light-mode {
    --dark-bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%) !important;
    color: #334155 !important;
}

.light-mode .mobile-header {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #334155 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.light-mode .sidebar {
    background: rgba(255, 255, 255, 0.98) !important;
    color: #334155 !important;
}

.light-mode .tool-card {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #334155 !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.light-mode .bottom-nav {
    background: rgba(255, 255, 255, 0.95) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* 顶部固定搜索栏 */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.menu-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 32px;
    height: 32px;
    justify-content: center;
    align-items: center;
}

.menu-toggle:hover {
    background: rgba(108, 92, 231, 0.2);
}

.hamburger {
    width: 18px;
    height: 2px;
    background: currentColor;
    transition: all 0.3s ease;
    border-radius: 1px;
}

.menu-toggle.active .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.menu-toggle.active .hamburger:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

.search-container {
    flex: 1;
    max-width: none;
}

.search-wrapper {
    position: relative;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(0, 206, 255, 0.1));
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.search-wrapper.focused {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

.search-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 8px 35px 8px 35px;
    color: inherit;
    font-size: 14px;
    border-radius: 20px;
}

.search-input::placeholder {
    color: rgba(224, 224, 255, 0.5);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(108, 92, 231, 0.8);
    font-size: 14px;
}

.clear-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.clear-button.show {
    opacity: 1;
    visibility: visible;
}

.settings-btn {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(0, 206, 255, 0.1));
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(0, 206, 255, 0.2));
    transform: scale(1.05);
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(26, 26, 46, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.close-sidebar {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.close-sidebar:hover {
    background: rgba(255, 255, 255, 0.1);
}

.category-list {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
}

.category-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    margin: 20px 0 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.category-item {
    margin-bottom: 8px;
}

.category-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(0, 206, 255, 0.1));
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.category-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(0, 206, 255, 0.2));
    transform: translateX(3px);
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(0, 206, 255, 0.1));
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 12px;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.theme-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(0, 206, 255, 0.2));
}

.desktop-switch {
    margin-top: 10px;
}

.desktop-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(255, 99, 71, 0.1), rgba(255, 140, 0, 0.1));
    border: 1px solid rgba(255, 99, 71, 0.3);
    border-radius: 12px;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.desktop-btn:hover {
    background: linear-gradient(135deg, rgba(255, 99, 71, 0.2), rgba(255, 140, 0, 0.2));
    border-color: rgba(255, 99, 71, 0.5);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 主要内容 */
.main-content {
    padding: 20px 15px;
    min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
}

.category-header {
    margin-bottom: 20px;
    text-align: center;
}

.category-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tools-count {
    font-size: 14px;
    color: rgba(224, 224, 255, 0.7);
}

/* 工具网格 - 一行三个 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

/* 工具卡片 */
.tool-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    height: 140px;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.2);
    border-color: rgba(108, 92, 231, 0.5);
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tool-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.favorite-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 12px;
}

.favorite-btn:hover {
    color: #FFD700;
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #FFD700;
}

.tool-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tool-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-description {
    font-size: 11px;
    color: rgba(224, 224, 255, 0.7);
    line-height: 1.3;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
}

.use-tool-btn {
    width: 100%;
    padding: 6px 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.use-tool-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: rgba(224, 224, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 10px;
    padding: 8px 4px;
}

.nav-item i {
    font-size: 16px;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item:hover {
    color: rgba(224, 224, 255, 0.9);
}

/* 搜索建议 */
.search-suggestions {
    position: absolute;
    top: var(--header-height);
    left: 15px;
    right: 15px;
    background: var(--card-bg);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestions.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.suggestion-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(108, 92, 231, 0.1);
}

.suggestion-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.3), rgba(0, 206, 255, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.suggestion-text {
    flex: 1;
}

.suggestion-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.suggestion-desc {
    font-size: 12px;
    color: rgba(224, 224, 255, 0.6);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 48px;
    color: rgba(224, 224, 255, 0.3);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: rgba(224, 224, 255, 0.8);
}

.empty-state p {
    font-size: 14px;
    color: rgba(224, 224, 255, 0.6);
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 20px;
}

.load-more-btn {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(0, 206, 255, 0.2));
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 12px;
    padding: 12px 24px;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.load-more-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.3), rgba(0, 206, 255, 0.3));
}

/* 响应式调整 */
@media (max-width: 360px) {
    .tools-grid {
        gap: 8px;
    }
    
    .tool-card {
        padding: 10px;
        height: 130px;
    }
    
    .tool-name {
        font-size: 12px;
    }
    
    .tool-description {
        font-size: 10px;
    }
    
    .use-tool-btn {
        font-size: 10px;
        padding: 5px 6px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.5);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 92, 231, 0.7);
}