/**
 * 浏览器前端登录页面样式
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color, #f5f7fa);
  color: var(--text-color, #2c3e50);
  display: flex;
  flex-direction: column;
}

/* 背景装饰 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 80%, var(--primary-color, #3498db) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, var(--accent-color, #3498db) 0%, transparent 50%);
  opacity: 0.12;
  pointer-events: none;
}

/* 浏览器模式下隐藏 Electron 专用元素 */
.browser-mode .electron-only,
.browser-mode .titlebar {
  display: none !important;
}

/* 标题栏 */
.titlebar {
  height: 32px;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  -webkit-app-region: drag;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color, #dee2e6);
}

.titlebar-title {
  padding-left: 12px;
  font-size: 12px;
  opacity: 0.8;
}

.titlebar-controls {
  display: flex;
  -webkit-app-region: no-drag;
}

.titlebar-btn {
  width: 46px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-color, #2c3e50);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s;
}

.titlebar-btn:hover { background: rgba(255,255,255,0.1); opacity: 1; }
.titlebar-btn.close:hover { background: #e81123; }

/* 主容器 */
.main-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  min-height: 0;
}

/* 侧边工具栏 */
.side-toolbar {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.tool-btn {
  min-width: 52px;
  height: auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color, #dee2e6);
  background: var(--card-bg, #ffffff);
  color: var(--text-color, #2c3e50);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.3s;
  backdrop-filter: blur(10px);
}

.tool-btn:hover {
  background: var(--primary-color, #3498db);
  transform: scale(1.05);
  border-color: var(--primary-color, #3498db);
}

.tool-btn .btn-icon {
  font-size: 18px;
  line-height: 1;
}

.tool-btn .btn-text {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
  white-space: nowrap;
}

/* 卡片容器 */
.card-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.app-header {
  text-align: center;
}

.app-header h1 {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color, #3498db), var(--accent-color, #3498db));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 14px;
  color: var(--text-muted, #7f8c8d);
  margin-top: 4px;
}

/* 滑动容器 */
.slider-wrapper {
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: var(--card-bg, #ffffff);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color, #dee2e6);
  position: relative;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 12px 0;
}

.mode-tab {
  border: 1px solid var(--border-color, #dee2e6);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted, #7f8c8d);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab:hover {
  color: var(--text-color, #2c3e50);
  border-color: var(--primary-color, #3498db);
}

.mode-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-color, #3498db), var(--accent-color, #3498db));
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(102,126,234,0.25);
}

.slider-track {
  display: flex;
  width: 200%;
  transition: transform 0.32s ease;
}

.slide {
  flex: 0 0 50%;
  min-width: 0;
  padding: 20px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slide-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color, #dee2e6);
}

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

.slide-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slide-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-color, #3498db);
}

.slide-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted, #7f8c8d);
}

.slide-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 登录表单 */
#userLoginForm,
#adminLoginForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#userLoginForm .btn-primary,
#adminLoginForm .btn-primary {
  width: 100%;
  margin-top: 6px;
}

/* 输入框 */
.input-group {
  position: relative;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg, #ffffff);
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 10px;
  color: var(--text-color, #2c3e50);
  font-size: 14px;
  transition: all 0.2s;
}

/* 密码输入框组 */
.password-group input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #7f8c8d);
  transition: all 0.2s;
}

.password-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-color, #2c3e50);
}

.password-toggle:active {
  background: var(--primary-color, #3498db);
  color: #fff;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color, #3498db);
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}

.input-group input::placeholder {
  color: var(--text-muted, #7f8c8d);
}

/* 复选框 */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted, #7f8c8d);
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color, #3498db);
}

.checkbox-row input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.checkbox-row input:disabled + span {
  opacity: 0.4;
}

/* 记住选项 */
.remember-options {
  display: flex;
  gap: 16px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* 按钮 */
.btn-primary {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: linear-gradient(135deg, var(--primary-color, #3498db), var(--accent-color, #3498db));
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 加载状态 */
.btn-primary.loading {
  position: relative;
  color: transparent;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 自动登录倒计时按钮样式 */
.btn-primary.auto-login-countdown {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  animation: countdown-pulse 1s infinite;
}

@keyframes countdown-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}

/* 错误消息 */
.error-msg {
  padding: 8px 12px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  color: #EF4444;
  font-size: 12px;
  text-align: center;
  display: none;
}

.error-msg.show { display: block; }

/* 版本信息 */
.version-info {
  font-size: 12px;
  color: var(--text-muted, #7f8c8d);
  text-align: center;
}

/* 帮助弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: var(--card-bg, rgba(30,30,50,0.95));
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #dee2e6);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted, #7f8c8d);
  font-size: 24px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-color, #2c3e50);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-body h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--primary-color, #3498db);
}

.modal-body p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted, #7f8c8d);
  margin-bottom: 12px;
}

.modal-body ul {
  margin: 0 0 16px 20px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-muted, #7f8c8d);
}

/* 响应式 - 小窗口 */
@media (max-height: 500px) {
  .main-container { padding: 8px; }
  .card-container { gap: 10px; }
  .app-header h1 { font-size: 18px; }
  .mode-switch { padding: 10px 10px 0; }
  .slide { padding: 14px; gap: 10px; }
  .slide-header { padding-bottom: 8px; }
  .input-group input { padding: 10px 12px; }
  .btn-primary { padding: 8px 12px; }
}

@media (max-width: 400px) {
  .side-toolbar { left: 8px; }
  .tool-btn { min-width: 40px; padding: 8px; }
  .tool-btn .btn-text { display: none; }
  .remember-options {
    gap: 10px;
    flex-wrap: wrap;
    white-space: normal;
  }
  .mode-tab {
    padding: 9px 10px;
    font-size: 12px;
  }
}

/* 滚动条 */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
