/* ========================================
   Jalen 个人工作台 - 样式
   沿用主页极简暗黑风格
   ======================================== */

/* CSS 变量 - 与主页保持一致 */
:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --bg-card: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --accent: #ffffff;
  --accent-gray: #888888;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --gradient-1: rgba(255, 255, 255, 0.03);
  --danger: #ff4757;
  --success: #2ed573;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --radius: 16px;
  --radius-sm: 10px;
}

/* 重置样式 */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea {
  font-family: inherit;
}

::selection {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-gray);
  border-radius: 3px;
}

/* ========================================
   登录视图
   ======================================== */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 2rem;
}

.login-view.hidden {
  display: none;
}

/* 登录背景装饰 */
.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.08;
}

.login-orb-1 {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  top: -15%;
  right: -10%;
  animation: orbFloat 20s ease-in-out infinite;
}

.login-orb-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #0f3460, #16213e);
  bottom: -10%;
  left: -8%;
  animation: orbFloat 25s ease-in-out infinite reverse;
}

.login-orb-3 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  top: 40%;
  left: 40%;
  animation: orbFloat 30s ease-in-out infinite;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(30px, -30px); }
  50% { transform: translate(-20px, 20px); }
  75% { transform: translate(20px, 30px); }
}

/* 登录容器 */
.login-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: loginFadeIn 0.8s var(--ease-out);
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 登录 Logo */
.login-logo {
  text-align: center;
  margin-bottom: 3rem;
}

.login-logo-link {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--text-primary);
  transition: opacity 0.3s;
}

.login-logo-link:hover {
  opacity: 0.7;
}

/* 登录标题 */
.login-title {
  font-size: 1.75rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

/* 登录表单 */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-form .form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.login-form .form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.login-form .form-group input::placeholder {
  color: var(--text-muted);
}

.login-form .form-group input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* 密码输入框 */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 3rem;
}

.toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.25rem;
  color: var(--text-muted);
  transition: color 0.3s;
  display: flex;
  align-items: center;
}

.toggle-password:hover {
  color: var(--text-secondary);
}

.eye-icon {
  width: 18px;
  height: 18px;
}

/* 错误提示 */
.login-error {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--danger);
  animation: shakeError 0.5s var(--ease-out);
}

.login-error.show {
  display: flex;
}

.error-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* 登录按钮 */
.login-btn {
  width: 100%;
  padding: 0.9rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--bg-primary);
  background: var(--text-primary);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
  margin-top: 0.5rem;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn.loading .login-btn-text {
  opacity: 0;
}

.login-btn.loading .login-btn-loader {
  opacity: 1;
}

.login-btn-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: var(--bg-primary);
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 登录底部 */
.login-footer {
  text-align: center;
  margin-top: 2rem;
}

.login-footer a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.3s;
}

.login-footer a:hover {
  color: var(--text-primary);
}

/* ========================================
   工作台视图
   ======================================== */
.dashboard-view {
  display: none;
  min-height: 100vh;
  animation: dashFadeIn 0.6s var(--ease-out);
}

.dashboard-view.active {
  display: block;
}

@keyframes dashFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 顶部导航 */
.dash-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.dash-nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-logo {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  transition: opacity 0.3s;
}

.dash-logo:hover {
  opacity: 0.7;
}

.dash-divider {
  color: var(--text-muted);
  font-weight: 200;
}

.dash-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.dash-nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.dash-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.user-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 50px;
  transition: all 0.3s;
}

.logout-btn:hover {
  color: var(--danger);
  border-color: rgba(255, 71, 87, 0.3);
  background: rgba(255, 71, 87, 0.05);
}

/* 主内容区 */
.dash-main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* 网格布局 */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

/* 卡片通用样式 */
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.3s;
  animation: cardSlideUp 0.5s var(--ease-out) both;
}

.dash-card:nth-child(1) { animation-delay: 0.05s; }
.dash-card:nth-child(2) { animation-delay: 0.1s; }
.dash-card:nth-child(3) { animation-delay: 0.15s; }
.dash-card:nth-child(4) { animation-delay: 0.2s; }
.dash-card:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dash-card:hover {
  border-color: var(--border-hover);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

.card-title svg {
  opacity: 0.5;
}

/* ========================================
   欢迎卡片
   ======================================== */
.welcome-card {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
  padding: 2rem 2.5rem;
}

.welcome-greeting {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.welcome-name {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.welcome-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.welcome-clock {
  text-align: right;
}

.clock-time {
  font-size: 3rem;
  font-weight: 200;
  letter-spacing: 0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ========================================
   数据概览
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-box {
  text-align: center;
  padding: 1rem 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   待办事项
   ======================================== */
.todo-card {
  min-height: 350px;
}

.todo-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.todo-form input {
  flex: 1;
  padding: 0.7rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.3s;
}

.todo-form input::placeholder {
  color: var(--text-muted);
}

.todo-form input:focus {
  border-color: var(--border-hover);
}

.todo-add-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}

.todo-add-btn:hover {
  transform: scale(1.05);
}

.todo-add-btn:active {
  transform: scale(0.95);
}

.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.2s, opacity 0.3s;
  animation: todoSlideIn 0.3s var(--ease-out);
}

@keyframes todoSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.todo-item:hover {
  border-color: var(--border);
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-checkbox {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--accent-gray);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.todo-checkbox:hover {
  border-color: var(--text-primary);
}

.todo-item.completed .todo-checkbox {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.todo-checkbox svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.todo-item.completed .todo-checkbox svg {
  opacity: 1;
}

.todo-text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: color 0.3s;
  word-break: break-word;
}

.todo-delete {
  opacity: 0;
  color: var(--text-muted);
  padding: 0.25rem;
  transition: opacity 0.2s, color 0.2s;
  display: flex;
  align-items: center;
}

.todo-item:hover .todo-delete {
  opacity: 1;
}

.todo-delete:hover {
  color: var(--danger);
}

.todo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.todo-empty.hidden {
  display: none;
}

/* ========================================
   快捷笔记
   ======================================== */
.notes-card {
  min-height: 350px;
}

.save-status {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s;
}

.save-status.show {
  opacity: 1;
}

.notes-textarea {
  width: 100%;
  min-height: 240px;
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  transition: border-color 0.3s;
}

.notes-textarea::placeholder {
  color: var(--text-muted);
}

.notes-textarea:focus {
  border-color: var(--border-hover);
}

/* ========================================
   常用链接
   ======================================== */
.links-card {
  min-height: 350px;
}

.links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
  animation: todoSlideIn 0.3s var(--ease-out);
}

.link-item:hover {
  border-color: var(--border);
  background: var(--bg-tertiary);
}

.link-favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.link-info {
  flex: 1;
  min-width: 0;
}

.link-name {
  font-size: 0.85rem;
  font-weight: 500;
  display: block;
}

.link-url {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-delete {
  opacity: 0;
  color: var(--text-muted);
  padding: 0.25rem;
  transition: opacity 0.2s, color 0.2s;
  display: flex;
  align-items: center;
}

.link-item:hover .link-delete {
  opacity: 1;
}

.link-delete:hover {
  color: var(--danger);
}

/* 添加链接表单 */
.link-form {
  display: flex;
  gap: 0.5rem;
}

.link-form input {
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.3s;
}

.link-form input::placeholder {
  color: var(--text-muted);
}

.link-form input:focus {
  border-color: var(--border-hover);
}

#link-name {
  width: 80px;
  flex-shrink: 0;
}

#link-url {
  flex: 1;
  min-width: 0;
}

.link-add-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.link-add-btn:hover {
  transform: scale(1.05);
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .welcome-clock {
    text-align: center;
  }

  .clock-time {
    font-size: 2.5rem;
  }

  .dash-main {
    padding: 1.5rem;
  }
}

@media (max-width: 600px) {
  .dash-nav {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .dash-nav-right {
    gap: 0.75rem;
  }

  .dash-date {
    display: none;
  }

  .user-name {
    display: none;
  }

  .logout-btn span {
    display: none;
  }

  .dash-main {
    padding: 1rem;
  }

  .dash-card {
    padding: 1.25rem;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .stat-box {
    padding: 0.75rem 0.25rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .link-form {
    flex-wrap: wrap;
  }

  #link-name {
    width: 100%;
  }
}
