/* ── 全局 ─────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f7fa; color: #1a1a2e; line-height: 1.6;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 导航栏 ──────────────────────────── */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
    border-bottom: 1px solid #e5e7eb; padding: .7rem 0;
}
.nav-container {
    max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}
.nav-brand { font-weight: 700; font-size: 1.05rem; color: #1e3a5f; }
.nav-brand:hover { text-decoration: none; }
.nav-icon { margin-right: .25rem; }
.nav-links { display: flex; align-items: center; gap: 1.2rem; font-size: .9rem; }
.nav-links a { color: #4b5563; font-weight: 500; }
.nav-links a:hover { color: #2563eb; text-decoration: none; }
.nav-user {
    background: #eff6ff; color: #1d4ed8; padding: .2rem .7rem;
    border-radius: 20px; font-size: .82rem; font-weight: 600;
}
.nav-register {
    background: #2563eb; color: #fff !important; padding: .3rem .8rem;
    border-radius: 6px; font-size: .82rem;
}
.nav-register:hover { background: #1d4ed8; text-decoration: none; }
.nav-logout { color: #dc2626 !important; }

/* ── Flash 消息 ──────────────────────── */
.flash-container { max-width: 1200px; margin: 1rem auto 0; padding: 0 1.5rem; }
.flash {
    padding: .7rem 1rem; border-radius: 8px; margin-bottom: .5rem;
    display: flex; justify-content: space-between; align-items: center;
    font-size: .9rem; font-weight: 500;
}
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; }

/* ── 通用容器 ────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.main-content { min-height: calc(100vh - 140px); }

/* ── Hero 横条 ───────────────────────── */
.hero-bar {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: #fff; text-align: center; padding: 2.5rem 1.5rem;
}
.hero-bar h1 { font-size: 1.8rem; margin-bottom: .4rem; }
.hero-bar p  { font-size: 1rem; opacity: .85; }

/* ── 房间卡片网格 ─────────────────────── */
.room-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem; margin-top: 1.5rem;
}
.room-card {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); transition: transform .2s, box-shadow .2s;
}
.room-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.room-card-header {
    padding: 1.2rem 1.2rem .6rem; display: flex; justify-content: space-between; align-items: center;
}
.room-card-header h3 { font-size: 1.05rem; }
.room-capacity {
    font-size: .78rem; background: #eff6ff; color: #2563eb;
    padding: .15rem .5rem; border-radius: 12px; white-space: nowrap;
}
.room-card-body { padding: 0 1.2rem 1rem; }
.room-equipment { font-size: .88rem; color: #4b5563; margin-bottom: .4rem; }
.room-desc { font-size: .84rem; color: #6b7280; margin-bottom: .6rem; }
.room-today { font-size: .85rem; }
.status-free { color: #16a34a; font-weight: 600; }
.status-busy { color: #dc2626; font-weight: 600; }
.room-card-footer { padding: .8rem 1.2rem; border-top: 1px solid #f3f4f6; }

/* ── 按钮 ─────────────────────────────── */
.btn {
    display: inline-block; padding: .5rem 1.2rem; border-radius: 7px;
    font-size: .9rem; font-weight: 600; border: none; cursor: pointer;
    transition: all .2s; text-decoration: none !important;
}
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger    { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }

/* ── 认证页（登录/注册） ──────────────── */
.auth-container {
    min-height: calc(100vh - 140px); display: flex;
    align-items: center; justify-content: center; padding: 2rem;
}
.auth-card {
    background: #fff; padding: 2.5rem; border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 100%; max-width: 420px;
}
.auth-card h2 { font-size: 1.5rem; margin-bottom: .3rem; }
.auth-sub { color: #6b7280; font-size: .9rem; margin-bottom: 1.5rem; }
.auth-footer { text-align: center; margin-top: 1.2rem; font-size: .88rem; color: #6b7280; }

/* ── 表单 ─────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .3rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .55rem .8rem; border: 1px solid #d1d5db;
    border-radius: 8px; font-size: .9rem; transition: border .2s;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ── 房间详情页 ───────────────────────── */
.breadcrumb { font-size: .88rem; color: #6b7280; margin-bottom: 1.2rem; }
.breadcrumb a { color: #2563eb; }
.room-info-bar {
    display: flex; justify-content: space-between; align-items: flex-start;
    background: #fff; padding: 1.5rem; border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 1.5rem;
}
.room-info-bar h2 { font-size: 1.4rem; margin-bottom: .3rem; }
.room-meta { display: flex; gap: 1rem; font-size: .85rem; color: #6b7280; flex-wrap: wrap; }

/* ── 日期标签 ─────────────────────────── */
.date-tabs {
    display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .5rem;
    margin-bottom: 1.5rem; scrollbar-width: thin;
}
.date-tab {
    display: flex; flex-direction: column; align-items: center;
    padding: .5rem .8rem; border-radius: 10px;
    background: #fff; border: 1px solid #e5e7eb; min-width: 56px;
    text-decoration: none !important; transition: all .2s;
}
.date-tab:hover { border-color: #2563eb; }
.date-tab.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.date-tab.active .date-month { color: rgba(255,255,255,.8); }
.date-month { font-size: .72rem; color: #6b7280; }
.date-day   { font-size: 1.1rem; font-weight: 700; }

/* ── 时段网格 ─────────────────────────── */
.slots-container { background: #fff; border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.slots-legend { display: flex; gap: 1.5rem; margin-bottom: 1rem; font-size: .84rem; color: #6b7280; }
.legend-item { display: flex; align-items: center; gap: .3rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.dot-free     { background: #dcfce7; border: 1px solid #86efac; }
.dot-selected { background: #2563eb; border: 1px solid #1d4ed8; }
.dot-occupied { background: #e5e7eb; border: 1px solid #d1d5db; }
.dot-past     { background: #f9fafb; border: 1px solid #e5e7eb; }

.slots-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .5rem;
}
.slot {
    padding: .6rem .8rem; border-radius: 8px; text-align: center;
    font-size: .82rem; transition: all .2s;
}
.slot-free {
    background: #dcfce7; border: 1px solid #86efac; color: #166534;
}
.slot-free:hover { background: #22c55e; color: #fff; border-color: #22c55e; }
.slot-selected {
    background: #2563eb !important; border: 2px solid #1d4ed8 !important;
    color: #fff !important; box-shadow: 0 0 0 2px rgba(37,99,235,.3);
}
.slot-occupied {
    background: #f3f4f6; border: 1px solid #e5e7eb; color: #9ca3af;
}
.slot-past {
    background: #f9fafb; border: 1px solid #f3f4f6; color: #d1d5db;
}
.slot-time { display: block; font-weight: 600; }
.slot-booker { display: block; font-size: .75rem; margin-top: .15rem; }

/* ── 表格 ─────────────────────────────── */
.booking-table-wrap { overflow-x: auto; }
.booking-table {
    width: 100%; border-collapse: collapse; background: #fff;
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.booking-table th {
    background: #f8fafc; font-size: .82rem; color: #6b7280;
    text-align: left; padding: .7rem 1rem; border-bottom: 1px solid #e5e7eb;
}
.booking-table td {
    padding: .7rem 1rem; font-size: .88rem; border-bottom: 1px solid #f3f4f6;
}
.booking-table tr:last-child td { border-bottom: none; }
.row-past { opacity: .6; }

/* ── 状态标签 ─────────────────────────── */
.status-tag {
    display: inline-block; padding: .15rem .55rem; border-radius: 12px;
    font-size: .78rem; font-weight: 600;
}
.tag-active   { background: #dcfce7; color: #166534; }
.tag-cancelled{ background: #fee2e2; color: #991b1b; }
.tag-done     { background: #f3f4f6; color: #6b7280; }
.tag-admin    { background: #fef3c7; color: #92400e; }
.tag-teacher  { background: #eff6ff; color: #1d4ed8; }

/* ── 徽章 ─────────────────────────────── */
.badge {
    display: inline-block; background: #2563eb; color: #fff;
    padding: .1rem .55rem; border-radius: 12px; font-size: .78rem; font-weight: 600;
}
.badge-gray { background: #9ca3af; }

/* ── 章节头 ──────────────────────────── */
.section-header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.section-header h3 { font-size: 1.1rem; }

/* ── 页面标题 ─────────────────────────── */
.page-title { font-size: 1.5rem; margin-bottom: 1.5rem; }

/* ── 空状态 ──────────────────────────── */
.empty-state { text-align: center; padding: 2rem; color: #9ca3af; }
.empty-state p { margin-bottom: .8rem; }

/* ── 筛选栏 ──────────────────────────── */
.filter-bar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: .8rem; margin-bottom: 1.5rem;
    background: #fff; padding: 1rem 1.2rem; border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.filter-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-form select, .filter-form input {
    padding: .4rem .6rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: .85rem;
}

/* ── 底部悬浮预约栏 ─────────────────── */
.booking-bar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
    background: #fff; border-top: 1px solid #e5e7eb;
    padding: .8rem 1.5rem; display: flex;
    justify-content: space-between; align-items: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,.1);
}
.booking-bar-info { display: flex; align-items: center; gap: .8rem; }
.booking-bar-count { font-size: .95rem; color: #374151; }

/* ── 弹窗内时段标签列表 ───────────────── */
.modal-slot-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.modal-slot-tag {
    display: inline-block; background: #eff6ff; color: #1d4ed8;
    padding: .2rem .6rem; border-radius: 6px; font-size: .82rem; font-weight: 600;
    border: 1px solid #bfdbfe;
}

/* ── 弹窗 ─────────────────────────────── */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-content {
    background: #fff; border-radius: 14px; width: 100%; max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2); overflow: hidden;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.2rem 1.5rem; border-bottom: 1px solid #f3f4f6;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #9ca3af; }
.modal-body { padding: 1.2rem 1.5rem; }
.modal-body p { margin-bottom: .5rem; font-size: .92rem; }
.modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid #f3f4f6;
    display: flex; justify-content: flex-end; gap: .5rem;
}

/* ── 页脚 ─────────────────────────────── */
.footer {
    text-align: center; padding: 1.5rem; font-size: .82rem; color: #9ca3af;
    border-top: 1px solid #e5e7eb; margin-top: 2rem;
}

/* ── 响应式 ───────────────────────────── */
@media (max-width: 768px) {
    .nav-container { flex-direction: column; gap: .4rem; }
    .nav-links { gap: .8rem; flex-wrap: wrap; justify-content: center; }
    .room-grid { grid-template-columns: 1fr; }
    .room-info-bar { flex-direction: column; gap: .8rem; }
    .slots-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-form { flex-direction: column; }
    .hero-bar h1 { font-size: 1.4rem; }
}

@media (max-width: 480px) {
    .slots-grid { grid-template-columns: 1fr; }
    .date-tabs { gap: .3rem; }
    .date-tab { min-width: 46px; padding: .4rem .5rem; }
}
