/* ===== Admin Styles ===== */
:root {
    --sidebar-width: 240px;
    --admin-primary: #2563eb;
    --admin-bg: #f1f5f9;
    --admin-card: #fff;
    --admin-text: #1e293b;
    --admin-text-light: #64748b;
    --admin-border: #e2e8f0;
    --admin-success: #10b981;
    --admin-danger: #ef4444;
    --admin-warning: #f59e0b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--admin-bg); color: var(--admin-text); }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { font-size: 24px; color: var(--admin-primary); }
.login-header p { color: var(--admin-text-light); margin-top: 5px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; }
.login-form input { width: 100%; padding: 14px 16px; border: 1px solid var(--admin-border); border-radius: 8px; font-size: 15px; }
.login-form input:focus { border-color: var(--admin-primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.login-footer { text-align: center; margin-top: 20px; }
.login-footer a { color: var(--admin-text-light); font-size: 14px; }
.login-footer a:hover { color: var(--admin-primary); }

/* Admin Layout */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: var(--sidebar-width); background: #1e293b; color: #fff; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { font-size: 18px; font-weight: 700; }
.sidebar-header h2 i { margin-right: 8px; color: var(--admin-primary); }
.sidebar-nav ul { padding: 10px 0; }
.sidebar-nav ul li a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: rgba(255,255,255,0.7); transition: all 0.3s; font-size: 14px; }
.sidebar-nav ul li a:hover, .sidebar-nav ul li a.active { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav ul li a i { width: 20px; text-align: center; }
.sidebar-nav ul li.menu-divider { margin-top: 12px; padding: 10px 20px 4px; border-top: 1px dashed rgba(255,255,255,0.18); }
.sidebar-nav ul li.menu-divider span { display: block; font-size: 11px; font-weight: 600; letter-spacing: .5px; color: rgba(255,255,255,0.45); }

.perm-cards .perm-group-title { grid-column: 1 / -1; margin-top: 18px; padding-bottom: 6px; font-size: 12px; font-weight: 600; color: #64748b; letter-spacing: .5px; border-bottom: 1px dashed #e2e8f0; }
.perm-cards .perm-group-title:first-child { margin-top: 0; }

.admin-content { margin-left: var(--sidebar-width); flex: 1; padding: 30px; width: calc(100% - var(--sidebar-width)); }
.admin-main { width: 100%; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }
.dashboard-header h2 { font-size: 24px; }
.dashboard-header p { color: var(--admin-text-light); margin-top: 5px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--admin-card); border-radius: 12px; padding: 25px; display: flex; align-items: center; gap: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.stat-icon { width: 55px; height: 55px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-info h3 { font-size: 28px; font-weight: 800; }
.stat-info p { color: var(--admin-text-light); font-size: 14px; margin-top: 2px; }

/* Cards */
.admin-card { background: var(--admin-card); border-radius: 12px; padding: 25px; margin-bottom: 25px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { font-size: 18px; }

/* Tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 12px 10px; border-bottom: 2px solid var(--admin-border); color: var(--admin-text-light); font-weight: 600; font-size: 13px; white-space: nowrap; }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--admin-border); }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table .action-cell { white-space: nowrap; }
.admin-table .btn-sm { padding: 4px 10px; font-size: 12px; }
.row-unread { background: #f0f7ff; }

/* Buttons */
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all 0.3s; text-decoration: none; }
.btn-primary { background: var(--admin-primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--admin-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--admin-success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-outline { background: transparent; border: 1px solid var(--admin-border); color: var(--admin-text); }
.btn-outline:hover { background: var(--admin-bg); }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Alerts */
.alert { padding: 14px 20px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Forms */
.admin-form .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-form .form-group { margin-bottom: 15px; }
.admin-form .form-group-full { grid-column: 1 / -1; }
.admin-form .form-group-half { grid-column: span 1; }
.admin-form label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.admin-form .required { color: var(--admin-danger); }
.admin-form input[type="text"], .admin-form input[type="number"], .admin-form input[type="password"], .admin-form select, .admin-form textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--admin-border); border-radius: 6px; font-size: 14px; font-family: inherit; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { border-color: var(--admin-primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.admin-form textarea { resize: vertical; min-height: 80px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* Status badges */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-done { background: #d1fae5; color: #065f46; }

.text-center { text-align: center; color: var(--admin-text-light); padding: 30px 0; }

@media (max-width: 768px) {
    body { overflow-x: hidden; }
    .admin-main, .admin-content { max-width: 100%; overflow-x: hidden; }
    .sidebar-toggle { display: flex; position: fixed; top: 10px; left: 10px; z-index: 300; width: 38px; height: 38px; border-radius: 8px; background: #1e293b; color: #fff; border: none; font-size: 18px; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
    .admin-sidebar { position: fixed; top: 0; left: 0; width: 250px; height: 100vh; transform: translateX(-100%); transition: transform .25s ease; z-index: 400; overflow-y: auto; }
    .admin-sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 350; }
    .admin-content { margin-left: 0; padding: 60px 14px 14px; width: 100%; }
    .sidebar-nav ul li a span { display: inline; }
    .admin-card { padding: 14px; }
    .admin-card .card-body { padding: 10px; }
    .admin-form .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 12px; gap: 10px; border-radius: 10px; }
    .stat-icon { width: 36px; height: 36px; border-radius: 50%; font-size: 16px; }
    .stat-info h3 { font-size: 18px; }
    .stat-info p { font-size: 12px; }
    .admin-table { font-size: 12px; }
    .admin-table th, .admin-table td { padding: 8px 6px; }
    /* 手机版表格：保持原生 table 布局（表头与数据自动对齐），外层容器滚动 */
    .admin-table { width: 100%; min-width: 640px; }
    .admin-table th, .admin-table td { white-space: nowrap; }
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* 手机版卡片化：带 card-view 类的表格转卡片列表（每行一张卡片，列名用 data-label 显示，无需横向滚动） */
    .admin-table.card-view { display: block; width: 100%; min-width: 0; overflow: visible; }
    .admin-table.card-view thead { display: none; }
    .admin-table.card-view tbody { display: block; width: 100%; }
    .admin-table.card-view tbody tr { display: block; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 12px; padding: 6px 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
    .admin-table.card-view tbody td { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed #f1f5f9; white-space: normal; text-align: right; }
    .admin-table.card-view tbody td:last-child { border-bottom: none; }
    .admin-table.card-view tbody td::before { content: attr(data-label); font-weight: 600; color: #64748b; font-size: 12px; text-align: left; flex-shrink: 0; }
    .admin-table.card-view tbody td[data-label="操作"] { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
    .admin-table.card-view tbody td[data-label="操作"]::before { width: 100%; }
}

.tour-type-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.table-responsive { overflow-x: auto; }
