/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 颜色变量 */
    --primary-color: #179FF0;
    --success-color: #52C41A;
    --warning-color: #FA8C16;
    --error-color: #FF4D4F;
    --bg-color: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #999999;
    --border-color: #E5E5E5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #F5F5F5;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
    padding-bottom: 20px;
}

.page.active {
    display: block;
}

/* 导航栏 */
.navbar {
    background: var(--bg-color);
    padding: 12px 16px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar h1 {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    position: relative;
}

.btn-back {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
}

/* 容器 */
.container {
    max-width: 100%;
    padding: 16px;
}

/* 查询表单 */
.query-form {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.required-tag {
    color: var(--error-color);
    font-size: 12px;
    font-weight: normal;
}

.optional-tag {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: normal;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 8px;
}

.btn-primary:hover {
    background: #0d8dd8;
}

.btn-primary:active {
    background: #0b7bc0;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 10px 16px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
}

.btn-secondary:hover:not(:disabled) {
    background: #F7F7F7;
    border-color: var(--primary-color);
}

.btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

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

/* 历史记录 */
.history-section {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
}

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

.history-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-list.hidden {
    display: none;
}

.history-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.3s;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: #F5F5F5;
}

.history-item-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.history-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

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

.history-item-number {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

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

/* 信息卡片 */
.info-card {
    background: var(--bg-color);
    padding: 16px;
    margin-bottom: 0;
}

.tracking-number-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tracking-number {
    font-size: 16px;
    font-weight: 500;
    font-family: monospace;
    color: var(--text-primary);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.btn-icon:hover {
    opacity: 1;
}

.route-info {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
}

.route-info.hidden {
    display: none;
}

.address-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.5;
}

.service-tag {
    display: inline-block;
    background: var(--error-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.service-tag.hidden {
    display: none;
}

/* 地图容器 */
.map-container {
    width: 100%;
    height: 400px;
    background: #E5E5E5;
    margin-bottom: 16px;
}

/* 状态浮层（旧版，已废弃） */
.status-overlay {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning-color);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 200;
    min-width: 200px;
    text-align: center;
}

.status-overlay.hidden {
    display: none;
}

/* 状态信息（显示在运单号旁边） */
.status-overlay-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-left: 12px;
    flex: 1;
}

.status-overlay-inline.hidden {
    display: none;
}

.status-overlay-inline .status-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.status-overlay-inline .status-time {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.status-text {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.status-time {
    font-size: 12px;
    opacity: 0.9;
}

/* 日志卡片 */
.log-card {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

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

.company-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

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

.log-status {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    margin-right: 8px;
}

.log-status .status-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.log-detail {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 12px;
}

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

/* 时间线 */
.timeline-section {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
}

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

.timeline-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.timeline-list {
    position: relative;
    padding-left: 24px;
}

.timeline-list.hidden {
    display: none;
}

.timeline-list::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding: 12px 0;
    padding-left: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-color);
}

.timeline-item.active::before {
    background: var(--success-color);
    border-color: var(--success-color);
}

.timeline-item-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.timeline-item-location {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.timeline-item-detail {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 刷新按钮 */
.btn-refresh {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 100;
    transition: transform 0.3s;
}

.btn-refresh:hover {
    transform: scale(1.1);
}

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

/* 加载提示 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: white;
    margin-top: 16px;
    font-size: 14px;
}

/* 提示框 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 2000;
    font-size: 14px;
    max-width: 80%;
    text-align: center;
}

.toast.hidden {
    display: none;
}

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

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

.code-block {
    background: #F7F7F7;
    border-radius: 4px;
    padding: 12px;
    font-family: Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 8px;
}

.file-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.file-description {
    font-size: 14px;
    color: var(--text-secondary);
}

.status-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.status-message.error {
    color: var(--error-color);
}

.file-table-wrapper {
    overflow-x: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table th,
.file-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
}

.file-table thead th {
    background: #F7F7F7;
    font-weight: 600;
    color: var(--text-secondary);
}

.file-table tbody tr:hover {
    background: #FAFAFA;
}

.file-download-link {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.file-download-link:hover {
    text-decoration: underline;
}

.log-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.log-link:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-page {
    font-size: 14px;
    color: var(--text-primary);
}

.log-viewer {
    margin-top: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 16px;
}

.log-metadata {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.log-filename {
    font-size: 14px;
    color: var(--text-secondary);
    word-break: break-all;
}

.log-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

.log-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.log-content {
    max-height: 480px;
    overflow-y: auto;
    background: #0F172A;
    color: #E2E8F0;
    padding: 12px;
    border-radius: 4px;
    font-family: Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

