/* ============================================================
   导航系统重设计 - 现代医疗美学
   ============================================================ */

/* ==================== 侧边栏导航 - 深度优化 ==================== */

/* 导航容器 */
body.dark-mode .sidebar-nav {
    padding: var(--premium-space-lg) 0;
}

/* 导航项基础样式 */
body.dark-mode .nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    margin: 4px 16px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-decoration: none;
}

/* 左侧激活指示条 */
body.dark-mode .nav-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, #4096ff 0%, #00d4aa 100%);
    border-radius: 0 2px 2px 0;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 悬停状态 */
body.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

/* 激活状态 */
body.dark-mode .nav-item.active {
    background: linear-gradient(90deg, rgba(64, 150, 255, 0.15) 0%, rgba(64, 150, 255, 0.05) 100%);
    color: #ffffff;
}

body.dark-mode .nav-item.active::after {
    height: 60%;
}

/* 图标容器 - 深色方形设计 */
body.dark-mode .nav-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
}

/* SVG图标样式 */
body.dark-mode .nav-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    color: rgba(255, 255, 255, 0.55);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 悬停状态 */
body.dark-mode .nav-item:hover .nav-icon {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .nav-item:hover .nav-icon svg {
    color: rgba(255, 255, 255, 0.85);
}

/* 激活状态 - 渐变色 */
body.dark-mode .nav-item.active .nav-icon {
    background: linear-gradient(135deg, rgba(64, 150, 255, 0.15) 0%, rgba(0, 212, 170, 0.1) 100%);
    border-color: rgba(64, 150, 255, 0.3);
    box-shadow: 0 0 12px rgba(64, 150, 255, 0.2);
}

body.dark-mode .nav-item.active .nav-icon svg {
    color: #4096ff;
}

/* 图标微动画 */
@keyframes icon-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

body.dark-mode .nav-item.active .nav-icon svg {
    animation: icon-pulse 2s ease-in-out infinite;
}

/* 导航文字 */
body.dark-mode .nav-text {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* 徽章指示器 */
body.dark-mode .nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--premium-error);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode .nav-badge:not(:empty) {
    opacity: 1;
    transform: scale(1);
}

/* ==================== 位置状态卡片重设计 ==================== */

body.dark-mode .device-location-card {
    background: linear-gradient(135deg, rgba(20, 24, 36, 0.9) 0%, rgba(15, 18, 28, 0.9) 100%);
    backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* 顶部装饰线 */
body.dark-mode .device-location-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #4096ff 50%, transparent 100%);
}

body.dark-mode .dlc-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Emoji图标容器 - 大号设计 */
body.dark-mode .dlc-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    flex-shrink: 0;
    position: relative;
}

/* 图标光晕效果 */
body.dark-mode .dlc-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, rgba(64, 150, 255, 0.1) 0%, rgba(0, 212, 170, 0.05) 100%);
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.dark-mode .device-location-card:hover .dlc-icon::after {
    opacity: 1;
}

body.dark-mode .dlc-info {
    flex: 1;
    min-width: 0;
}

body.dark-mode .dlc-address {
    font-size: 17px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 8px;
    line-height: 1.4;
}

body.dark-mode .dlc-coords {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* ==================== 导航模式选择器 ==================== */

body.dark-mode .nav-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.dark-mode .nav-mode-tabs {
    display: flex;
    gap: 10px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 导航模式按钮 - 胶囊设计 */
body.dark-mode .nav-mode-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 24px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

body.dark-mode .nav-mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
}

body.dark-mode .nav-mode-btn.active {
    background: linear-gradient(135deg, #4096ff 0%, #1677ff 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(64, 150, 255, 0.4),
                0 2px 8px rgba(64, 150, 255, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* 开始导航按钮 */
body.dark-mode .btn-nav-start {
    width: 100%;
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #4096ff 0%, #1677ff 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(64, 150, 255, 0.3);
    position: relative;
    overflow: hidden;
}

body.dark-mode .btn-nav-start::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

body.dark-mode .btn-nav-start:hover:not(:disabled)::before {
    left: 100%;
}

body.dark-mode .btn-nav-start:hover:not(:disabled) {
    background: linear-gradient(135deg, #69b1ff 0%, #4096ff 100%);
    box-shadow: 0 6px 24px rgba(64, 150, 255, 0.5);
    transform: translateY(-2px);
}

body.dark-mode .btn-nav-start:active:not(:disabled) {
    transform: translateY(0);
}

body.dark-mode .btn-nav-start:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    box-shadow: none;
}

body.dark-mode .btn-nav-start.is-cancel {
    background: linear-gradient(135deg, #ff9c6e 0%, #ff7a45 100%);
    box-shadow: 0 4px 18px rgba(255, 122, 69, 0.28);
}

body.dark-mode .nav-control-tip {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.48);
    margin-top: 10px;
    padding: 0 2px;
}

body.dark-mode .nav-active-panel {
    margin-top: 12px;
    background: linear-gradient(180deg, rgba(64, 150, 255, 0.12) 0%, rgba(10, 18, 36, 0.92) 100%);
    border: 1px solid rgba(64, 150, 255, 0.18);
    border-radius: 18px;
    padding: 16px;
}

body.dark-mode .nav-active-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

body.dark-mode .nav-active-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

body.dark-mode .nav-active-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.58);
}

body.dark-mode .nav-mode-badge {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(64, 150, 255, 0.18);
    border: 1px solid rgba(64, 150, 255, 0.28);
    color: #8fc2ff;
    font-size: 12px;
    font-weight: 600;
}

body.dark-mode .nav-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

body.dark-mode .btn-nav-secondary,
body.dark-mode .nav-actions .btn-nav-stop {
    width: 100%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

body.dark-mode .btn-nav-secondary {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.78);
}

body.dark-mode .btn-nav-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .nav-actions .btn-nav-stop {
    border: 1px solid rgba(255, 77, 79, 0.3);
    background: rgba(255, 77, 79, 0.12);
    color: #ff7875;
}

body.dark-mode .nav-controls.is-active {
    display: none;
}

@media (max-width: 768px) {
    body.dark-mode .nav-actions {
        grid-template-columns: 1fr;
    }
}

/* Layout guard: keep the map, turn prompt and bottom sheet from covering each other. */
body.dark-mode .location-container {
    height: calc(100vh - 132px);
    min-height: 680px;
    overflow: hidden;
}

body.dark-mode .map-container {
    height: 100%;
    min-height: 680px;
}

body.dark-mode .nav-turn-bar {
    top: 12px;
    left: 16px;
    right: auto;
    width: min(66vw, 1120px);
    min-height: 64px;
    border-radius: 14px;
    z-index: 112;
}

body.dark-mode .map-search-bar {
    top: 18px;
    left: 18px;
    right: auto;
    width: min(560px, calc(100% - 112px));
    z-index: 111;
}

body.dark-mode .map-weather {
    top: 18px;
    right: 82px;
    z-index: 111;
}

body.dark-mode .map-toolbar {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 113;
}

body.dark-mode .map-bottom-panel {
    left: 24px;
    right: 24px;
    bottom: 8px;
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(520px, 1.55fr);
    align-items: stretch;
    gap: 14px;
    padding: 14px;
    max-height: 38vh;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(9, 15, 30, 0.86);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
    z-index: 110;
}

body.dark-mode .device-location-card {
    min-width: 0;
    margin: 0;
    padding: 14px 16px;
    display: flex;
    align-items: center;
}

body.dark-mode .device-location-card .dlc-header {
    width: 100%;
}

body.dark-mode .dlc-info {
    min-width: 0;
}

body.dark-mode .dlc-address {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .dlc-coords {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .nav-controls,
body.dark-mode .nav-active-panel {
    min-width: 0;
}

body.dark-mode .nav-active-panel {
    margin: 0;
    padding: 14px 16px;
}

body.dark-mode .nav-active-header {
    margin-bottom: 10px;
}

body.dark-mode .nav-stats {
    display: grid;
    grid-template-columns: minmax(120px, 0.85fr) minmax(140px, 1fr) minmax(220px, 1.4fr);
    gap: 10px;
    margin-bottom: 12px;
}

body.dark-mode .nav-stat {
    min-width: 0;
    padding: 0 6px;
}

body.dark-mode .nav-stat-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .nav-stat-route .nav-stat-value {
    font-size: 12px !important;
}

body.dark-mode .nav-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.dark-mode .btn-nav-secondary,
body.dark-mode .nav-actions .btn-nav-stop {
    padding: 10px 14px;
    min-height: 44px;
}

@media (max-width: 1180px) {
    body.dark-mode .location-container {
        min-height: 760px;
    }

    body.dark-mode .map-bottom-panel {
        grid-template-columns: 1fr;
        max-height: 46vh;
        overflow-y: auto;
    }

    body.dark-mode .nav-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.dark-mode .nav-stat-route {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    body.dark-mode .location-container {
        height: calc(100vh - 96px);
        min-height: 640px;
    }

    body.dark-mode .map-container {
        min-height: 640px;
    }

    body.dark-mode .nav-turn-bar {
        left: 12px;
        right: 12px;
        width: auto;
    }

    body.dark-mode .map-bottom-panel {
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-height: 52vh;
        padding: 12px;
    }

    body.dark-mode .nav-stats,
    body.dark-mode .nav-actions {
        grid-template-columns: 1fr;
    }
}
