/* ===== 重置与变量 ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass-bg: rgba(255,255,255,0.12);
    --glass-border: rgba(255,255,255,0.18);
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
}

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

html { 
    font-size: 16px; 
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #f1f5f9;
    line-height: 1.5;
    min-height: 100vh;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    z-index: -1;
}

/* ===== 毛玻璃 ===== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ===== 导航栏 ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(15,23,42,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    z-index: 1000;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    gap: 4px;
    list-style: none;
}

.nav-link {
    display: block;
    padding: 8px 12px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* ===== 布局 ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.page { padding: 72px 0 24px; min-height: 100vh; }

.card {
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.card-title { font-size: 1.1rem; font-weight: 600; }

/* ===== 网格 ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.col { padding: 0 8px; width: 100%; }

@media (min-width: 576px) {
    .col-sm-6 { width: 50%; }
}

@media (min-width: 768px) {
    .col-md-4 { width: 33.333%; }
    .col-md-6 { width: 50%; }
    .col-md-3 { width: 25%; }
}

@media (min-width: 992px) {
    .col-lg-3 { width: 25%; }
    .col-lg-4 { width: 33.333%; }
    .col-lg-6 { width: 50%; }
}

/* ===== 统计卡片 ===== */
.stat {
    text-align: center;
    padding: 16px 12px;
    margin-bottom: 16px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    margin-top: 4px;
}

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.9rem; font-weight: 500; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 16px;
    color: #fff;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    transition: all 0.2s;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}

.form-control::placeholder { color: rgba(255,255,255,0.4); }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 36px;
}

select.form-control option { background: #1e293b; color: #fff; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-secondary { background: rgba(255,255,255,0.15); }
.btn-secondary:hover { background: rgba(255,255,255,0.25); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    background: rgba(255,255,255,0.04);
    white-space: nowrap;
}

.table tr:hover { background: rgba(255,255,255,0.04); }

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-primary { background: var(--primary); }
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); }
.badge-danger { background: var(--danger); }
.badge-secondary { background: rgba(255,255,255,0.2); }

/* ===== 提示 ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success { background: rgba(16,185,129,0.2); border: 1px solid var(--success); }
.alert-error { background: rgba(239,68,68,0.2); border: 1px solid var(--danger); }
.alert-warning { background: rgba(245,158,11,0.2); border: 1px solid var(--warning); }

/* ===== 开关 ===== */
.switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.2s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* ===== 日历 ===== */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendar-head {
    text-align: center;
    padding: 8px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px;
    min-height: 48px;
}

.calendar-day:hover { background: rgba(255,255,255,0.12); }
.calendar-day.weekend { background: rgba(245,158,11,0.12); }
.calendar-day.holiday { background: rgba(239,68,68,0.12); }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-day.future { opacity: 0.4; cursor: not-allowed; }
.calendar-day.has-record { background: rgba(16,185,129,0.2); }

.calendar-num { font-size: 1rem; font-weight: 600; }
.calendar-hours { font-size: 0.65rem; color: rgba(255,255,255,0.7); margin-top: 2px; }

/* ===== 时钟 ===== */
.clock { font-size: 2.5rem; font-weight: 300; font-family: monospace; text-align: center; }
.clock-date { text-align: center; color: rgba(255,255,255,0.7); margin-top: 4px; }

/* ===== 登录页 ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 32px 24px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.auth-sub {
    text-align: center;
    color: rgba(255,255,255,0.6);
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255,255,255,0.6);
}

.auth-footer a { color: var(--primary); text-decoration: none; }

/* ===== 首页 ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.hero-card { max-width: 600px; padding: 40px 24px; }

.hero-title {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.hero-desc {
    color: rgba(255,255,255,0.8);
    margin-bottom: 24px;
    line-height: 1.6;
}

.hero-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== 管理后台 ===== */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    padding: 20px 12px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(15,23,42,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255,255,255,0.08);
    z-index: 900;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    padding: 8px 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.sidebar-menu { list-style: none; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.sidebar-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-link.active { background: var(--primary); color: #fff; }

.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 24px;
    min-height: 100vh;
}

.sidebar-toggle-btn {
    display: none;
    position: fixed;
    top: 68px;
    left: 12px;
    z-index: 901;
    padding: 8px 12px;
}

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 2000;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ===== 响应式 - 平板 ===== */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .sidebar-toggle-btn { display: flex; }
}

/* ===== 响应式 - 手机 ===== */
@media (max-width: 767px) {
    html { font-size: 15px; }
    
    .nav { height: 52px; padding: 0 12px; }
    .nav-brand { font-size: 1rem; }
    
    .nav-menu {
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(15,23,42,0.98);
        padding: 12px;
        gap: 4px;
        display: none;
        max-height: calc(100vh - 52px);
        overflow-y: auto;
    }
    
    .nav-menu.open { display: flex; }
    .nav-toggle { display: block; }
    .nav-link { padding: 12px 16px; text-align: center; }
    
    .page { padding: 64px 0 20px; }
    .container { padding: 0 12px; }
    .card { padding: 16px; }
    
    .stat-value { font-size: 1.5rem; }
    .clock { font-size: 2rem; }
    
    .hero-title { font-size: 1.75rem; }
    .hero-card { padding: 28px 20px; }
    
    .hero-btns { flex-direction: column; }
    .hero-btns .btn { width: 100%; }
    
    .auth-card { padding: 24px 20px; }
    
    .calendar-day { min-height: 42px; }
    .calendar-num { font-size: 0.9rem; }
    
    .sidebar { width: 260px; }
    .admin-main { padding: 16px; }
    
    .table { min-width: 400px; }
    .table th, .table td { padding: 10px 8px; font-size: 0.8rem; }
}

/* ===== 响应式 - 小手机 ===== */
@media (max-width: 375px) {
    html { font-size: 14px; }
    .calendar { gap: 4px; }
    .calendar-day { min-height: 36px; }
    .calendar-num { font-size: 0.85rem; }
    .calendar-head { font-size: 0.7rem; padding: 6px 2px; }
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ===== 打印 ===== */
@media print {
    .nav, .sidebar, .sidebar-toggle-btn, .btn, form { display: none !important; }
    .admin-main, .page { margin: 0 !important; padding: 16px !important; }
    body, .glass { background: #fff !important; color: #000 !important; }
    .table th, .table td { border: 1px solid #ccc !important; }
}