/* ═══════════════════════════════════════
   值班排班系统 — 高级现代风格
   ═══════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-alt: #f1f5f9;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.06);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }

/* ── 前台日历 ── */
.app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

.header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}
.header h1 { flex: 1; text-align: center; font-size: 18px; font-weight: 600; letter-spacing: 0.5px; }
.nav-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}
.nav-btn:active { background: rgba(255,255,255,0.3); transform: scale(0.95); }
.admin-link {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}
.admin-link:active { background: rgba(255,255,255,0.3); }

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    padding: 12px 12px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.weekdays .weekend { color: var(--danger); }

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 0 12px 12px;
}

.day {
    background: var(--surface);
    min-height: 76px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    position: relative;
}
.day:active { transform: scale(0.97); }
.day:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.day.other-month { background: transparent; color: var(--text-muted); opacity: 0.5; }
.day.other-month:hover { border-color: transparent; box-shadow: none; }
.day.today {
    background: var(--primary-light);
    border-color: var(--primary);
}
.day.today .day-num {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.day.weekend .day-num { color: var(--danger); }
.day-num { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.day-staff { display: flex; flex-direction: column; gap: 2px; }
.staff-tag {
    display: inline-block;
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

/* ── 弹窗 ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: flex-end;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--surface);
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-xl);
}
@keyframes slideUp { from { transform: translateY(100%); opacity: 0.8; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    display: flex;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { flex: 1; font-size: 17px; font-weight: 700; }
.modal-close {
    background: var(--surface-alt);
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; max-height: calc(80vh - 60px); }

.duty-card {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
    transition: all 0.2s;
}
.duty-card:hover { box-shadow: var(--shadow-sm); }
.duty-card:last-child { margin-bottom: 0; }
.duty-type {
    font-size: 11px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: inline-block;
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 4px;
}
.duty-staff { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.duty-time { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.duty-time::before { content: "🕐"; font-size: 12px; }
.duty-content { font-size: 14px; color: var(--text); margin-bottom: 6px; line-height: 1.5; }
.duty-contact { font-size: 13px; color: var(--text-secondary); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.duty-contact.phone::before { content: "📱"; font-size: 12px; }
.duty-contact.dept::before { content: "🏢"; font-size: 12px; }
.duty-note { font-size: 13px; color: var(--text-muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); line-height: 1.5; }
.no-duty { text-align: center; color: var(--text-muted); padding: 32px 16px; font-size: 14px; }
.no-duty::before { content: "📭"; display: block; font-size: 32px; margin-bottom: 8px; }

/* ── 登录页 ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-box {
    background: var(--surface);
    padding: 40px 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-xl);
}
.login-box h2 { text-align: center; margin-bottom: 8px; font-size: 22px; font-weight: 700; }
.login-box .subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: var(--surface);
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.btn:hover { box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { width: auto; padding: 8px 18px; font-size: 13px; }
.btn-danger { background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%); }
.btn-danger:hover { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); }
.btn-secondary { background: var(--surface-alt); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--border); box-shadow: none; transform: none; }
.btn-success { background: linear-gradient(135deg, var(--success) 0%, #059669 100%); }
.btn-success:hover { box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4); }
.error-msg { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; display: none; background: #fef2f2; padding: 8px; border-radius: var(--radius-sm); }

/* ── 后台管理 ── */
.admin-app { min-height: 100vh; background: var(--bg); }
.admin-header {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}
.admin-header h1 {
    flex: 1;
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.admin-nav { display: flex; gap: 4px; }
.admin-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.admin-nav a:hover { color: var(--primary); background: var(--primary-light); }
.admin-nav a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.admin-body { padding: 20px 24px; max-width: 1100px; margin: 0 auto; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
}
.card-title .btn { width: auto; padding: 8px 18px; }

/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; }
th {
    background: var(--surface-alt);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}
td { border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-alt); }
.actions { display: flex; gap: 8px; }
.actions button {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.15s;
}
.actions button:hover { background: var(--surface-alt); border-color: var(--primary); color: var(--primary); }
.actions button.del { color: var(--danger); border-color: #fecaca; }
.actions button.del:hover { background: #fef2f2; border-color: var(--danger); }

/* 弹窗表单 */
.form-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.form-overlay.show { display: flex; }
.form-modal {
    background: var(--surface);
    width: 100%;
    max-width: 460px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.form-modal .modal-header { background: var(--surface-alt); padding: 16px 20px; }
.form-modal .modal-body { padding: 20px; }
.form-modal .form-group { margin-bottom: 14px; }
.form-modal .form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-modal .form-actions .btn { flex: 1; }

/* 批量排班 */
.batch-section { background: var(--surface-alt); border-radius: var(--radius); padding: 20px; }
.batch-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.batch-row .form-group { flex: 1; min-width: 140px; }

/* 月份选择器 */
.month-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    background: var(--surface);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.month-picker input {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}
.month-picker input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
.month-picker .nav-btn {
    background: var(--surface-alt);
    color: var(--text);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
}
.month-picker .nav-btn:hover { background: var(--primary-light); color: var(--primary); }

/* ── 响应式 ── */
@media (max-width: 600px) {
    .admin-header { padding: 12px 16px; }
    .admin-body { padding: 16px; }
    .admin-nav a { font-size: 12px; padding: 5px 10px; }
    th, td { padding: 10px 8px; font-size: 13px; }
    .batch-row { flex-direction: column; }
    .batch-row .form-group { min-width: 100%; }
    .card { padding: 16px; }
    .day { min-height: 68px; padding: 6px; }
    .staff-tag { font-size: 9px; padding: 1px 4px; }
}

/* ── 滚动条美化 ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
