/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-blue: #0052D9;
  --primary-blue-light: #D9E8FF;
  --primary-blue-hover: #366EF4;
  --accent-purple: #7B61FF;
  --accent-purple-light: #E8E3FF;
  --white: #FFFFFF;
  --gray-50: #F5F5F5;
  --gray-100: #F0F0F0;
  --gray-200: #E4E4E4;
  --gray-300: #D9D9D9;
  --gray-400: #BFBFBF;
  --gray-500: #8C8C8C;
  --gray-600: #595959;
  --gray-700: #434343;
  --gray-800: #262626;
  --success: #00A870;
  --warning: #ED7B2F;
  --error: #E34D59;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #F0F5FF 0%, #FFFFFF 100%);
  min-height: 100vh;
  color: var(--gray-800);
}

/* ==================== 登录页面 ==================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  color: var(--primary-blue);
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #0052D9 0%, #7B61FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--gray-500);
  font-size: 14px;
}

.login-form {
  margin-bottom: 32px;
}

.form-item {
  margin-bottom: 20px;
}

.form-item label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.3s;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 82, 217, 0.1);
}

.login-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0052D9 0%, #7B61FF 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.login-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-features {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
}

.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--gray-500);
  font-size: 13px;
}

.feature-item span:first-child {
  font-size: 24px;
}

/* 在线用户列表 */
.online-users {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
}

.online-users h3 {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 16px;
  text-align: center;
}

.user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--gray-50);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-item:hover {
  background: var(--primary-blue-light);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0052D9 0%, #7B61FF 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.user-avatar.small {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.username {
  font-size: 13px;
  color: var(--gray-700);
}

/* ==================== 应用容器 ==================== */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* 顶部导航 */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #0052D9 0%, #7B61FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  transition: all 0.3s;
}

.sync-status.synced {
  background: rgba(0, 168, 112, 0.1);
  color: var(--success);
}

.sync-status.syncing {
  background: rgba(0, 82, 217, 0.1);
  color: var(--primary-blue);
}

.sync-status.offline {
  background: rgba(191, 191, 191, 0.2);
  color: var(--gray-500);
}

.sync-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 12px;
  background: var(--white);
  color: var(--primary-blue);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.sync-btn:hover:not(:disabled) {
  background: var(--primary-blue-light);
}

.sync-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.current-time {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-500);
  font-size: 14px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--gray-50);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  color: var(--gray-700);
}

.user-info:hover {
  background: var(--gray-100);
}

.user-menu {
  position: absolute;
  top: 100%;
  right: 20px;
  margin-top: 8px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  min-width: 120px;
  z-index: 100;
}

.menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.menu-item:hover {
  background: var(--gray-50);
  color: var(--error);
}

/* 主内容区 */
.main-content {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* 卡片区域 */
.tasks-section,
.alarm-section {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-800);
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #0052D9 0%, #7B61FF 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.add-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* 统计卡片 */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--gray-100);
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-icon {
  font-size: 28px;
}

.stat-card.total {
  background: linear-gradient(135deg, rgba(0, 82, 217, 0.08) 0%, rgba(0, 82, 217, 0.02) 100%);
}

.stat-card.pending {
  background: linear-gradient(135deg, rgba(237, 123, 47, 0.08) 0%, rgba(237, 123, 47, 0.02) 100%);
}

.stat-card.completed {
  background: linear-gradient(135deg, rgba(0, 168, 112, 0.08) 0%, rgba(0, 168, 112, 0.02) 100%);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* 筛选标签 */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--gray-100);
  padding-bottom: 12px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--gray-500);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: var(--gray-50);
  color: var(--gray-700);
}

.tab-btn.active {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
}

/* 任务列表 */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--gray-50);
  border-radius: 12px;
  border-left: 4px solid transparent;
  transition: all 0.3s;
}

.task-item:hover {
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.task-item.completed {
  opacity: 0.7;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--gray-400);
}

.task-item.urgent {
  border-left-color: var(--error);
  background: linear-gradient(90deg, rgba(227, 77, 89, 0.05) 0%, var(--gray-50) 100%);
}

.task-checkbox {
  padding-top: 2px;
}

.task-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary-blue);
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  word-break: break-word;
}

.priority-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.priority-tag.low {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
}

.priority-tag.medium {
  background: rgba(237, 123, 47, 0.1);
  color: var(--warning);
}

.priority-tag.high {
  background: rgba(227, 77, 89, 0.1);
  color: var(--error);
}

.task-desc {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 8px;
  line-height: 1.5;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-400);
}

.task-alarm {
  color: var(--accent-purple);
}

.task-actions {
  display: flex;
  gap: 6px;
}

.action-btn {
  padding: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  border-radius: 6px;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--gray-100);
}

.action-btn.delete:hover {
  background: rgba(227, 77, 89, 0.1);
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-400);
  text-align: center;
}

.empty-state p {
  margin-top: 16px;
  font-size: 14px;
}

/* 闹钟区域 */
.next-alarm-card {
  background: linear-gradient(135deg, #0052D9 0%, #7B61FF 100%);
  border-radius: 16px;
  padding: 24px;
  color: var(--white);
  margin-bottom: 20px;
  text-align: center;
}

.next-alarm-card.empty {
  background: var(--gray-100);
  color: var(--gray-400);
}

.next-alarm-label {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 8px;
}

.next-alarm-time {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.next-alarm-name {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 12px;
}

.countdown {
  font-size: 14px;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  display: inline-block;
}

/* 闹钟列表 */
.alarm-list {
  margin-bottom: 24px;
}

.alarm-list h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 12px;
}

.alarm-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: var(--gray-50);
  border-radius: 12px;
  margin-bottom: 10px;
  position: relative;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.alarm-item:hover {
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alarm-item.active {
  border-color: var(--accent-purple-light);
  background: linear-gradient(90deg, rgba(123, 97, 255, 0.05) 0%, var(--gray-50) 100%);
}

.alarm-item.ringing {
  animation: alarmPulse 1s ease-in-out infinite;
  border-color: var(--error);
}

@keyframes alarmPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227, 77, 89, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(227, 77, 89, 0); }
}

.alarm-time {
  font-size: 22px;
  font-weight: 600;
  color: var(--gray-800);
  font-variant-numeric: tabular-nums;
}

.alarm-item.active .alarm-time {
  color: var(--accent-purple);
}

.alarm-name {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

.repeat-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--gray-100);
  border-radius: 4px;
  font-size: 11px;
  color: var(--gray-600);
  margin-top: 6px;
}

.alarm-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 开关样式 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-300);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-purple);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* 响铃遮罩 */
.ringing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.ringing-content {
  text-align: center;
  padding: 20px;
}

.ringing-content span {
  animation: iconShake 0.5s ease-in-out infinite;
  display: inline-block;
}

@keyframes iconShake {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.ringing-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.ringing-time {
  font-size: 28px;
  font-weight: 700;
  color: var(--error);
  margin-bottom: 16px;
}

/* 共享用户 */
.shared-users {
  border-top: 1px solid var(--gray-100);
  padding-top: 20px;
}

.shared-users h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 12px;
}

.shared-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shared-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--gray-700);
}

.shared-item:hover {
  background: var(--primary-blue-light);
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  font-size: 24px;
  color: var(--gray-400);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.close-btn:hover {
  background: var(--gray-50);
  color: var(--gray-600);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
}

.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #0052D9 0%, #7B61FF 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  padding: 10px 20px;
  background: var(--gray-50);
  color: var(--gray-700);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--gray-100);
}

/* 表单样式 */
.radio-group {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
}

/* 响铃弹窗特殊样式 */
.modal-overlay.ringing-modal {
  background: rgba(0, 0, 0, 0.7);
}

.modal.ringing-content {
  text-align: center;
  padding: 40px;
}

.ringing-icon {
  font-size: 64px;
  animation: iconShake 0.5s ease-in-out infinite;
  margin-bottom: 20px;
}

.alarm-ring-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.alarm-ring-time {
  font-size: 48px;
  font-weight: 700;
  color: var(--error);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

/* 共享任务列表 */
.shared-tasks-list {
  max-height: 400px;
  overflow-y: auto;
}

.shared-task-item {
  padding: 16px;
  background: var(--gray-50);
  border-radius: 12px;
  margin-bottom: 12px;
}

.shared-task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.shared-task-desc {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 10px;
}

.shared-task-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.completed-tag {
  font-size: 12px;
  color: var(--success);
}

.pending-tag {
  font-size: 12px;
  color: var(--warning);
}

/* 响应式 */
@media (max-width: 768px) {
  .app-container {
    padding: 12px;
  }
  
  .app-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .logo h1 {
    font-size: 20px;
  }
  
  .header-center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
  
  .stats-cards {
    grid-template-columns: 1fr;
  }
  
  .next-alarm-time {
    font-size: 32px;
  }
  
  .login-card {
    padding: 32px 24px;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
