/* 班车预定系统 - 移动端适配样式 */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* 头部 */
.header {
    background: var(--primary);
    color: white;
    padding: 16px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header .back-btn {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    text-decoration: none;
    font-size: 16px;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-800);
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

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

.btn-outline {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-100);
}

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

.btn-block {
    display: flex;
    width: 100%;
}

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

/* 标签页 */
.tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

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

/* 列表项 */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
}

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

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
    color: var(--gray-800);
}

.list-item-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* 班车卡片 */
.bus-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.bus-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bus-card.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.bus-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

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

.bus-card-time {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
}

.bus-card-seats {
    font-size: 12px;
    color: var(--gray-500);
}

.bus-card-seats .available {
    color: var(--success);
    font-weight: 600;
}

.bus-card-seats .full {
    color: var(--danger);
    font-weight: 600;
}

/* 票券卡片 */
.ticket-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.ticket-card.used::before {
    background: var(--success);
}

.ticket-card.cancelled::before {
    background: var(--gray-400);
}

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

.ticket-card-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.ticket-card-status.pending {
    background: #fef3c7;
    color: var(--warning);
}

.ticket-card-status.used {
    background: #dcfce7;
    color: var(--success);
}

.ticket-card-status.cancelled {
    background: var(--gray-200);
    color: var(--gray-500);
}

.ticket-card-status.expired {
    background: #fef3cd;
    color: #856404;
}

.ticket-card.expired {
    border-left: 4px solid #ffc107;
}

.ticket-card-body {
    margin-bottom: 12px;
}

.ticket-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ticket-info-icon {
    width: 32px;
    height: 32px;
    background: var(--gray-100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.ticket-info-text {
    flex: 1;
}

.ticket-info-label {
    font-size: 12px;
    color: var(--gray-500);
}

.ticket-info-value {
    font-weight: 500;
}

/* 二维码 */
.qrcode-container {
    text-align: center;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
}

.qrcode-container canvas {
    max-width: 200px;
    margin: 0 auto;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
}

/* 复选框 */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-item:hover {
    border-color: var(--primary);
}

.checkbox-item.selected {
    background: #eff6ff;
    border-color: var(--primary);
}

.checkbox-item input {
    display: none;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

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

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

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

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    border-top: 1px solid var(--gray-200);
    padding: 8px 0;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 12px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

/* 用户信息 */
.user-info {
    background: var(--primary);
    color: white;
    padding: 24px 16px;
    text-align: center;
}

.user-avatar {
    width: 64px;
    height: 64px;
    background: white;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary);
}

.user-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-phone {
    font-size: 14px;
    opacity: 0.8;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

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

/* 页面内容留出底部导航空间 */
.page-content {
    padding-bottom: 80px;
}

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

/* 加载状态 */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--gray-500);
}

/* 司机扫码页面 */
.scanner-container {
    position: relative;
    width: 100%;
    height: 60vh;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border: 2px solid white;
    border-radius: 16px;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--success);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}

.verify-result {
    padding: 24px;
    text-align: center;
}

.verify-result.success {
    background: #dcfce7;
}

.verify-result.error {
    background: #fee2e2;
}

.verify-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.verify-message {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.verify-details {
    text-align: left;
    background: white;
    border-radius: 8px;
    padding: 16px;
}

.verify-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

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

/* 管理员表格 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.admin-table th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 12px;
    text-transform: uppercase;
}

.admin-table td {
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background: #fef3c7;
    color: var(--warning);
}

.badge-driver {
    background: #dbeafe;
    color: var(--primary);
}

.badge-restricted {
    background: #fee2e2;
    color: var(--danger);
}

.badge-active {
    background: #dcfce7;
    color: var(--success);
}

/* 日期选择 */
.date-picker {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.date-item {
    flex-shrink: 0;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    min-width: 60px;
}

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

.date-item .day {
    font-size: 12px;
    color: var(--gray-500);
}

.date-item .num {
    font-size: 18px;
    font-weight: 600;
    margin-top: 2px;
}

.date-item.active .num {
    color: var(--primary);
}
