/* ============================================================
   门票管理系统 · 苹果风格主样式
   ============================================================ */

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

:root {
    --apple-blue: #007AFF;
    --apple-blue-dark: #0062cc;
    --apple-green: #34C759;
    --apple-orange: #FF9500;
    --apple-red: #FF3B30;
    --apple-yellow: #FFCC00;
    --apple-gray: #8E8E93;
    --apple-gray-2: #AEAEB2;
    --apple-gray-3: #C7C7CC;
    --apple-gray-4: #D1D1D6;
    --apple-gray-5: #E5E5EA;
    --apple-gray-6: #F2F2F7;
    --apple-bg: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "Segoe UI", Roboto, "Helvetica Neue", Helvetica, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--apple-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--apple-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 布局 ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: rgba(255,255,255,0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right: 1px solid var(--apple-gray-5);
    padding: 24px 16px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 10;
}
.sidebar-brand {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand .logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #007AFF, #5AC8FA);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 16px;
}
.nav-section { margin-bottom: 16px; }
.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    padding: 8px 12px;
}
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 14px;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background .15s;
}
.nav-link:hover { background: var(--apple-gray-6); text-decoration: none; }
.nav-link.active { background: rgba(0,122,255,0.1); color: var(--apple-blue); font-weight: 500; }
.nav-link .icon { width: 18px; height: 18px; flex-shrink: 0; }

.main { flex: 1; margin-left: 240px; }
.topbar {
    height: 56px;
    background: rgba(255,255,255,0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--apple-gray-5);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #007AFF, #5AC8FA);
    border-radius: 50%;
    color: #fff; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
}
.content { padding: 28px 32px; }

/* ===== 卡片 ===== */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
    background: var(--apple-gray-6);
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
}
.btn:hover { background: var(--apple-gray-5); }
.btn-primary { background: var(--apple-blue); color: #fff; }
.btn-primary:hover { background: var(--apple-blue-dark); }
.btn-success { background: var(--apple-green); color: #fff; }
.btn-success:hover { background: #2cb24f; }
.btn-warning { background: var(--apple-orange); color: #fff; }
.btn-warning:hover { background: #e08600; }
.btn-danger { background: var(--apple-red); color: #fff; }
.btn-danger:hover { background: #d8332a; }
.btn-ghost { background: transparent; border: 1px solid var(--apple-gray-4); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-primary); margin-bottom: 6px;
}
.form-control, .form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--apple-gray-4);
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    transition: all .15s;
    color: var(--text-primary);
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}
.form-control[readonly], .form-control:disabled { background: var(--apple-gray-6); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-row-2 { grid-template-columns: repeat(2, 1fr); }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }
.form-help { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--apple-gray-5); }
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}
.table thead th {
    text-align: left;
    padding: 12px 14px;
    background: var(--apple-gray-6);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid var(--apple-gray-5);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--apple-gray-6);
    color: var(--text-primary);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(0,122,255,0.03); }
.table .checkbox-col { width: 36px; text-align: center; }

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.badge-blue { background: rgba(0,122,255,0.12); color: var(--apple-blue); }
.badge-green { background: rgba(52,199,89,0.15); color: #28a745; }
.badge-orange { background: rgba(255,149,0,0.15); color: var(--apple-orange); }
.badge-yellow { background: rgba(255,204,0,0.18); color: #b78900; }
.badge-red { background: rgba(255,59,48,0.13); color: var(--apple-red); }
.badge-gray { background: var(--apple-gray-6); color: var(--text-secondary); }

/* ===== 统计卡片 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-card);
    transition: all .2s;
}
.stat-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.stat-trend { font-size: 12px; color: var(--text-tertiary); margin-top: 6px; }
.stat-card.accent-blue .stat-value { color: var(--apple-blue); }
.stat-card.accent-orange .stat-value { color: var(--apple-orange); }
.stat-card.accent-green .stat-value { color: var(--apple-green); }
.stat-card.accent-red .stat-value { color: var(--apple-red); }

/* ===== 弹窗 ===== */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 100;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--apple-gray-5);
    font-size: 15px; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-body { padding: 22px; }
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--apple-gray-5);
    display: flex; justify-content: flex-end; gap: 10px;
}
.modal-close {
    background: none; border: none;
    font-size: 22px; line-height: 1;
    color: var(--text-tertiary); cursor: pointer;
}

/* ===== 提示 ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-info { background: rgba(0,122,255,0.08); color: var(--apple-blue); }
.alert-success { background: rgba(52,199,89,0.1); color: #1f8c40; }
.alert-warning { background: rgba(255,149,0,0.1); color: #b56b00; }
.alert-error { background: rgba(255,59,48,0.1); color: var(--apple-red); }

/* ===== 公告 ===== */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item {
    padding: 14px 16px;
    background: var(--apple-gray-6);
    border-radius: var(--radius-md);
}
.notice-item .title { font-size: 14px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.notice-item .meta { font-size: 12px; color: var(--text-tertiary); }
.notice-item .content { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ===== 分页 ===== */
.pagination {
    display: flex; justify-content: flex-end; align-items: center;
    gap: 6px; margin-top: 16px; flex-wrap: wrap;
}
.pagination .info { color: var(--text-tertiary); font-size: 13px; margin-right: 12px; }
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: 8px; font-size: 13px;
    color: var(--text-primary); border: 1px solid var(--apple-gray-5);
    background: #fff;
}
.pagination a:hover { background: var(--apple-gray-6); text-decoration: none; }
.pagination .current { background: var(--apple-blue); color: #fff; border-color: var(--apple-blue); }
.pagination .disabled { color: var(--apple-gray-3); }

/* ===== 登录页 ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #f5f7fb, #e8eef7 50%, #f0e8f7);
    padding: 20px;
}
.login-card {
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: 24px;
    padding: 44px 40px;
    width: 100%; max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.6);
}
.login-card h1 { font-size: 24px; margin-bottom: 6px; text-align: center; letter-spacing: -0.3px; }
.login-card p { color: var(--text-secondary); font-size: 13px; text-align: center; margin-bottom: 28px; }
.login-card .form-control { padding: 12px 14px; font-size: 14px; }
.login-card .btn { width: 100%; padding: 12px; font-size: 14px; }

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-tertiary); }
.text-primary { color: var(--apple-blue); }
.text-success { color: var(--apple-green); }
.text-danger { color: var(--apple-red); }
.text-warning { color: var(--apple-orange); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.font-mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.hidden { display: none !important; }

/* ===== 复选框美化 ===== */
input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--apple-blue);
    cursor: pointer;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform .3s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}
@media (max-width: 768px) {
    .form-row, .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .topbar, .content { padding-left: 16px; padding-right: 16px; }
}
