/* ==================== 基础变量和重置 ==================== */
:root {
    /* 深色主题（默认） */
    --bg-primary: #0d0d12;
    --bg-secondary: #151520;
    --bg-card: #1c1c28;
    --bg-card-hover: #252535;
    --text-primary: #ffffff;
    --text-secondary: #8a8a9a;
    --text-muted: #5a5a6a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);
    
    /* 强调色 */
    --accent-green: #00d4aa;
    --accent-green-light: #00f5c4;
    --accent-blue: #4a9eff;
    --accent-red: #ff4757;
    --accent-orange: #ffa502;
    --accent-yellow: #ffd93d;
    
    /* 渐变 */
    --gradient-green: linear-gradient(135deg, #00d4aa, #00b894);
    --gradient-blue: linear-gradient(135deg, #4a9eff, #2d7dd2);
    --gradient-red: linear-gradient(135deg, #ff4757, #ff6b7a);
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow-green: 0 0 20px rgba(0, 212, 170, 0.3);
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* 浅色主题 */
[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f2f5;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.04);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==================== 背景效果 ==================== */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(0, 212, 170, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(74, 158, 255, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] .bg-gradient {
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(74, 158, 255, 0.06) 0%, transparent 50%);
}

/* ==================== 容器布局 ==================== */
.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.content-wrapper {
    flex: 1;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
}

@media (min-width: 768px) {
    .content-wrapper {
        max-width: 560px;
        padding: 32px 24px;
    }
}

@media (min-width: 1024px) {
    .content-wrapper {
        max-width: 640px;
        padding: 40px 24px;
    }
}

/* ==================== 登录页面样式 ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 36px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: var(--gradient-green);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow-green);
}

.login-logo .icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.login-logo p {
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Space Mono', monospace;
    letter-spacing: 3px;
    text-align: center;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.form-input::placeholder {
    letter-spacing: 2px;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    width: 100%;
    background: var(--gradient-green);
    color: #0d0d12;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-green);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.error-message {
    color: var(--accent-red);
    font-size: 13px;
    text-align: center;
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.error-message.show {
    opacity: 1;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--accent-green);
}

/* ==================== 仪表盘头部 ==================== */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

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

.last-update {
    font-size: 13px;
    color: var(--text-secondary);
}

.refresh-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* 主题切换按钮 */
.theme-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    width: 18px;
    height: 18px;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme]) .theme-toggle .icon-moon {
    display: none;
}

/* GPS状态 */
.gps-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
}

.gps-status.connected {
    color: var(--accent-green);
    border-color: rgba(0, 212, 170, 0.3);
    background: rgba(0, 212, 170, 0.1);
}

.gps-status svg {
    width: 14px;
    height: 14px;
}

/* ==================== 主信息区域 ==================== */
.main-info {
    text-align: center;
    margin-bottom: 20px;
}

.range-display {
    margin-bottom: 16px;
}

.range-value {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: -3px;
    line-height: 1;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.range-unit {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

.battery-bar {
    max-width: 180px;
    margin: 0 auto 12px;
}

.battery-track {
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.battery-fill {
    height: 100%;
    background: var(--gradient-green);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.battery-fill.low {
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow));
}

.battery-fill.critical {
    background: linear-gradient(90deg, var(--accent-red), var(--accent-orange));
}

.battery-percent {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-green);
    margin-top: 8px;
}

.odometer {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.odometer span {
    font-family: 'Space Mono', monospace;
}

/* ==================== 汽车模型 ==================== */
.car-container {
    position: relative;
    width: 100%;
    max-width: 180px;
    margin: 0 auto 24px;
}

.car-svg {
    width: 100%;
    height: auto;
}

/* 汽车部件样式 - 简洁线条风格 */
.car-outline, .car-roof {
    fill: none;
    stroke: var(--car-stroke);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

:root {
    --car-stroke: #5a5a6a;
}

[data-theme="light"] {
    --car-stroke: #4a4a5a;
}

.car-window {
    fill: none;
    stroke: var(--car-stroke);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

.car-window.open {
    stroke: var(--accent-red);
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgba(255, 71, 87, 0.6));
}

.car-door {
    fill: none;
    stroke: var(--car-stroke);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

.car-door.open {
    stroke: var(--accent-red);
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgba(255, 71, 87, 0.6));
}

.car-hood, .car-trunk {
    fill: none;
    stroke: var(--car-stroke);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

.car-hood.open, .car-trunk.open {
    stroke: var(--accent-red);
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgba(255, 71, 87, 0.6));
}

/* 大灯光束效果 */
.headlight-beam {
    fill: url(#beamGradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.headlight-beam.on {
    opacity: 1;
}

/* 空调动画 */
.ac-animation {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ac-animation.active {
    opacity: 1;
}

.ac-wave {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 1.5px solid var(--accent-blue);
    border-radius: 50%;
    left: 50%;
    top: 50%;
    animation: acPulse 2s ease-out infinite;
}

.ac-wave:nth-child(2) { animation-delay: 0.5s; }
.ac-wave:nth-child(3) { animation-delay: 1s; }

@keyframes acPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* 胎压显示 */
.tire-pressure {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Space Mono', monospace;
}

.tire-pressure .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.tire-pressure .unit {
    font-size: 20px;
    color: var(--text-secondary);
}

/* 胎压位置 */
.tire-fl { top: 12%; left: -30%; }
.tire-fr { top: 12%; right: -30%; }
.tire-rl { bottom: 2%; left: -30%; }
.tire-rr { bottom: 2%; right: -30%; }

/* ==================== 信息卡片 ==================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all 0.2s ease;
}

.info-card:hover {
    background: var(--bg-card-hover);
}

.info-card.full-width {
    grid-column: span 2;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.card-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.card-icon svg {
    width: 14px;
    height: 14px;
}

.card-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 22px;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
}

.card-unit {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* 温度卡片 */
.temp-card-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.temp-item {
    text-align: center;
    flex: 1;
}

.temp-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.temp-icon svg {
    width: 20px;
    height: 20px;
}

.temp-item.exterior .temp-icon {
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-blue);
}

.temp-item.interior .temp-icon {
    background: rgba(255, 165, 2, 0.15);
    color: var(--accent-orange);
}

.temp-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.temp-value {
    font-size: 18px;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
}

.temp-divider {
    width: 1px;
    height: 50px;
    background: var(--border-color);
    margin: 0 16px;
}

/* 状态指示器 */
.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.status-icon svg {
    width: 20px;
    height: 20px;
}

.status-icon.active {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent-green);
}

.status-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

/* 地图入口 */
.map-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px;
    background: rgba(74, 158, 255, 0.08);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.map-entry:hover {
    background: rgba(74, 158, 255, 0.12);
    transform: translateY(-2px);
}

.map-entry-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.map-entry-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.map-entry-icon svg {
    width: 22px;
    height: 22px;
}

.map-entry-text h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.map-entry-text p {
    font-size: 12px;
    color: var(--text-secondary);
}

.map-entry-arrow {
    color: var(--accent-blue);
}

.map-entry-arrow svg {
    width: 20px;
    height: 20px;
}

/* ==================== 地图页面 ==================== */
.map-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.map-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.map-header h2 {
    font-size: 17px;
    font-weight: 600;
}

.map-wrapper {
    flex: 1;
    position: relative;
}

#amap-container {
    width: 100%;
    height: 100%;
}

.map-info-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    backdrop-filter: blur(10px);
    z-index: 100;
}

.map-info-panel h4 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.map-coords {
    display: flex;
    gap: 20px;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
}

.map-coords span {
    color: var(--text-secondary);
}

/* ==================== 加载动画 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==================== 工具类 ==================== */
.text-green { color: var(--accent-green); }
.text-blue { color: var(--accent-blue); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-yellow { color: var(--accent-yellow); }
