/* ============================================
   云卡栈 - 高级感UI系统 v9.0
   终极补充20项优化（第121-140项）
   总计140项高级感优化
   ============================================ */

/* ========== 121. 按钮加载状态 ========== */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: btnSpin 0.8s linear infinite;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

.btn-success {
  background: var(--success) !important;
}

.btn-success::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 18px;
  animation: successPop 0.3s ease;
}

@keyframes successPop {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.3); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ========== 122. 表单验证动画 ========== */
.form-input-error {
  animation: shake 0.4s ease;
  border-color: var(--danger) !important;
}

.form-input-success {
  border-color: var(--success) !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.form-error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
  animation: fadeInUp 0.3s ease;
}

.form-success-msg {
  color: var(--success);
  font-size: 12px;
  margin-top: 4px;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 123. 点赞爆炸效果 ========== */
.like-btn {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.like-btn:active {
  transform: scale(0.8);
}

.like-btn.liked {
  color: var(--danger);
}

.like-particle {
  position: absolute;
  pointer-events: none;
  font-size: 16px;
  animation: likeExplode 0.8s ease-out forwards;
}

@keyframes likeExplode {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

/* ========== 124. 收藏心跳效果 ========== */
.favorite-btn {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.favorite-btn:active {
  transform: scale(0.8);
}

.favorite-btn.favorited {
  color: #fbbf24;
  animation: heartbeat 0.6s ease;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ========== 125. 下拉刷新动画 ========== */
.pull-refresh {
  position: relative;
  overflow: hidden;
}

.pull-refresh-indicator {
  position: absolute;
  top: -60px;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.pull-refresh-indicator .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.pull-refresh.refreshing .pull-refresh-indicator {
  transform: translateY(60px);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 126. 上拉加载动画 ========== */
.load-more {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.load-more .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.load-more-dot {
  display: inline-block;
  animation: dotPulse 1.4s infinite;
}

.load-more-dot:nth-child(2) { animation-delay: 0.2s; }
.load-more-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* ========== 127. 空状态插画 ========== */
.empty-state {
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ========== 128. 错误状态插画 ========== */
.error-state {
  padding: 60px 20px;
  text-align: center;
}

.error-state-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
  animation: shake 0.5s ease;
}

.error-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 8px;
}

.error-state-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.error-retry-btn {
  padding: 10px 24px;
  background: var(--primary-500);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.error-retry-btn:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
}

/* ========== 129. 网络状态提示 ========== */
.network-status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 20px;
  text-align: center;
  font-size: 14px;
  z-index: 10000;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.network-status-bar.offline {
  background: var(--danger);
  color: white;
  transform: translateY(0);
}

.network-status-bar.online {
  background: var(--success);
  color: white;
  transform: translateY(0);
  animation: slideDown 3s ease forwards;
}

@keyframes slideDown {
  0%, 80% { transform: translateY(0); }
  100% { transform: translateY(-100%); }
}

/* ========== 130. 无限滚动 ========== */
.infinite-scroll {
  position: relative;
  min-height: 200px;
}

.infinite-scroll-sentinel {
  height: 1px;
}

/* ========== 131. 虚拟列表 ========== */
.virtual-list {
  position: relative;
  overflow-y: auto;
}

.virtual-list-phantom {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: -1;
}

.virtual-list-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.virtual-list-item {
  position: absolute;
  left: 0;
  right: 0;
}

/* ========== 132. 树形组件 ========== */
.tree-node {
  padding: 8px 0;
}

.tree-node-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tree-node-content:hover {
  background: var(--bg-secondary);
}

.tree-node-toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: var(--text-tertiary);
}

.tree-node.expanded > .tree-node-content .tree-node-toggle {
  transform: rotate(90deg);
}

.tree-children {
  margin-left: 24px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.tree-node.expanded > .tree-children {
  max-height: 1000px;
}

/* ========== 133. 高级日历 ========== */
.premium-calendar {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-title {
  font-size: 16px;
  font-weight: 600;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-nav-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
  background: var(--bg-secondary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-name {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 8px 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.calendar-day:hover {
  background: var(--bg-secondary);
}

.calendar-day.today {
  background: var(--primary-500);
  color: white;
  font-weight: 600;
}

.calendar-day.selected {
  background: var(--primary-100);
  color: var(--primary-600);
  font-weight: 600;
}

.calendar-day.other-month {
  color: var(--text-tertiary);
  opacity: 0.4;
}

.calendar-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: var(--danger);
  border-radius: 50%;
}

/* ========== 134. 富文本编辑器 ========== */
.rich-editor {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.rich-editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.rich-editor-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s ease;
}

.rich-editor-btn:hover {
  background: var(--bg-tertiary);
}

.rich-editor-btn.active {
  background: var(--primary-100);
  color: var(--primary-600);
}

.rich-editor-content {
  padding: 12px;
  min-height: 150px;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
}

.rich-editor-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
}

/* ========== 135. 在线状态 ========== */
.online-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
}

.online-dot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.4;
  animation: onlinePulse 2s ease infinite;
}

@keyframes onlinePulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.5); opacity: 0; }
}

.online-dot.offline {
  background: var(--text-tertiary);
}

.online-dot.offline::after {
  display: none;
}

.online-dot.busy {
  background: var(--warning);
}

/* ========== 136. 输入中提示 ========== */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 16px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ========== 137. 已读回执 ========== */
.read-receipt {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.read-receipt.read {
  color: var(--primary-500);
}

.read-receipt svg {
  width: 14px;
  height: 14px;
}

/* ========== 138. 消息撤回 ========== */
.recalled-message {
  font-style: italic;
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 8px 12px;
}

.message-actions {
  position: absolute;
  top: -40px;
  right: 0;
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 4px;
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.message-item:hover .message-actions {
  opacity: 1;
  visibility: visible;
}

.message-action-btn {
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s ease;
}

.message-action-btn:hover {
  background: var(--bg-secondary);
}

/* ========== 139. 消息引用 ========== */
.message-quote {
  border-left: 3px solid var(--primary-400);
  padding: 6px 10px;
  margin-bottom: 6px;
  background: var(--bg-secondary);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: var(--text-secondary);
  max-height: 60px;
  overflow: hidden;
}

.message-quote-author {
  font-weight: 600;
  color: var(--primary-600);
  margin-bottom: 2px;
}

/* ========== 140. 操作日志 ========== */
.audit-log {
  font-family: monospace;
  font-size: 13px;
}

.audit-log-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.audit-log-time {
  color: var(--text-tertiary);
  white-space: nowrap;
  font-size: 12px;
}

.audit-log-action {
  font-weight: 500;
  color: var(--text-primary);
}

.audit-log-detail {
  color: var(--text-secondary);
  font-size: 12px;
}

.audit-log-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.audit-log-badge.success { background: var(--success); color: white; }
.audit-log-badge.warning { background: var(--warning); color: white; }
.audit-log-badge.danger { background: var(--danger); color: white; }
.audit-log-badge.info { background: var(--primary-500); color: white; }

/* 响应式 */
@media (max-width: 768px) {
  .calendar-day { font-size: 13px; }
  .rich-editor-toolbar { gap: 2px; }
  .rich-editor-btn { width: 28px; height: 28px; }
}
