/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f6fa;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========== 状态栏 ========== */
.status-bar {
    height: env(safe-area-inset-top, 0px);
    background: #1677FF;
    flex-shrink: 0;
}

/* ========== 主内容区 ========== */
.main-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 60px;
    -webkit-overflow-scrolling: touch;
}

/* ========== 底部导航栏 ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    display: flex;
    border-top: 1px solid #eee;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:active {
    opacity: 0.7;
}

.nav-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
    filter: grayscale(100%);
    opacity: 0.6;
}

.nav-item.active .nav-icon {
    filter: grayscale(0%);
    opacity: 1;
}

.nav-text {
    font-size: 11px;
    color: #999;
    line-height: 1;
}

.nav-item.active .nav-text {
    color: #1677FF;
    font-weight: 600;
}

/* ========== 通用组件 ========== */
.page-header {
    background: linear-gradient(135deg, #1677FF 0%, #4096ff 100%);
    color: #fff;
    padding: 16px 20px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 13px;
    opacity: 0.85;
}

.card {
    background: #fff;
    border-radius: 12px;
    margin: 12px 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title .more {
    font-size: 12px;
    color: #999;
    font-weight: normal;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #1677FF;
    color: #fff;
}

.btn-primary:active {
    background: #0958D9;
}

.btn-outline {
    background: #fff;
    color: #1677FF;
    border: 1px solid #1677FF;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========== 首页样式 ========== */
.home-header {
    background: linear-gradient(135deg, #1677FF 0%, #4096ff 100%);
    color: #fff;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
}

.home-driver-info {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.driver-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 12px;
}

.driver-name {
    font-size: 18px;
    font-weight: 600;
}

.driver-vehicle {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 2px;
}

.driver-status {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: rgba(255,255,255,0.2);
}

.driver-status.online {
    background: #52c41a;
}

.driver-status.offline {
    background: #999;
}

.home-stats {
    display: flex;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 12px;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    background: rgba(255,255,255,0.2);
    margin: 4px 0;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.quick-action:active {
    opacity: 0.7;
}

.qa-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #e6f0ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 6px;
}

.qa-text {
    font-size: 12px;
    color: #666;
}

/* ========== 订单列表样式 ========== */
.order-tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #eee;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.order-tab {
    flex-shrink: 0;
    padding: 12px 16px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    position: relative;
}

.order-tab.active {
    color: #1677FF;
    font-weight: 600;
}

.order-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: #1677FF;
    border-radius: 2px;
}

.order-list {
    padding: 12px 16px;
}

.order-item {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f5f5f5;
}

.order-no {
    font-size: 12px;
    color: #999;
}

.order-status {
    font-size: 13px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.order-status.pending { color: #fa8c16; background: #fff7e6; }
.order-status.accepted { color: #1677FF; background: #e6f0ff; }
.order-status.onboard { color: #722ed1; background: #f9f0ff; }
.order-status.completed { color: #52c41a; background: #f6ffed; }
.order-status.cancelled { color: #999; background: #f5f5f5; }

.order-route {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}

.route-points {
    flex: 1;
}

.route-point {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
}

.route-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    margin-right: 8px;
    flex-shrink: 0;
}

.route-dot.start { background: #52c41a; }
.route-dot.end { background: #ff4d4f; }

.route-address {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.route-time {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #f5f5f5;
}

.order-price {
    font-size: 18px;
    font-weight: 700;
    color: #ff4d4f;
}

.order-price small {
    font-size: 12px;
    font-weight: normal;
}

.order-actions {
    display: flex;
    gap: 8px;
}

/* ========== 空状态 ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 14px;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 弹窗 ========== */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
}

.modal-container.show {
    display: block;
}

.modal-mask {
    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;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalUp 0.3s ease;
}

@keyframes modalUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 24px;
    color: #999;
    cursor: pointer;
}

/* ========== 加载中 ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f0f0f0;
    border-top-color: #1677FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 个人中心 ========== */
.profile-header {
    background: linear-gradient(135deg, #1677FF 0%, #4096ff 100%);
    color: #fff;
    padding: 30px 20px;
    padding-top: calc(30px + env(safe-area-inset-top, 0px));
    display: flex;
    align-items: center;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-right: 16px;
}

.profile-info h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-info p {
    font-size: 13px;
    opacity: 0.85;
}

.menu-list {
    background: #fff;
    margin: 12px 16px;
    border-radius: 12px;
    overflow: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: #f5f5f5;
}

.menu-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.menu-text {
    flex: 1;
    font-size: 15px;
    color: #333;
}

.menu-arrow {
    color: #ccc;
    font-size: 16px;
}

.menu-value {
    font-size: 13px;
    color: #999;
    margin-right: 4px;
}

/* ========== 账单样式 ========== */
.bill-header {
    background: linear-gradient(135deg, #1677FF 0%, #4096ff 100%);
    color: #fff;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    text-align: center;
}

.bill-total {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 4px;
}

.bill-total-label {
    font-size: 13px;
    opacity: 0.85;
}

.bill-tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.bill-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.bill-tab.active {
    color: #1677FF;
    font-weight: 600;
    border-bottom: 2px solid #1677FF;
}

.bill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
}

.bill-item-info {
    flex: 1;
}

.bill-item-title {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.bill-item-time {
    font-size: 12px;
    color: #999;
}

.bill-item-amount {
    font-size: 16px;
    font-weight: 600;
}

.bill-item-amount.income { color: #52c41a; }
.bill-item-amount.expense { color: #ff4d4f; }
