/* ============================================
   门票管理系统 - Apple风格CSS
   ============================================ */
:root {
    --primary: #007AFF;
    --primary-light: #409CFF;
    --primary-dark: #0056CC;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --info: #5AC8FA;
    --bg: #F2F2F7;
    --card-bg: #FFFFFF;
    --text: #1C1C1E;
    --text-secondary: #8E8E93;
    --border: #E5E5EA;
    --sidebar-bg: rgba(255,255,255,0.85);
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sidebar-width: 240px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 布局 */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex; flex-direction: column;
}
.sidebar-header { padding: 20px 16px 12px; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 17px; font-weight: 600; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 15px;
}
.user-info .name { font-weight: 600; font-size: 14px; }
.user-info .role { font-size: 12px; color: var(--text-secondary); }
.nav-list { list-style: none; padding: 8px 0; flex: 1; }
.nav-label { padding: 12px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); font-weight: 600; }
.nav-link {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; margin: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-weight: 500;
    transition: all 0.15s ease;
}
.nav-link:hover { background: rgba(0,122,255,0.08); color: var(--primary); text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }
.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 0; }
.top-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 20px; font-weight: 700; }
.datetime-display { color: var(--text-secondary); font-size: 13px; }
.content-wrapper { padding: 24px 28px; }

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 16px; font-weight: 600; }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-card .stat-value.danger { color: var(--danger); }
.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-value.warning { color: var(--warning); }

/* 表格 */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    white-space: nowrap;
}
table th { font-weight: 600; color: var(--text-secondary); background: #FAFAFA; position: sticky; top: 0; }
table tr:hover td { background: rgba(0,122,255,0.03); }
table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500;
    border: none; cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #2DA44E; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #D32F2F; }
.btn-outline {
    background: transparent; color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: rgba(0,122,255,0.06); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.15s;
    background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,122,255,0.12); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

/* 标签 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-warning { background: #FFF3E0; color: #E65100; }
.badge-info { background: #E3F2FD; color: #1565C0; }
.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-primary { background: #E8EAF6; color: #283593; }
.badge-danger { background: #FFEBEE; color: #C62828; }

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    width: 100%; max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-card h2 { text-align: center; margin-bottom: 8px; font-size: 24px; }
.login-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 24px; font-size: 14px; }
.login-card .btn-primary { width: 100%; padding: 12px; font-size: 16px; margin-top: 8px; }

/* 模态框 */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; visibility: hidden;
    transition: all 0.2s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%; max-width: 500px;
    max-height: 80vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px 0; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}
.pagination a { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); }
.pagination a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; }
.pagination .disabled { color: var(--text-secondary); pointer-events: none; }
.page-info { font-size: 13px; color: var(--text-secondary); margin: 0 8px; }

/* 筛选栏 */
.filter-bar {
    display: flex; gap: 12px; flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; }
.filter-bar .form-control { padding: 8px 12px; font-size: 13px; }
.filter-bar .btn { height: 38px; }

/* 公告卡片 */
.notice-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}
.notice-card:hover { transform: translateX(4px); }
.notice-card .notice-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.notice-card .notice-meta { font-size: 12px; color: var(--text-secondary); }
.notice-card .notice-content { font-size: 13px; color: var(--text); margin-top: 8px; line-height: 1.7; }

/* 行程单（车票样式） */
.ticket-print-area {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}
.ticket-card {
    border: 2px dashed #999;
    border-radius: 12px;
    padding: 16px;
    font-family: "SF Mono", "Menlo", "Courier New", monospace;
    page-break-inside: avoid;
    position: relative;
    background: #fff;
}
.ticket-card::before {
    content: '';
    position: absolute; top: 50%; left: -10px;
    width: 20px; height: 20px;
    background: var(--bg);
    border-radius: 50%;
    transform: translateY(-50%);
}
.ticket-card::after {
    content: '';
    position: absolute; top: 50%; right: -10px;
    width: 20px; height: 20px;
    background: var(--bg);
    border-radius: 50%;
    transform: translateY(-50%);
}
.ticket-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.ticket-header .ticket-no { font-size: 12px; font-weight: 700; color: #333; }
.ticket-header .ticket-status { font-size: 11px; color: var(--success); font-weight: 600; }
.ticket-body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ticket-field { font-size: 12px; }
.ticket-field .label { color: #999; font-size: 10px; display: block; }
.ticket-field .value { font-weight: 600; font-size: 14px; }
.ticket-barcode { text-align: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ccc; }
.ticket-barcode svg { max-width: 200px; }

/* 提示消息 */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.alert-danger { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }
.alert-warning { background: #FFF8E1; color: #F57F17; border: 1px solid #FFE082; }
.alert-info { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; }
    .stat-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        transition: left 0.3s;
        width: var(--sidebar-width);
    }
    .sidebar.open { left: 0; }
    .main-content { margin-left: 0; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { flex-direction: column; }
    .ticket-print-area { grid-template-columns: 1fr; }
}

/* 打印样式 */
@media print {
    .sidebar, .top-bar, .btn, .filter-bar, .pagination { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    .ticket-print-area { gap: 10px; }
    .ticket-card { border: 2px dashed #666; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C7C7CC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #A1A1A6; }

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.mr-1 { margin-right: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
