/* ========================================
   KeyGoto Layout - 全屏布局修复版
   ======================================== */

:root {
    --primary: #4F6EF7;
    --primary-hover: #3B5DE7;
    --primary-light: #EEF2FF;
    --bg-page: #F8FAFC;
    --bg-white: #FFFFFF;
    --text-main: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border-light: #E2E8F0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text-main);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

.top-header {
    height: 56px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    padding: 0 16px;
}

.flex.flex-1.overflow-hidden {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#mainContent {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.tool-page {
    width: 100%;
    min-height: 100%;
    padding: 24px 32px;
    margin: 0;
}

@media (max-width: 1024px) {
    .tool-page {
        padding: 20px 24px;
    }
}

/* Logo 移动端适配 */
@media (max-width: 768px) {
    .top-header a img {
        height: 30px !important;
    }
}

@media (max-width: 480px) {
    .top-header a img {
        height: 28px !important;
    }
}

/* 搜索框容器 - 必须相对定位 */
.global-search-box {
    position: relative;
    background: #F1F5F9;
    border-radius: 32px;
    padding: 0 16px;
    transition: all 0.2s;
    border: 1.5px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.global-search-box:focus-within {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.08);
}

.global-search-input {
    background: transparent;
    border: none;
    padding: 10px 0;
    font-size: 14px;
    outline: none;
    color: var(--text-main);
    flex: 1;
    min-width: 0;
}

.global-search-input::placeholder {
    color: var(--text-muted);
}

/* 搜索下拉框 - 固定在搜索框下方 */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 300;
    border: 1px solid var(--border-light);
}

/* 移动端：限制高度，不占满全屏 */
@media (max-width: 768px) {
    .search-suggestions {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        max-height: 300px;
        max-width: none;
        width: auto;
    }
}

.search-suggestions .suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--text-main);
    border-bottom: 1px solid #F1F5F9;
}

.search-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestions .suggestion-item:hover {
    background: var(--primary-light);
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.user-btn {
    font-weight: 500;
    transition: all 0.2s;
}

.user-btn:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-1px);
}

.nav-link-text,
.user-btn-text {
    display: inline;
}

.nav-link-icon {
    display: none;
}

@media (max-width: 1023px) and (min-width: 769px) {
    .nav-link-text,
    .user-btn-text {
        font-size: 13px;
    }
    .top-header {
        padding: 0 12px;
    }
}

@media (max-width: 768px) {
    .nav-link-text,
    .user-btn-text {
        display: none;
    }
    
    .nav-link-icon {
        display: inline-block;
        vertical-align: middle;
    }
    
    .user-btn {
        background: var(--primary) !important;
        padding: 8px !important;
        border-radius: 50% !important;
        width: 36px;
        height: 36px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .user-btn svg {
        width: 18px;
        height: 18px;
        stroke: white;
        margin: 0;
    }
    
    .global-search-box {
        max-width: 160px;
        padding: 0 10px;
    }
    
    .global-search-input {
        font-size: 13px;
        padding: 8px 0;
    }
    
    .top-header {
        padding: 0 8px;
    }
    
    .top-header a[href="/"] span {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .global-search-box {
        max-width: 130px;
    }
    
    .global-search-input::placeholder {
        font-size: 12px;
    }
    
    .top-header a[href="/"] span {
        display: none;
    }
    
    .user-btn {
        width: 32px !important;
        height: 32px !important;
        padding: 6px !important;
    }
    
    .user-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
}

.top-header svg {
    vertical-align: middle;
}

.breadcrumb-container {
    background: transparent;
    margin-bottom: 8px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.breadcrumb a,
.breadcrumb span {
    font-size: 13px;
}

.breadcrumb a {
    text-decoration: none;
}

@media (max-width: 640px) {
    .breadcrumb-container {
        margin-bottom: 4px;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    .breadcrumb a,
    .breadcrumb span {
        font-size: 11px;
    }
}