/* ============================================
   机场大屏系统 - 管理端样式
   苹果设计语言风格
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #f5f5f7;
    --bg-card: #fff;
    --bg-sidebar: #1c1c1e;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --blue: #007aff;
    --blue-hover: #0056cc;
    --green: #34c759;
    --green-hover: #2db34e;
    --orange: #ff9500;
    --red: #ff3b30;
    --gray: #8e8e93;
    --border: #d2d2d7;
    --border-light: #e5e5ea;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

/* ========== 登录页 ========== */
.admin-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    text-align: center;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--blue);
}
.login-logo svg { width: 100%; height: 100%; }
.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}
.login-error {
    background: rgba(255,59,48,0.1);
    color: var(--red);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}
.form-group {
    margin-bottom: 16px;
    text-align: left;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group label small {
    color: var(--text-tertiary);
    font-weight: 400;
}
.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}
.btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--blue);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    margin-top: 8px;
}
.btn-login:hover { background: var(--blue-hover); }
.login-hint {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.6;
}
.back-to-site {
    display: inline-block;
    margin-top: 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 13px;
}
.back-to-site:hover { color: #fff; }

/* ========== 管理端布局 ========== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: 220px;
    background: var(--bg-sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo svg { width: 28px; height: 28px; color: var(--blue); }
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.2s;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.nav-item.active {
    background: var(--blue);
    color: #fff;
}
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-logout { color: rgba(255,59,48,0.8); }
.nav-logout:hover { background: rgba(255,59,48,0.15); color: #ff3b30; }

.admin-main {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-topbar h2 {
    font-size: 20px;
    font-weight: 700;
}
.topbar-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.admin-user {
    padding: 4px 12px;
    background: var(--bg);
    border-radius: 20px;
    font-weight: 500;
}
.admin-content {
    flex: 1;
    padding: 24px 28px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-default { background: #fff; color: var(--text-primary); border: 1px solid var(--border); }
.btn-default:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

.mini-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    margin-right: 4px;
    transition: opacity 0.2s;
}
.mini-btn:hover { opacity: 0.8; }
.btn-edit { background: rgba(0,122,255,0.1); color: var(--blue); }
.btn-del { background: rgba(255,59,48,0.1); color: var(--red); }

/* ========== 工具栏 ========== */
.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.dashboard-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 状态快速筛选栏 */
.status-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.status-filter-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.status-filter-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}
.status-filter-btn.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

/* ========== 数据表格 ========== */
.data-table-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }
.code-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0,122,255,0.1);
    color: var(--blue);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.logo-thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    background: var(--bg);
}
.text-muted { color: var(--text-tertiary); }
.loading, .empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

/* ========== 航班管理表格 ========== */
.flight-manage-table {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.fmt-header {
    display: grid;
    grid-template-columns: 180px 140px 130px 130px 110px 1fr;
    padding: 12px 16px;
    background: var(--bg);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}
.fmt-body { max-height: calc(100vh - 280px); overflow-y: auto; }
.fmt-row {
    display: grid;
    grid-template-columns: 180px 140px 130px 130px 110px 1fr;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    gap: 8px;
}
.fmt-row:hover { background: #fafafa; }
.fmt-row.codeshare-row {
    background: #fffaf0;
}
.fmt-row.codeshare-row:hover { background: #fff5e0; }

/* 班次周期多选 */
.weekday-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.weekday-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    background: #fff;
    transition: all 0.15s;
    user-select: none;
}
.weekday-check:hover { border-color: var(--blue); }
.weekday-check input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}
.weekday-check:has(input:checked) {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

/* 自动执行开关 */
.auto-execute-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    background: #f0f0f5;
    transition: all 0.2s;
    user-select: none;
}
.auto-execute-toggle:hover { background: #e5e5ea; }
.auto-execute-toggle.on { background: #34c75920; }
.ae-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.auto-execute-toggle.on .ae-label { color: #34c759; }
.ae-switch {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #c7c7cc;
    position: relative;
    transition: background 0.2s;
}
.auto-execute-toggle.on .ae-switch { background: #34c759; }
.ae-dot {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.auto-execute-toggle.on .ae-dot { transform: translateX(16px); }

/* 操作日志 */
.log-time { font-family: 'SF Mono', Consolas, monospace; font-size: 13px; color: var(--text-secondary); }
.log-remark { font-size: 13px; color: var(--text-secondary); }
.log-auto { background: #f0f9ff; }
.log-system { background: #f5f5f7; font-style: italic; }
.operator-auto {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #34c75920;
    color: #34c759;
    font-size: 12px;
    font-weight: 600;
}
.operator-user {
    color: var(--text-primary);
    font-weight: 500;
}
.status-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.status-tag.st-waiting { background: #e3f2fd; color: #1565c0; }
.status-tag.st-boarding { background: #e8f5e9; color: #2e7d32; }
.status-tag.st-last_call { background: #fff3e0; color: #e65100; }
.status-tag.st-boarding_closed { background: #ffebee; color: #c62828; }
.status-tag.st-delayed { background: #fff3e0; color: #e65100; }
.status-tag.st-canceled { background: #ffebee; color: #c62828; }
.status-tag.st-arrived { background: #f5f5f5; color: #616161; }
.status-tag.st-departed { background: #ede7f6; color: #4527a0; }
.status-tag.st-completed { background: #eceff1; color: #546e7a; }

/* 分页栏 */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
    flex-wrap: wrap;
    gap: 10px;
}
.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}
.pagination-btns {
    display: flex;
    gap: 4px;
    align-items: center;
}
.page-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    min-width: 32px;
}
.page-btn:hover:not([disabled]):not(.active) {
    border-color: var(--blue);
    color: var(--blue);
}
.page-btn.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.page-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-ellipsis {
    padding: 0 4px;
    color: var(--text-tertiary);
    font-size: 13px;
}
.fmt-row:last-child { border-bottom: none; }
.col-flight { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.airline-code { font-size: 12px; color: var(--text-tertiary); font-weight: 600; }
.flight-no { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.flight-type-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.flight-type-tag.departure { background: rgba(0,122,255,0.1); color: var(--blue); }
.flight-type-tag.arrival { background: rgba(52,199,89,0.1); color: var(--green); }
.time-old { text-decoration: line-through; color: var(--text-tertiary); font-size: 13px; }
.time-new { color: var(--orange); font-weight: 600; }
.gate-select-inline {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    width: 100%;
}
.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.st-waiting { background: rgba(0,122,255,0.1); color: var(--blue); }
.st-boarding { background: rgba(52,199,89,0.1); color: var(--green); }
.st-lastcall { background: rgba(255,149,0,0.1); color: var(--orange); }
.st-closed { background: rgba(255,59,48,0.1); color: var(--red); }
.st-delayed { background: rgba(255,149,0,0.1); color: var(--orange); }
.st-canceled { background: rgba(255,59,48,0.1); color: var(--red); }
.st-arrived { background: rgba(142,142,147,0.1); color: var(--gray); }

.row-actions { margin-bottom: 6px; }
.status-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.status-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    background: #fff;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.status-btn:hover { background: var(--bg); }
.s-waiting:hover { background: rgba(0,122,255,0.1); color: var(--blue); border-color: var(--blue); }
.s-boarding:hover { background: rgba(52,199,89,0.1); color: var(--green); border-color: var(--green); }
.s-lastcall:hover { background: rgba(255,149,0,0.1); color: var(--orange); border-color: var(--orange); }
.s-closed:hover { background: rgba(255,59,48,0.1); color: var(--red); border-color: var(--red); }
.s-delayed:hover { background: rgba(255,149,0,0.1); color: var(--orange); border-color: var(--orange); }
.s-canceled:hover { background: rgba(255,59,48,0.1); color: var(--red); border-color: var(--red); }
.s-arrived:hover { background: rgba(142,142,147,0.1); color: var(--gray); border-color: var(--gray); }
.s-completed { color: #8e8e93; border-color: #c7c7cc; }
.s-completed:hover { background: rgba(142,142,147,0.1); color: #8e8e93; border-color: #8e8e93; }
.s-completed.active { background: #8e8e93; color: #fff; border-color: #8e8e93; }
.s-departed { color: #5856d6; border-color: #c7c7ff; }
.s-departed:hover { background: rgba(88,86,214,0.1); color: #5856d6; border-color: #5856d6; }
.s-departed.active { background: #5856d6; color: #fff; border-color: #5856d6; }

/* ========== 表单卡片 ========== */
.form-card {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.form-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.form-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 600;
}
.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* 搜索建议框 */
.suggest-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}
.suggest-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}
.suggest-item:hover { background: var(--bg); }
.suggest-item:last-child { border-bottom: none; }
.form-group { position: relative; }

/* 航班号前缀输入框 */
.flight-number-input {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.flight-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 10px 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--blue);
    letter-spacing: 1px;
    min-width: 50px;
    white-space: nowrap;
}
.flight-number-input .form-input {
    border-radius: 0 10px 10px 0;
}

/* 共享航班行 */
.codeshare-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    margin-bottom: 10px;
    align-items: end;
}
.cs-field { position: relative; }
.cs-field label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.cs-remove { padding-bottom: 10px; }

/* ========== 弹窗 ========== */
.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;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue); }

/* 响应式 */
@media (max-width: 900px) {
    .admin-sidebar { width: 60px; }
    .sidebar-logo span, .nav-item span:not(.nav-item svg) { display: none; }
    .admin-main { margin-left: 60px; }
    .form-row { grid-template-columns: 1fr; }
    .fmt-header, .fmt-row { grid-template-columns: 1fr; }
}
