/* ════════════ layout.css ════════════ */

/* ── 登录页背景 ── */
#login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1629 0%, #1a2f6e 45%, #2d1b69 100%);
  position: relative; overflow: hidden;
}
.login-bg-shapes .shape {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.shape.s1 { width:500px;height:500px; top:-150px; right:-120px; background:rgba(79,110,247,.08); }
.shape.s2 { width:300px;height:300px; bottom:-60px; left:-60px; background:rgba(124,58,237,.08); }
.shape.s3 { width:200px;height:200px; top:35%; left:8%; background:rgba(255,255,255,.03); }

/* ── 门户入口选择页 ── */
.login-portal {
  position: relative; z-index: 1;
  width: 520px; max-width: calc(100vw - 32px);
  text-align: center;
  animation: fadeSlideUp .45s ease both;
}
@keyframes fadeSlideUp {
  from { opacity:0; transform: translateY(24px); }
  to   { opacity:1; transform: translateY(0); }
}
.portal-header { margin-bottom: 36px; }
.portal-icon {
  font-size: 52px; display: block; margin-bottom: 14px;
  filter: drop-shadow(0 4px 12px rgba(79,110,247,.5));
}
.portal-header h1 {
  font-size: 26px; font-weight: 800; color: #fff;
  letter-spacing: .01em; margin-bottom: 6px;
}
.portal-header p { font-size: 13px; color: rgba(255,255,255,.45); letter-spacing:.06em; }

.portal-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; }
.portal-card {
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: 18px; padding: 32px 20px 28px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform .2s, border-color .2s, background .2s;
  backdrop-filter: blur(12px);
}
.portal-card::before {
  content: ''; position: absolute; inset: 0; border-radius: 18px;
  opacity: 0; transition: opacity .2s;
}
.student-portal::before { background: linear-gradient(135deg, rgba(34,197,94,.12), rgba(16,185,129,.08)); }
.teacher-portal::before { background: linear-gradient(135deg, rgba(79,110,247,.15), rgba(124,58,237,.10)); }
.portal-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.3); }
.portal-card:hover::before { opacity: 1; }
.student-portal:hover { border-color: rgba(34,197,94,.5); }
.teacher-portal:hover { border-color: rgba(79,110,247,.5); }

.portal-card-icon {
  font-size: 38px; display: block; margin-bottom: 14px;
  position: relative; z-index: 1;
}
.portal-card-title {
  font-size: 17px; font-weight: 800; color: #fff;
  margin-bottom: 6px; position: relative; z-index: 1;
}
.portal-card-desc {
  font-size: 12.5px; color: rgba(255,255,255,.5);
  position: relative; z-index: 1; line-height: 1.5;
}
.portal-card-arrow {
  position: absolute; bottom: 14px; right: 18px;
  font-size: 18px; color: rgba(255,255,255,.2);
  transition: color .2s, transform .2s;
}
.portal-card:hover .portal-card-arrow { color: rgba(255,255,255,.7); transform: translateX(4px); }
.portal-footer { font-size: 12px; color: rgba(255,255,255,.25); }

/* ── 登录表单卡片 ── */
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 40px 32px;
  width: 460px; max-width: calc(100vw - 32px);
  box-shadow: 0 32px 100px rgba(0,0,0,.4);
  position: relative; z-index: 1;
  animation: fadeSlideUp .35s ease both;
}
.login-back-btn {
  position: absolute; top: 18px; left: 18px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--gray-400); padding: 4px 8px;
  border-radius: var(--radius); transition: color .15s, background .15s;
}
.login-back-btn:hover { color: var(--primary); background: var(--primary-light); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-icon {
  font-size: 38px; display: block; margin-bottom: 10px;
  filter: drop-shadow(0 2px 6px rgba(79,110,247,.3));
}
.login-logo h1 {
  font-size: 19px; font-weight: 800;
  background: linear-gradient(135deg,#4f6ef7,#7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-logo p { font-size: 12px; color: var(--gray-400); margin-top: 4px; letter-spacing:.04em; }
.login-error {
  background: #fef2f2; border: 1px solid #fecaca;
  color: #dc2626; padding: 10px 14px;
  border-radius: var(--radius); margin-bottom: 16px;
  font-size: 13px; display: none;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; color: var(--gray-700); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 15px; pointer-events: none;
}
.input-wrap input {
  width: 100%; padding: 11px 14px 11px 38px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  background: var(--gray-50); font-size: 14px; outline: none;
  transition: border-color .2s, background .2s;
}
.input-wrap input:focus { border-color: var(--primary); background: #fff; }
.btn-login {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, #4f6ef7, #7c3aed);
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: opacity .2s, transform .1s;
  margin-bottom: 20px;
}
.btn-login.student-btn { background: linear-gradient(135deg, #22c55e, #16a34a); }
.btn-login:hover { opacity: .9; }
.btn-login:active { transform: scale(.98); }
.login-accounts { border-top: 1px solid var(--gray-100); padding-top: 14px; }
.login-accounts-title { font-size: 11.5px; color: var(--gray-400); margin-bottom: 10px; font-weight: 600; text-transform: uppercase; letter-spacing:.06em; }
.login-accounts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.account-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.account-item:hover { border-color: var(--primary); background: var(--primary-light); }
.account-role {
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 20px; white-space: nowrap;
}
.account-role.admin   { background: #fef3c7; color: #92400e; }
.account-role.teacher { background: #dbeafe; color: #1e40af; }
.account-role.student { background: #dcfce7; color: #166534; }
.account-info { font-size: 12px; color: var(--gray-600); }

/* ── 退出登录确认弹窗 ── */
#logout-confirm-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
}
#logout-confirm-overlay.active { display: flex; }
.logout-confirm-box {
  background: #fff; border-radius: 16px;
  padding: 32px 36px 24px; text-align: center;
  width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: fadeSlideUp .25s ease both;
}
.logout-confirm-icon { font-size: 44px; margin-bottom: 12px; }
.logout-confirm-title { font-size: 17px; font-weight: 800; color: var(--gray-900); margin-bottom: 6px; }
.logout-confirm-desc { font-size: 13px; color: var(--gray-500); margin-bottom: 24px; }
.logout-confirm-btns { display: flex; gap: 10px; }
.logout-confirm-btns button {
  flex: 1; padding: 10px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  transition: opacity .15s, transform .1s;
}
.logout-confirm-btns button:active { transform: scale(.97); }
.btn-cancel-logout { background: var(--gray-100); color: var(--gray-700); }
.btn-cancel-logout:hover { background: var(--gray-200); }
.btn-confirm-logout { background: linear-gradient(135deg,#ef4444,#dc2626); color: #fff; }
.btn-confirm-logout:hover { opacity: .9; }

/* ── 移动端顶部导航栏 ── */
.mobile-topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: 52px;
  background: #0f1629;
  align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.mobile-brand {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-size: 15px; font-weight: 700;
}
.mobile-brand-icon { font-size: 20px; }
.hamburger-btn {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px;
  padding: 6px;
}
.hamburger-btn span {
  display: block; width: 22px; height: 2px;
  background: rgba(255,255,255,.85); border-radius: 2px;
  transition: all .25s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 移动端抽屉遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,.45);
}
.sidebar-overlay.active { display: block; }

/* ── 主布局 ── */
#app { height: 100vh; }
.layout { display: flex; height: 100%; }

/* ── 侧边栏 ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #0f1629;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-icon { font-size: 24px; flex-shrink: 0; }
.brand-name { font-size: 14px; font-weight: 700; color: #fff; }
.brand-sub  { font-size: 11px; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-section-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.28);
  padding: 10px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius);
  color: rgba(255,255,255,.6); cursor: pointer;
  transition: all .15s; margin-bottom: 2px;
  font-size: 13.5px; font-weight: 500;
}
.nav-item:hover  { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.75);
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.22); }

.nav-item { position: relative; }
.nav-dot {
  margin-left: auto;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  animation: navDotPulse 2s infinite;
}
@keyframes navDotPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: default;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-sub  { font-size: 11px; color: rgba(255,255,255,.4); }
.logout-btn {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.35); font-size: 18px;
  padding: 4px; transition: color .15s;
}
.logout-btn:hover { color: var(--danger); }

/* ── 主内容 ── */
.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: #fff; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.topbar-title { font-size: 17px; font-weight: 800; }
.topbar-breadcrumb { font-size: 13px; color: var(--gray-400); margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-greeting { font-size: 13px; color: var(--gray-500); }
.topbar-greeting strong { color: var(--gray-800); }
.topbar-logout-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--radius);
  background: none; border: 1.5px solid var(--gray-200);
  color: var(--gray-500); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.topbar-logout-btn:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.logout-icon { font-size: 14px; }

.content {
  flex: 1; overflow-y: auto;
  padding: 24px;
}
