/* ==================== 登录页面 ==================== */
.login-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px 32px;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.login-header h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: #666;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 16px;
    color: #999;
    font-size: 16px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    outline: none;
}

.input-group input:focus {
    border-color: #667eea;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ff4d4f;
    font-size: 14px;
    justify-content: center;
}

/* ==================== 跟随模式 ==================== */
.follow-mode-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin-right: 8px;
}

.follow-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.follow-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.follow-btn.active {
    background: var(--primary-color);
    color: white;
}

/* ==================== 倍速选择 ==================== */
.speed-selector {
    display: flex;
    gap: 4px;
    margin: 0 8px;
}

.speed-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.speed-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.speed-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ==================== 基础样式 ==================== */
:root {
    --primary-color: #1890ff;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #ff4d4f;
    --info-color: #1890ff;

    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e8e8e8;

    --header-height: 50px;
    --panel-height: 200px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ==================== 头部导航 ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
}

.status-indicator.online {
    color: var(--success-color);
    background: rgba(82, 196, 26, 0.1);
}

.status-indicator.offline {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
}

.status-indicator.moving {
    color: var(--primary-color);
    background: rgba(24, 144, 255, 0.1);
}

.status-indicator.parking {
    color: var(--warning-color);
    background: rgba(250, 173, 20, 0.1);
}

.status-indicator i {
    font-size: 8px;
}

.status-indicator.online i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== 地图容器 ==================== */
.map-container {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
}

/* ==================== 信息面板 ==================== */
.info-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.panel-arrow {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.info-panel.collapsed .panel-arrow {
    transform: rotate(180deg);
}

.info-panel.collapsed .panel-content {
    display: none;
}

.panel-content {
    padding: 0 16px 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
}

/* ==================== 信息行 ==================== */
.info-section {
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.info-label i {
    width: 16px;
    text-align: center;
}

.info-value {
    font-weight: 500;
    font-size: 14px;
}

/* ==================== 按钮组 ==================== */
.button-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #40a9ff;
}

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

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-info {
    background: #e6f7ff;
    color: var(--info-color);
    border: 1px solid #91d5ff;
}

.btn-info:hover {
    background: #bae7ff;
}

.btn-success {
    background: #f6ffed;
    color: var(--success-color);
    border: 1px solid #b7eb8f;
}

.btn-success:hover {
    background: #d9f7be;
}

/* ==================== 轨迹控制栏 ==================== */
.track-control {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.track-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.track-title {
    font-weight: 600;
    font-size: 16px;
}

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

.track-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.track-progress input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
}

.track-progress input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.track-time {
    font-size: 14px;
    font-weight: 500;
    min-width: 50px;
    text-align: right;
}

.track-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:active {
    transform: scale(0.9);
    background: var(--border-color);
}

.btn-icon.playing {
    background: var(--primary-color);
    color: white;
}

/* ==================== 弹窗 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--bg-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
}

/* ==================== 停放记录列表 ==================== */
.parking-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.parking-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--warning-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.parking-info {
    flex: 1;
}

.parking-address {
    font-weight: 500;
    margin-bottom: 4px;
}

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

.parking-duration {
    font-size: 12px;
    color: var(--primary-color);
    margin-top: 4px;
}

/* ==================== 加载状态 ==================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading i {
    font-size: 24px;
    margin-bottom: 12px;
}

/* ==================== Toast 提示 ==================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
    pointer-events: auto;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* ==================== 自定义标记 ==================== */
.custom-marker {
    position: relative;
}

.marker-car {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.4);
    transform-origin: center;
}

.marker-car.parking {
    background: var(--warning-color);
    box-shadow: 0 2px 8px rgba(250, 173, 20, 0.4);
}

.marker-car.moving {
    background: var(--success-color);
    box-shadow: 0 2px 8px rgba(82, 196, 26, 0.4);
}

.marker-car::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: inherit;
    border-radius: 50%;
    opacity: 0.5;
}

/* 轨迹点标记 */
.marker-track-point {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.marker-track-current {
    width: 12px;
    height: 12px;
    background: var(--success-color);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(82, 196, 26, 0.4);
    animation: pulse 2s infinite;
}

.marker-track-start {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.marker-track-end {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--error-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ==================== 轨迹列表 ==================== */
.track-list {
    margin-top: 16px;
}

.track-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.track-list-title {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.track-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.track-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.track-item:hover {
    border-color: var(--primary-color);
    background: #e6f7ff;
}

.track-item.active {
    border-color: var(--primary-color);
    background: #e6f7ff;
}

.track-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.track-item-icon.track-1 { background: #1890ff; }
.track-item-icon.track-2 { background: #52c41a; }
.track-item-icon.track-3 { background: #faad14; }
.track-item-icon.track-4 { background: #722ed1; }
.track-item-icon.track-5 { background: #eb2f96; }
.track-item-icon.track-6 { background: #13c2c2; }
.track-item-icon.track-7 { background: #fa541c; }
.track-item-icon.track-8 { background: #2f54eb; }

.track-item-info {
    flex: 1;
    min-width: 0;
}

.track-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.track-item-name {
    font-weight: 600;
    font-size: 14px;
}

.track-item-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.track-item-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.track-item-detail {
    display: flex;
    align-items: center;
    gap: 4px;
}

.track-item-detail i {
    font-size: 10px;
}

.track-item-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: transform 0.2s;
}

.track-item-action:hover {
    transform: scale(1.1);
}

/* ==================== 日期选择器 ==================== */
.date-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
}

.date-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    text-align: center;
    background: white;
}

.btn-date {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-date:active {
    background: var(--bg-color);
}

.btn-today {
    padding: 8px 12px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    background: white;
    color: var(--primary-color);
    font-size: 13px;
    cursor: pointer;
}

.btn-today:active {
    background: var(--primary-color);
    color: white;
}

/* ==================== 轨迹统计卡片 ==================== */
.track-stats-card {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.btn-block {
    width: 100%;
}

/* ==================== 空状态 ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

/* ==================== 响应式 ==================== */
@media (min-width: 768px) {
    .info-panel {
        left: 50%;
        right: auto;
        width: 400px;
        transform: translateX(-50%);
    }

    .track-control {
        left: 50%;
        right: auto;
        width: 400px;
        transform: translateX(-50%);
    }

    .modal-content {
        left: 50%;
        right: auto;
        width: 500px;
        transform: translateX(-50%);
    }
}