/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航栏 */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-title {
  color: white;
  font-size: 24px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 用户菜单 */
.user-menu {
  position: relative;
  cursor: pointer;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.user-avatar:hover {
  background: rgba(255, 255, 255, 0.3);
}

.avatar-icon {
  font-size: 20px;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  display: none;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-user-info {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

.dropdown-username {
  display: block;
  font-weight: 600;
  color: #333;
}

.dropdown-role {
  display: block;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.dropdown-divider {
  height: 1px;
  background: #eee;
}

.dropdown-item {
  display: block;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #f5f7fa;
}

/* 登录按钮 */
.login-btn {
  padding: 8px 20px;
  background: white;
  color: #667eea;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.login-btn:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

/* 内联登录表单 */
.inline-login-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-username,
.inline-password {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  width: 100px;
  transition: all 0.2s;
}

.inline-username:focus,
.inline-password:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.8);
  background: white;
}

.inline-username::placeholder,
.inline-password::placeholder {
  color: #999;
}

.inline-password {
  width: 90px;
}

.inline-login-btn {
  padding: 6px 16px;
  background: white;
  color: #667eea;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.inline-login-btn:hover {
  background: #f0f0f0;
}

.inline-login-error {
  color: #ff6b6b;
  font-size: 12px;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
}

body:not(.logged-in) .inline-login-form {
  display: flex;
}

body.logged-in .inline-login-form {
  display: none;
}

/* 页签导航 */
.tabs {
  background: white;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e8e8e8;
}

.tab {
  padding: 16px 24px;
  background: none;
  border: none;
  font-size: 15px;
  color: #666;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab:hover {
  color: #333;
}

.tab.active {
  color: #667eea;
  font-weight: 500;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #667eea;
  border-radius: 3px 3px 0 0;
}

/* 主内容区 */
.content {
  flex: 1;
  padding: 24px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 入口网格 */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

/* 入口卡片 */
.portal-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: inherit;
  display: block;
}

.portal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.portal-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.portal-name {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
}

.portal-desc {
  font-size: 13px;
  color: #999;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px;
  color: #999;
  grid-column: 1 / -1;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

/* 登录表单 */
.login-form {
  padding: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.form-error {
  color: #e74c3c;
  font-size: 13px;
  margin-bottom: 16px;
  min-height: 18px;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.submit-btn:hover {
  opacity: 0.9;
}

/* 权限提示 */
.permission-message {
  padding: 24px;
  text-align: center;
  color: #666;
}

.permission-message p {
  margin-bottom: 8px;
}

/* 表单底部 */
.form-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: #666;
}

.form-footer a {
  color: #667eea;
  text-decoration: none;
  margin-left: 4px;
}

.form-footer a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 3000;
}

.toast {
  background: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in 0.3s ease-out;
  min-width: 280px;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast-icon {
  font-size: 20px;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: #333;
}

@keyframes toast-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.settings-content {
  padding: 24px;
}

.settings-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.admin-only-section {
  display: none;
}

.admin-only-section.visible {
  display: block;
}

.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
  background: white;
}

.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

body:not(.logged-in) .tabs,
body:not(.logged-in) .content,
body:not(.logged-in) .portal-grid {
  display: none !important;
}

body.logged-in .login-btn {
  display: none !important;
}

body:not(.logged-in) .login-btn {
  display: none !important;
}

/* 万神殿按钮 */
.pantheon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.pantheon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.pantheon-icon {
  font-size: 18px;
}
