/* ===== 17Nav Main CSS ===== */

:root {
    /* 主色调 - Indigo (PWOS Product 风格) */
    --sidebar-gradient: linear-gradient(180deg, #1e1b4b 0%, #312e81 40%, #3730a3 100%);
    --accent: #a5b4fc;
    --accent-dim: rgba(165, 180, 252, 0.08);
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #a5b4fc;
    --sidebar-group-text: #818cf8;

    /* 亮色模式 */
    --bg: #f0f2f5;
    --card-bg: #f8fafc;
    --card-border: #e2edf2;
    --card-radius: 1.2rem;
    --container-bg: white;
    --container-radius: 2rem;
    --text: #1e293b;
    --text-muted: #64748b;

    /* Pill 标签 */
    --pill-green: #15803d;
    --pill-green-bg: #e0f2e9;
    --pill-red: #b91c1c;
    --pill-red-bg: #fee2e2;
    --pill-yellow: #b45309;
    --pill-yellow-bg: #ffedd5;
    --pill-blue: #1e40af;
    --pill-blue-bg: #dbeafe;

    /* 布局 */
    --sidebar-width: 270px;
    --transition: 0.2s ease;
    --font: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ===== 背景层 ===== */
.background-layer {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: -2;
    background-size: var(--bg-size, cover);
    background-position: var(--bg-position, center);
    background-repeat: no-repeat;
    filter: blur(var(--bg-blur, 0px));
    transition: filter 0.3s ease;
}
.background-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: var(--bg);
    opacity: var(--bg-opacity-val, 0);
    transition: opacity 0.3s ease;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--sidebar-gradient);
    color: var(--sidebar-text);
    overflow-y: auto;
    padding: 1.5rem 0;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #4338ca; border-radius: 4px; }

.sidebar-header {
    padding: 0 1.2rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 0.8rem;
}
.sidebar-header h2 {
    font-size: 1.15rem; color: #fff; font-weight: 700;
    letter-spacing: 0.5px; margin-bottom: 0.2rem;
}
.sidebar-header .ver {
    font-size: 0.75rem; color: var(--accent); font-weight: 500;
}

.sidebar-group { margin-bottom: 0.6rem; }
.sidebar-group-title {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--sidebar-group-text); padding: 0.5rem 1.2rem 0.3rem; font-weight: 600;
}
.sidebar a {
    display: block; padding: 0.35rem 1.2rem 0.35rem 1.5rem;
    color: var(--sidebar-text); text-decoration: none; font-size: 0.82rem;
    border-left: 3px solid transparent; transition: all 0.15s;
    line-height: 1.5;
}
.sidebar a:hover {
    color: #e2e8f0; background: rgba(255,255,255,0.05);
    border-left-color: var(--accent);
}
.sidebar a.active {
    color: var(--sidebar-text-active); background: var(--accent-dim);
    border-left-color: var(--accent); font-weight: 600;
}

/* ===== Main Content ===== */
.main-wrap {
    margin-left: var(--sidebar-width); flex: 1; padding: 2rem 1.5rem;
    min-width: 0;
}
.container {
    max-width: 1060px; margin: 0 auto; background: var(--container-bg);
    border-radius: var(--container-radius);
    box-shadow: 0 20px 35px -12px rgba(0,0,0,0.1);
    overflow: hidden; padding: 2rem;
}

/* ===== Search Bar ===== */
.search-bar {
    display: flex; gap: 0.5rem; margin-bottom: 2rem;
    position: relative;
}
.search-engine select {
    padding: 0.6rem 0.8rem; border: 1px solid var(--card-border);
    border-radius: 0.8rem 0 0 0.8rem; background: var(--card-bg);
    color: var(--text); font-size: 0.85rem; cursor: pointer;
    transition: var(--transition);
}
.search-engine select:hover { border-color: var(--accent); }
#search-input {
    flex: 1; padding: 0.6rem 1rem; border: 1px solid var(--card-border);
    border-radius: 0; background: var(--card-bg); color: var(--text);
    font-size: 0.9rem; outline: none; transition: var(--transition);
}
#search-input:focus { border-color: var(--accent); }
#search-btn {
    padding: 0.6rem 1.2rem; border: none; border-radius: 0 0.8rem 0.8rem 0;
    background: var(--sidebar-bg); color: white; cursor: pointer;
    font-size: 1rem; transition: var(--transition);
}
#search-btn:hover { background: var(--accent); color: var(--sidebar-bg); }

/* 悬浮搜索结果 */
.search-results {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--container-bg); border-radius: 0.8rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15);
    max-height: 400px; overflow-y: auto; z-index: 50;
    animation: fadeInUp 0.2s ease;
}
.search-results.show { display: block; }
.search-result-item {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.6rem 1rem; cursor: pointer;
    border-bottom: 1px solid var(--card-border); transition: var(--transition);
}
.search-result-item:hover { background: var(--accent-dim); }
.search-result-item img { width: 24px; height: 24px; border-radius: 4px; }
.search-result-item .name { font-weight: 600; font-size: 0.9rem; }
.search-result-item .desc { font-size: 0.75rem; color: var(--text-muted); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Widgets (时钟/天气) ===== */
.widgets {
    display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.widget {
    flex: 1; min-width: 200px; background: var(--card-bg);
    border-radius: var(--card-radius); padding: 1rem 1.2rem;
    border: 1px solid var(--card-border);
}
.widget-title {
    font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
    margin-bottom: 0.6rem; text-transform: uppercase; letter-spacing: 1px;
}

/* ===== 世界时钟地图 (Leaflet) ===== */
.clock-map-container {
    position: relative; width: 100%; border-radius: 0.8rem; overflow: hidden;
    margin-top: 0.5rem;
}
.clock-map {
    position: relative; width: 100%; height: 220px;
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 0.6rem;
    overflow: hidden;
    z-index: 1;
}
/* Leaflet 暗色适配 */
.clock-map .leaflet-container {
    background: #1e1b4b !important;
    font-family: var(--font) !important;
}
.clock-map .leaflet-control-zoom {
    border: 1px solid rgba(165,180,252,0.3) !important;
    background: rgba(30,27,75,0.92) !important;
}
.clock-map .leaflet-control-zoom a {
    background: transparent !important;
    color: #a5b4fc !important;
    border-color: rgba(165,180,252,0.2) !important;
}
.clock-map .leaflet-control-zoom a:hover {
    background: rgba(49,46,129,0.8) !important;
}
/* 气泡框 */
.clock-tooltip {
    background: rgba(30,27,75,0.92) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(165,180,252,0.3) !important;
    border-radius: 0.5rem !important;
    padding: 0.3rem 0.6rem !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    white-space: nowrap !important;
    opacity: 1 !important;
}
.clock-tooltip::before {
    border-right-color: rgba(30,27,75,0.92) !important;
}
.clock-bubble-leaflet {
    text-align: center;
}
.clock-bubble-city {
    font-size: 0.7rem; color: #a5b4fc; font-weight: 600;
}
.clock-bubble-time {
    font-size: 0.85rem; color: #fff; font-weight: 700;
    font-variant-numeric: tabular-nums; line-height: 1.2;
}
.clock-bubble-date {
    font-size: 0.65rem; color: #c7d2fe;
}

/* ===== 天气增强版 ===== */
.weather-list {
    display: flex; flex-direction: column; gap: 0.8rem;
}
.weather-item {
    padding: 0.6rem 0.8rem; border-radius: 0.6rem;
    background: rgba(99,102,241,0.04); border: 1px solid rgba(99,102,241,0.1);
}
.weather-city {
    font-size: 0.8rem; font-weight: 600; color: var(--text);
    margin-bottom: 0.3rem;
}
.weather-main {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    margin-bottom: 0.3rem;
}
.weather-icon { font-size: 1.1rem; }
.weather-type { font-size: 0.8rem; color: var(--text-muted); }
.weather-temp { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.weather-temp-range { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.weather-details {
    display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.3rem;
}
.weather-detail {
    font-size: 0.7rem; color: var(--text-muted);
    padding: 0.15rem 0.4rem; border-radius: 0.3rem;
    background: rgba(99,102,241,0.06);
}

/* ===== Bookmark Grid ===== */
.bookmark-section { margin-bottom: 2rem; }
.bookmark-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.bookmark-card {
    background: var(--card-bg); border-radius: var(--card-radius);
    padding: 1rem; border: 1px solid var(--card-border);
    text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer; position: relative;
    animation: cardFadeIn 0.3s ease backwards;
}
.bookmark-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px -5px rgba(0,0,0,0.15);
    border-color: var(--accent);
}
.bookmark-card:active { transform: translateY(-2px); }
.bookmark-card .icon {
    width: 36px; height: 36px; border-radius: 8px;
    object-fit: contain; transition: transform 0.2s ease;
}
.bookmark-card:hover .icon { transform: scale(1.1); }
.bookmark-card .icon-placeholder {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem; color: white;
}
.bookmark-card .name { font-size: 0.82rem; font-weight: 600; text-align: center; }
.bookmark-card .desc-tooltip {
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    background: #1e293b; color: #e2e8f0; padding: 0.4rem 0.8rem;
    border-radius: 0.5rem; font-size: 0.75rem; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
    margin-bottom: 0.4rem; z-index: 10;
}
.bookmark-card:hover .desc-tooltip { opacity: 1; }

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Bottom Bar ===== */
.bottom-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--card-border);
    flex-wrap: wrap; gap: 1rem;
}
.tag-cloud {
    display: flex; gap: 0.4rem; flex-wrap: wrap;
}
.tag-pill {
    padding: 0.2rem 0.6rem; border-radius: 30px; font-size: 0.72rem;
    font-weight: 600; cursor: pointer; transition: var(--transition);
}
.tag-pill:hover { transform: translateY(-2px) scale(1.05); }
.tag-pill.green { color: var(--pill-green); background: var(--pill-green-bg); }
.tag-pill.red { color: var(--pill-red); background: var(--pill-red-bg); }
.tag-pill.yellow { color: var(--pill-yellow); background: var(--pill-yellow-bg); }
.tag-pill.blue { color: var(--pill-blue); background: var(--pill-blue-bg); }

.graph-btn {
    padding: 0.5rem 1rem; border: 1px solid var(--card-border);
    border-radius: 0.8rem; background: var(--card-bg); color: var(--text);
    cursor: pointer; font-size: 0.85rem; transition: var(--transition);
}
.graph-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Mobile Menu Toggle ===== */
.mobile-menu-btn { display: none; }
