/**
 * World Clock Styles - 简化版本
 * 统一的颜色系统，简洁的样式结构
 */

/* ===== 颜色变量定义 ===== */
:root {
  --wc-bg: #151515;
  --wc-container-bg: #1E1B1A;
  --wc-header-bg: #2E2927;
  --wc-border: #332B29;
  --wc-border-strong: #433932;
  --wc-text-primary: #EAEAEA;
  --wc-text-secondary: #837672;
  --wc-text-muted: #837672;
  --wc-accent: #ED1D5D;
  --wc-button: #D19580;
  --wc-danger: #E85D5D;
}

/* ===== 页面背景 ===== */
[data-page-theme="world-clock"] body {
  background-color: var(--wc-bg) !important;
}

/* ===== 页面布局 ===== */
.world-clock-main {
  display: flex;
  flex-direction: column;
  padding: 2rem 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .world-clock-main {
    padding: 2rem;
  }
}

@media (min-width: 1024px) {
  .world-clock-main {
    padding: 2rem 3rem;
  }
}

/* ===== Header区域 ===== */
.world-clock-header-section {
  text-align: center;
  margin-bottom: 2rem;
}

.world-clock-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--wc-accent);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

@media (min-width: 768px) {
  .world-clock-title {
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .world-clock-title {
    font-size: 3rem;
  }
}

.world-clock-subtitle {
  font-size: 1.125rem;
  color: var(--wc-text-secondary);
  line-height: 1.5;
}

@media (min-width: 768px) {
  .world-clock-subtitle {
    font-size: 1.25rem;
  }
}

/* ===== 世界时钟容器 ===== */
.world-clock-container {
  width: 100%;
  background: transparent;
  position: relative;
  z-index: 1; /* 设置较低z-index，确保搜索下拉框在上方 */
}

.world-clock-body {
  width: 100%;
  max-height: none;
  overflow-y: visible;
  padding: 0;
  position: relative;
}

.column-hover-outline {
  position: absolute;
  pointer-events: none;
  border: 1px dashed var(--wc-text-secondary);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 40;
}

.column-hover-outline.is-active {
  opacity: 1;
}

/* ===== 卡片布局 ===== */
.grid-cols-layout {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: calc(280px + 24 * 40px); /* 保证小屏最小滚动宽度 */
  width: 100%; /* 大屏自动填满容器 */
  background: var(--wc-container-bg);
  border-radius: 8px;
  overflow-x: auto;
  /* 确保滚动条样式优化 */
  scrollbar-width: thin;
}

.grid-cols-layout > div {
  flex-shrink: 0;
  padding: 12px 8px;
  text-align: center;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

/* 移除重复定义，在下面统一处理 */

/* ===== 列宽设置 ===== */
/* 第1列 - 时区信息卡片 */
.grid-cols-layout > div:nth-child(1) {
  width: 200px;
  min-width: 200px;
  text-align: left;
  padding: 16px;
  background: var(--wc-header-bg);
  align-items: flex-start;
  justify-content: center;
}

/* 第2列 - 当前时间卡片 */
.grid-cols-layout > div:nth-child(2) {
  width: 80px;
  min-width: 80px;
  text-align: right;
  padding: 16px;
  background: var(--wc-header-bg);
  align-items: flex-end;
}

/* 其余列 - 24小时时间轴（弹性布局） */
.grid-cols-layout > div:nth-child(n+3) {
  min-width: 40px;
  flex: 1; /* 弹性扩展填满剩余空间 */
  padding: 8px 4px;
  background: var(--wc-container-bg);
  box-sizing: border-box;
}

/* ===== GMT Header行 ===== */
.gmt-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-bottom: 12px;
}

.gmt-header .grid-cols-layout {
  background: var(--wc-header-bg);
  overflow-x: auto;
}

.gmt-header .grid-cols-layout > div {
  background: var(--wc-header-bg);
  font-weight: 600;
  color: var(--wc-text-primary);
}

/* GMT表头不显示日期标记 */
.gmt-header-cell .day-indicator {
  display: none;
}

/* GMT Header行次要文字字重重置 */
.gmt-header .timezone-code,
.gmt-header .current-date {
  font-weight: normal;
}

/* ===== 文字样式统一 ===== */

/* 应用统一文字样式 */
.timezone-name,
.current-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--wc-text-primary);
  line-height: 1.2;
}

/* 城市和时区代码同行布局 */
.city-timezone-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.timezone-code,
.current-date {
  font-size: 11px; /* 改为与country-name相同 */
  color: var(--wc-text-secondary);
  line-height: 1.2;
  margin-top: 0; /* 同行布局时不需要margin-top */
}

/* 国家名称样式 */
.country-name {
  font-size: 11px;
  color: var(--wc-text-muted);
  line-height: 1.2;
  margin-top: 2px;
}

.minute-value {
  font-size: 11px;
  color: var(--wc-text-muted);
  line-height: 1;
  margin-top: -2px;
}

/* ===== 时区行包装器 ===== */
.timezone-row-wrapper {
  margin-bottom: 12px;
}

/* 时区行内容（可滚动） */
.timezone-row:not(.gmt-header) {
  position: relative;
  transition: none;
  width: 100%;
  cursor: default;
}

.timezone-row:not(.gmt-header) .grid-cols-layout {
  border-radius: 8px;
  overflow: hidden;
  background: var(--wc-container-bg);
}

/* hover效果 */
.timezone-row-wrapper:hover .timezone-row .grid-cols-layout {
  transform: none;
  box-shadow: none;
}

.timezone-row-wrapper:hover .delete-btn {
  opacity: 1;
  transform: scale(1.1); /* 保持删除按钮悬停可见 */
}

/* ===== 删除按钮 - 卡片左上角红色叉号 ===== */
.delete-btn {
  position: absolute;
  top: 0px;
  left: 1px;
  width: 18px;
  height: 18px;
  background: transparent; /* 无背景 */
  color: var(--wc-danger); /* 红色叉号 */
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20; /* 确保在所有内容上方 */
  border-radius: 50%;
}

.delete-btn:hover {
  background: rgba(232, 93, 93, 0.1); /* 悬停时淡红色背景 */
  color: #DC4444;
}

.delete-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5; /* 加粗叉号线条 */
}

/* ===== 控制区域 - 移到表头上方，左对齐 ===== */
.world-clock-controls {
  margin-bottom: 0.75rem; /* 减少间距，从1.5rem改为0.75rem */
  display: flex;
  justify-content: flex-start; /* 改为左对齐 */
  position: relative;
  z-index: 3000; /* 提高整个控制区域的z-index */
}

.timezone-add-section {
  max-width: 280px; /* 进一步减小宽度，从400px改为300px */
  width: 100%;
  position: relative;
}

/* ===== 搜索容器 ===== */
.timezone-search-container {
  display: flex;
  background: var(--wc-container-bg);
  border: 1px solid var(--wc-border);
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
  position: relative;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--wc-text-muted);
  pointer-events: none;
}

.timezone-search-input {
  width: 100%;
  padding: 8px 10px 8px 36px; /* 减少垂直内边距，从12px改为8px */
  border: none;
  background: transparent;
  color: var(--wc-text-primary);
  outline: none;
  line-height: 1.4;
  font-size: 14px;
}

.timezone-search-input::placeholder {
  color: var(--wc-text-muted);
}

.timezone-search-input:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.timezone-search-container:focus-within {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(209, 149, 128, 0.3) !important;
  border-color: var(--wc-button) !important;
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--wc-text-muted);
  cursor: pointer;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.clear-search-btn:hover {
  color: var(--wc-text-secondary);
  background: rgba(184, 165, 160, 0.1);
}

/* ===== 添加按钮 ===== */
.add-timezone-btn,
#add-timezone-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--wc-button);
  color: #1A1616;
  border: none;
  border-left: 1px solid var(--wc-border);
  border-radius: 0 8px 8px 0;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 120px;
}


.add-timezone-btn:disabled,
#add-timezone-btn:disabled {
  background: var(--wc-text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===== 下拉菜单 ===== */
.timezone-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--wc-container-bg);
  border: 1px solid var(--wc-border);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  z-index: 9999; /* 设置最高z-index，确保在所有内容上方 */
  max-height: 320px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.timezone-options {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.timezone-options::-webkit-scrollbar {
  width: 6px;
}

.timezone-options::-webkit-scrollbar-track {
  background: var(--wc-container-bg);
}

.timezone-options::-webkit-scrollbar-thumb {
  background: var(--wc-border);
  border-radius: 3px;
}

.timezone-option {
  padding: 12px 16px;
  border-bottom: 1px solid var(--wc-border);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.timezone-option:last-child {
  border-bottom: none;
}

.timezone-option:hover {
  background: var(--wc-header-bg);
}

/* 置灰状态样式 */
.timezone-option-disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
}

.timezone-option-disabled:hover {
  background: transparent !important;
}

.timezone-city {
  font-weight: 500;
  color: var(--wc-text-primary);
  margin-bottom: 4px;
}

.option-details {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--wc-text-secondary);
}

.timezone-option .timezone-code {
  background: var(--wc-border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--wc-text-secondary);
}

.timezone-time {
  font-size: 14px;
  color: var(--wc-text-secondary);
}

/* ===== 状态样式 ===== */
.loading-text,
.no-results {
  color: var(--wc-text-muted);
  text-align: center;
  padding: 16px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  color: var(--wc-button);
  animation: spin 1s linear infinite;
}

/* ===== 工具类 ===== */
.hidden {
  display: none !important;
}

/* ===== 滚动条样式 ===== */
.world-clock-body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.world-clock-body::-webkit-scrollbar-track {
  background: var(--wc-bg);
}

.world-clock-body::-webkit-scrollbar-thumb {
  background: var(--wc-border);
  border-radius: 4px;
}

.world-clock-body::-webkit-scrollbar-thumb:hover {
  background: var(--wc-border-strong);
}

/* 时间轴滚动条 */
.grid-cols-layout::-webkit-scrollbar {
  height: 6px;
}

.grid-cols-layout::-webkit-scrollbar-track {
  background: var(--wc-container-bg);
}

.grid-cols-layout::-webkit-scrollbar-thumb {
  background: var(--wc-border);
  border-radius: 3px;
}

/* ===== 动画 ===== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== 时间单元格 ===== */
.time-cell {
  position: relative;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.time-value {
  font-weight: 600;
  font-size: 14px;
  color: var(--wc-text-primary);
}


/* 普通时区行中的日期标记样式 */
.day-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  color: var(--wc-text-secondary);
  font-weight: 500;
  background: var(--wc-header-bg);
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1;
}

/* 使用CSS content显示日期标记，避免影响SEO关键词密度 */
.day-indicator[data-day="1"]::after {
  content: "D+1";
}

.day-indicator[data-day="-1"]::after {
  content: "D-1";
}

/* ===== 焦点样式 ===== */
.timezone-option:focus,
.add-timezone-btn:focus,
.delete-btn:focus {
  outline: 2px solid var(--wc-button);
  outline-offset: 2px;
}

/* ===== GMT帮助按钮和弹窗样式 ===== */
.gmt-help-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  margin-left: -2px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--wc-text-secondary);
  opacity: 0.6;
  vertical-align: text-top;
  position: relative;
  top: -1px;
}

.gmt-help-btn:hover {
  opacity: 0.8;
}

.gmt-help-btn:focus {
  outline: none;
}

.gmt-help-btn:active {
  transform: none;
}

.help-icon {
  width: 14px;
  height: 14px;
  stroke-width: 1;
}

/* GMT帮助弹窗 */
.gmt-help-tooltip {
  position: fixed;
  z-index: 10000;
  background: var(--wc-container-bg);
  border: 1px solid var(--wc-border);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  width: 360px;
  padding: 0;
  overflow: hidden;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

/* 移动端响应式调整 */
@media (max-width: 480px) {
  .gmt-help-tooltip {
    width: calc(100vw - 20px);
    max-width: 360px;
  }
}

.tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

/* 箭头指向左上角（默认位置） */
.tooltip-arrow {
  border-width: 0 8px 8px 8px;
  border-color: transparent transparent var(--wc-border) transparent;
  top: -8px;
  left: 20px;
}

.tooltip-arrow::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 7px 7px 7px;
  border-color: transparent transparent var(--wc-container-bg) transparent;
  top: 1px;
  left: -7px;
}

.tooltip-content {
  padding: 20px;
}

.tooltip-content h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--wc-text-primary);
  line-height: 1.6;
}

.tooltip-text {
  color: var(--wc-text-secondary);
  font-size: 14px;
  line-height: 1.3;
  margin: 0;
}

.tooltip-text strong {
  color: var(--wc-text-primary);
  font-weight: 600;
}

/* 响应式交互 */
@media (hover: hover) {
  /* PC端：仅悬浮，禁用点击 */
  .gmt-help-btn {
    pointer-events: auto;
  }
  
  .gmt-help-btn:hover + .gmt-help-tooltip,
  .gmt-help-tooltip:hover {
    display: block !important;
  }
}

@media (hover: none) {
  /* 移动端：点击显示 */
  .gmt-help-btn.active + .gmt-help-tooltip,
  .gmt-help-tooltip.active {
    display: block !important;
  }
}

/* ===== World Clock Map Section ===== */
.world-clock-map-section {
  margin-top: 14rem;
  padding: 2rem 0;
  text-align: center;
  /* border-top: 1px solid var(--wc-border); */
}

.world-clock-map-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--wc-text-primary);
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}

@media (min-width: 768px) {
  .world-clock-map-title {
    font-size: 1.75rem;
  }
}

@media (min-width: 1024px) {
  .world-clock-map-title {
    font-size: 2rem;
  }
}

.world-clock-map-container {
  max-width: 100%;
  margin: 0 auto;
  background: var(--wc-container-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.world-clock-map-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  max-height: 80vh;
}

.world-clock-map-attribution {
  padding: 1.5rem 2rem;
  background: var(--wc-header-bg);
  border-top: 1px solid var(--wc-border);
}

.world-clock-map-attribution p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--wc-text-secondary);
  text-align: left;
}

.world-clock-map-attribution a {
  color: var(--wc-button);
  text-decoration: none;
  transition: color 0.2s ease;
}

.world-clock-map-attribution a:hover {
  color: var(--wc-accent);
  text-decoration: underline;
}

/* 移动端响应式优化 */
@media (max-width: 768px) {
  .world-clock-map-section {
    margin-top: 2rem;
    padding: 1.5rem 0;
  }
  
  .world-clock-map-attribution {
    padding: 1rem 1.5rem;
  }
  
  .world-clock-map-attribution p {
    font-size: 0.8rem;
  }
}

/* ===== Content Section Styles ===== */
.content-section {
  padding: 4rem 1rem;
  margin-top: 2rem;
}

.content-container {
  max-width: 800px;
  margin: 0 auto;
}

.intro-block {
  margin-bottom: 3rem;
  text-align: left;
}

.intro-block h2 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--wc-text-primary);
  line-height: 1.4;
}

.intro-block p {
  color: var(--wc-text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.intro-block ul {
  color: var(--wc-text-secondary);
  line-height: 1.6;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.intro-block li {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

/* FAQ Specific Styles - 简化版本 */
.faq-item {
  margin-bottom: 2rem;
}

.faq-item h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--wc-text-primary);
  line-height: 1.4;
}

.faq-item p {
  color: var(--wc-text-secondary);
  line-height: 1.6;
  margin: 0;
  font-size: 1rem;
}

/* Links in content */
.content-section a {
  color: var(--wc-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  font-size: inherit;
  font-weight: inherit;
}

.content-section a:hover {
  color: var(--wc-text-secondary);
  text-decoration: underline;
}

/* 移动端内容区域优化 */
@media (max-width: 768px) {
  .content-section {
    padding: 3rem 1rem;
  }
  
  .intro-block h2 {
    font-size: 1.5rem;
  }
  
  .intro-block p,
  .intro-block li {
    font-size: 0.95rem;
  }
  
  .faq-item h3 {
    font-size: 1.1rem;
  }
  
  .faq-item p {
    font-size: 0.95rem;
  }
}
