﻿/* ============================================
   悄悄话 - 样式表
   淡蓝色 Mac 风格 · 悬浮动效
   ============================================ */

/* --- 基础重置 & 全局 --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --blue-50: #EFF6FF;
  --blue-100: #DBEAFE;
  --blue-200: #BFDBFE;
  --blue-300: #93C5FD;
  --blue-400: #60A5FA;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --red-500: #EF4444;
  --red-600: #DC2626;
  --green-500: #22C55E;
  --green-600: #16A34A;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.10), 0 8px 10px -6px rgba(0,0,0,0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.35s cubic-bezier(0.25, 0.8, 0.25, 1.2);
}

html {
  font-size: 15px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--blue-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- 屏幕切换 --- */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
}

/* --- 登录/注册界面 --- */
#login-screen, #register-screen {
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--blue-50) 0%, var(--blue-100) 40%, #E0E7FF 100%);
  position: relative;
}

.bg-decoration {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-decoration::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
  border-radius: 50%;
}
.bg-decoration::after {
  content: "";
  position: absolute;
  bottom: -100px;
  left: -60px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(99,102,241,0.10) 0%, transparent 70%);
  border-radius: 50%;
}

.auth-card {
  width: 400px;
  max-width: 92vw;
  padding: 40px 36px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.auth-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 35px -8px rgba(0,0,0,0.12);
}

.card-header {
  text-align: center;
  margin-bottom: 28px;
}
.app-icon {
  font-size: 40px;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.card-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: 0.02em;
}
.subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* --- 表单 --- */
.auth-form, .compose-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.input-group-grow {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0.01em;
}
.input-group input,
.input-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  outline: none;
}
.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.10);
  transform: translateY(-1px);
}
.input-group input:hover,
.input-group textarea:hover {
  border-color: var(--blue-300);
}
.input-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.7;
}

.input-hint {
  font-size: 0.78rem;
  color: var(--green-600);
  font-weight: 500;
}

.char-count {
  text-align: right;
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
}
.btn:active {
  transform: scale(0.97);
}
.btn-full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-500) 0%, var(--blue-600) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}
.btn-secondary:hover {
  background: var(--gray-200);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--red-500);
  color: var(--white);
}
.btn-danger:hover {
  background: var(--red-600);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  padding: 6px 12px;
  font-weight: 500;
  font-size: 0.82rem;
}
.btn-ghost:hover {
  background: rgba(0,0,0,0.04);
  color: var(--gray-800);
}
.btn-icon {
  font-size: 1.1rem;
  padding: 6px 8px;
}

.btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  position: absolute;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- 认证切换链接 --- */
.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 0.82rem;
  color: var(--gray-500);
}
.auth-switch a {
  color: var(--blue-600);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}
.auth-switch a:hover {
  color: var(--blue-700);
}

/* --- 错误/成功消息 --- */
.form-error, .form-success {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
}
.form-error {
  background: #FEF2F2;
  color: var(--red-600);
  border: 1px solid #FECACA;
}
.form-success {
  background: #F0FDF4;
  color: var(--green-600);
  border: 1px solid #BBF7D0;
}

/* --- 顶部栏 --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-icon {
  font-size: 22px;
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: 0.03em;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-user {
  font-size: 0.85rem;
  color: var(--gray-600);
  font-weight: 500;
  margin-right: 8px;
}

/* --- 主体布局 --- */
#main-screen {
  flex-direction: column;
  height: 100vh;
  background: var(--blue-50);
}
.main-body {
  display: flex;
  flex: 1;
  gap: 1px;
  background: var(--gray-200);
  overflow: hidden;
}

/* --- 面板 --- */
.panel {
  background: var(--white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}
.panel-messages {
  width: 45%;
  min-width: 320px;
}
.panel-compose {
  flex: 1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 12px;
  flex-shrink: 0;
}
.panel-header h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-700);
  letter-spacing: 0.02em;
}

/* --- 未读徽标 --- */
.badge {
  background: var(--red-500);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes popIn {
  0% { transform: scale(0); }
  80% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* --- 留言列表 --- */
.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-item {
  padding: 16px 18px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
}
.message-item:hover {
  background: var(--blue-50);
  border-color: var(--blue-200);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.message-item.unread {
  border-left: 3px solid var(--blue-500);
  background: #F0F7FF;
}
.message-item.unread::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 14px;
  width: 8px;
  height: 8px;
  background: var(--blue-500);
  border-radius: 50%;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.message-sender {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue-700);
}
.message-time {
  font-size: 0.7rem;
  color: var(--gray-400);
}
.message-body {
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-100);
}
.message-actions .btn {
  font-size: 0.75rem;
  padding: 4px 12px;
}

/* --- 空状态 --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--gray-400);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.empty-state p {
  font-size: 0.9rem;
  font-weight: 500;
}
.empty-hint {
  font-size: 0.78rem !important;
  color: var(--gray-300);
  margin-top: 4px;
  font-weight: 400 !important;
}

/* --- 发送表单 --- */
.compose-form {
  flex: 1;
  padding: 0 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

/* --- Toast --- */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
  opacity: 0;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  pointer-events: auto;
}
.toast.success {
  background: #F0FDF4;
  color: var(--green-700);
  border: 1px solid #BBF7D0;
}
.toast.error {
  background: #FEF2F2;
  color: var(--red-600);
  border: 1px solid #FECACA;
}

/* --- 确认弹窗 --- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  animation: fadeIn 0.2s ease;
}
.dialog-card {
  background: var(--white);
  padding: 28px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 360px;
  width: 90%;
  animation: slideUp 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.dialog-card p {
  font-size: 0.95rem;
  color: var(--gray-700);
  margin-bottom: 20px;
  line-height: 1.5;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- 隐藏 --- */
.hidden {
  display: none !important;
}

/* --- 滚动条美化 --- */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* --- 加载骨架 --- */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* --- 响应式 --- */
@media (max-width: 700px) {
  .main-body {
    flex-direction: column;
  }
  .panel-messages {
    width: 100%;
    min-width: 0;
    max-height: 45%;
  }
  .panel-compose {
    max-height: 55%;
  }
  .auth-card {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar-user {
    display: none;
  }
}
