/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --background: #f5f5f5;
  --foreground: #171717;
  --muted-foreground: #71717a;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --modal-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --foreground: #ededed;
    --muted-foreground: #a1a1aa;
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --border: #374151;
    --card-bg: #1f2937;
    --modal-bg: #1f2937;
  }
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  padding: 20px;
}

#app {
  max-width: 100%;
  margin: 0 auto;
}

/* 时间显示区域 */
.time-container {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.time-display {
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

.date-display {
  font-size: 1.25rem;
  color: var(--muted-foreground);
}

/* 表格容器 */
.table-container {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 滚动条样式 */
.table-container::-webkit-scrollbar {
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--background);
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

/* 表格样式 */
.zodiac-table {
  border-collapse: collapse;
  min-width: max-content;
}

.zodiac-table th,
.zodiac-table td {
  padding: 12px 16px;
  text-align: center;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  min-width: 60px;
}

/* 生肖行（thead） */
.zodiac-table thead th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

/* 数字行 */
.zodiac-table tbody td {
  background: #f8fafc;
  font-weight: 600;
  color: var(--foreground);
}

/* 数值行 */
.value-cell {
  cursor: pointer;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  font-weight: 700;
  transition: all 0.3s ease;
}

.value-cell:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
  z-index: 1;
  position: relative;
}

/* 模态框 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

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

.modal-content {
  background: var(--modal-bg);
  padding: 30px 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--foreground);
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: color 0.2s;
  line-height: 1;
}

.modal-close:hover {
  color: var(--foreground);
}

/* 全屏按钮 */
.modal-fullscreen {
  position: absolute;
  top: 15px;
  right: 50px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: color 0.2s;
  padding: 5px;
  line-height: 1;
}

.modal-fullscreen:hover {
  color: var(--foreground);
}

/* 模态框全屏状态 */
.modal-content.fullscreen {
  width: 95% !important;
  max-width: 95% !important;
  height: 90vh !important;
  max-height: 90vh !important;
  position: fixed !important;
  top: 5vh !important;
  left: 2.5% !important;
  transform: none !important;
  z-index: 1001;
}

.modal-content.fullscreen .modal-body {
  height: calc(100% - 80px);
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.modal-content.fullscreen .format-textarea {
  flex: 1;
  min-height: 300px;
}

.modal-content.fullscreen .network-table-container {
  flex: 1;
  max-height: none;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-body p {
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background: var(--background);
  border-radius: 8px;
}

.modal-body p span {
  font-weight: 600;
  color: var(--primary);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .time-display {
    font-size: 2.5rem;
  }
  
  .date-display {
    font-size: 1rem;
  }
  
  .zodiac-table th,
  .zodiac-table td {
    padding: 10px 12px;
    font-size: 0.85rem;
    min-width: 55px;
  }
}

/* 按钮容器 */
.button-container {
  text-align: center;
  margin-top: 20px;
}

/* 格式化按钮 */
.format-button {
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.format-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.format-button:active {
  transform: translateY(0);
}

/* 缓存按钮 */
.cache-button {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.save-cache {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  box-shadow: 0 4px 12px rgba(56, 239, 125, 0.3);
}

.save-cache:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 239, 125, 0.4);
}

.clear-cache {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.clear-cache:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 87, 108, 0.4);
}

.load-cache {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.load-cache:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 172, 254, 0.4);
}

.cache-button:active {
  transform: translateY(0);
}

/* 格式化模态框 */
.format-modal {
  max-width: 600px;
}

/* Textarea 样式 */
.format-textarea {
  width: 100%;
  min-height: 200px;
  padding: 15px;
  font-size: 1rem;
  font-family: 'Consolas', 'Monaco', monospace;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  color: var(--foreground);
  resize: vertical;
  transition: border-color 0.2s;
}

.format-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* 网络表格容器 */
.network-table-container {
  width: 100%;
  max-height: 400px;
  overflow-x: auto;
  overflow-y: auto;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
}

/* 网络表格样式 */
.network-table {
  width: 100%;
  border-collapse: collapse;
  min-width: max-content;
}

.network-table th,
.network-table td {
  border: 1px solid var(--border);
  padding: 12px 16px;
  text-align: center;
  font-size: 0.95rem;
  min-width: 50px;
}

.network-table .zodiac-row th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
}

.network-table .num-row td {
  background: #f8fafc;
  font-weight: 600;
  color: var(--foreground);
}

.network-table .value-row td {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .network-table .num-row td {
    background: #374151;
  }
}

/* 按钮组 */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

/* 操作按钮 */
.action-button {
  flex: 1;
  max-width: 150px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.start-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.reset-button {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.reset-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 87, 108, 0.4);
}

.network-button {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.network-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 172, 254, 0.4);
}

.accumulate-button {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(56, 239, 125, 0.3);
}

.accumulate-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 239, 125, 0.4);
}

.action-button:active {
  transform: translateY(0);
}

/* 禁用按钮样式 */
.action-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Toast提示样式 */
.toast-tip {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  z-index: 10002;
  animation: fadeIn 0.3s ease;
}

.toast-tip.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

/* 确认对话框样式 */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10003;
}

.confirm-dialog {
  background: var(--modal-bg);
  padding: 24px 32px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.confirm-dialog p {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--foreground);
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.confirm-yes {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.confirm-yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.confirm-no {
  background: linear-gradient(135deg, #e0e0e0 0%, #c0c0c0 100%);
  color: #333;
}

.confirm-no:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
