/* 自定义样式 */

/* 确保图标正确显示 */
[data-lucide] {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 2;
}

/* 语言切换器悬停效果 */
.group:hover .group-hover\:opacity-100 {
  opacity: 1;
}

.group:hover .group-hover\:visible {
  visibility: visible;
}

/* FAQ过渡效果 */
.faq-content {
  transition: all 0.3s ease;
}

/* 复制按钮样式优化 */
.copy-btn {
  transition: all 0.2s ease;
}

.copy-btn:hover {
  transform: scale(1.1);
}

/* 输入框组合焦点样式 - 当输入框获得焦点时，整个输入框组合都高亮 */
.input-group:focus-within #timeValue,
.input-group:focus-within #inputUnit {
  border-color: #21b5f4;
  box-shadow: 0 0 0 3px rgba(33, 181, 244, 0.1);
}

/* 移除输入框和选择框之间的边框高亮 */
.input-group:focus-within #timeValue {
  border-right-color: #d1d5db;
}

.input-group:focus-within #inputUnit {
  border-left-color: #d1d5db;
}

/* Hero描述在移动端隐藏 */
@media (max-width: 768px) {
  .hero-description {
    visibility: hidden;
    position: absolute;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }
}

/* 响应式优化 */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  .converter-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 表格样式优化 */
table {
  border-collapse: collapse;
}

/* 按钮悬停效果 */
button:hover {
  transform: translateY(-1px);
  transition: transform 0.2s ease;
}

/* 卡片阴影效果 */
.result-card {
  transition: box-shadow 0.2s ease;
}

.result-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 自定义下拉箭头样式 */
.custom-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* 日期计算器特殊样式 */
.date-calculator {
  min-height: 600px;
}

/* 日期输入框样式优化 */
input[type="date"] {
  position: relative;
  background: white;
  cursor: pointer;
}

/* 让整个输入框都可以点击调出日期选择器 */
input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
  color: transparent;
  background: transparent;
  cursor: pointer;
}

/* 自定义日期图标显示在右侧 */
input[type="date"]::before {
  content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'%3e%3c/path%3e%3c/svg%3e");
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* 错误状态样式 */
.input-error {
  border-color: #F59E0B !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1) !important;
}

.input-success {
  border-color: #10B981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* 公式显示区域样式 */
.formula-display {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #e2e8f0;
}

/* 结果显示动画 */
.results-enter {
  animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 弹窗样式优化 */
.modal-overlay {
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

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

/* 节假日列表样式 */
.holiday-list-item {
  transition: all 0.2s ease;
}

.holiday-list-item:hover {
  background-color: #f8fafc;
  transform: translateX(2px);
}

/* 计算按钮加载状态 */
.btn-calculating {
  position: relative;
  color: transparent;
}

.btn-calculating::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* 复选框样式优化 */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #d1d5db;
  background: white;
  transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 结果卡片样式 */
.result-stat-card {
  transition: all 0.2s ease;
  border: 1px solid #e5e7eb;
}

.result-stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* 移动端优化 */
@media (max-width: 768px) {
  .date-calculator {
    min-height: auto;
  }
  
  .modal-content {
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .grid-cols-2 {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .result-stat-card {
    padding: 1rem;
    text-align: center;
  }
  
  .flex.space-x-3 {
    flex-direction: column;
    space-x: 0;
    gap: 0.5rem;
  }
}

/* 假期设置弹窗特殊样式 */
.holiday-modal {
  max-width: 42rem;
  max-height: 90vh;
  overflow-y: auto;
}

.holiday-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

/* 自定义节假日项样式 */
.custom-holiday-item {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border: 1px solid #f59e0b;
}

.custom-holiday-item:hover {
  background: linear-gradient(135deg, #fde68a 0%, #fdba74 100%);
}

/* 工具提示样式 */
.tooltip {
  position: relative;
  display: inline-block;
}

/* 基础tooltip样式 */
.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: normal;
  max-width: 220px;
  z-index: 1000;
  margin-bottom: 0.25rem;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease-out forwards;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* tooltip箭头 */
.tooltip:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  z-index: 1000;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease-out forwards;
}

/* tooltip淡入动画 */
@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* 移动端优化 - 触摸设备上使用点击显示 */
@media (hover: none) and (pointer: coarse) {
  .tooltip:hover::after,
  .tooltip:hover::before {
    display: none;
  }
  
  .tooltip.active::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: normal;
    max-width: 220px;
    z-index: 1000;
    margin-bottom: 0.25rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  .tooltip.active::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
  }
}

/* 避免tooltip超出视窗 - 已整合到主样式中 */

/* 当tooltip可能超出右边界时，调整位置 */
.tooltip.tooltip-left:hover::after,
.tooltip.tooltip-left:hover::before {
  left: auto;
  right: 0;
  transform: translateX(0);
}

/* 当tooltip可能超出左边界时，调整位置 */
.tooltip.tooltip-right:hover::after,
.tooltip.tooltip-right:hover::before {
  left: 0;
  transform: translateX(0);
}

/* Tools Dropdown 样式 */
.tools-dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.tools-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dropdown按钮箭头旋转 */
#toolsDropdown[aria-expanded="true"] [data-lucide="chevron-down"] {
  transform: rotate(180deg);
}

/* Dropdown项悬停效果 */
.dropdown-item {
  transition: all 0.15s ease;
  position: relative;
}

.dropdown-item:hover {
  background-color: #f9fafb !important;
  padding-left: 18px;
}

/* 移动端优化 */
@media (max-width: 640px) {
  .tools-dropdown-menu {
    width: 80vw;
    max-width: 280px;
    right: -10px;
  }
  
  .dropdown-item {
    padding: 16px 20px;
  }
  
  #toolsDropdown {
    padding: 8px 12px;
  }
}

/* 底部固定广告位样式 */
.bottom-ad-banner {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  padding: 5px 30px 5px 5px;
  background-color: rgba(243, 244, 246, 0.95);
  z-index: 9999;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 2px 2px 0 0;
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  backdrop-filter: blur(4px);
}

.bottom-ad-banner.hidden {
  transform: translateX(-50%) translateY(100%);
  opacity: 0;
}

.bottom-ad-close-btn {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  background-color: transparent;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bottom-ad-close-btn.show {
  opacity: 1;
  visibility: visible;
}

/* Ad标识样式 */
.ad-label {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  line-height: 1;
  padding-top: 2px;
  user-select: none;
}

/* 广告内容容器 */
.ad-content-wrapper {
  display: inline-block;
}

/* 移动端隐藏底部广告 */
@media (max-width: 768px) {
  .bottom-ad-banner {
    display: none !important;
  }
}

/* 侧边广告样式 - 使用固定定位,top值由JS动态控制 */
.sidebar-ad {
  position: fixed; /* 始终使用固定定位 */
  top: 60px; /* 初始值,会被JS动态更新 */
  z-index: 100;
  display: none; /* 默认隐藏,通过媒体查询显示 */
}

/* 左侧广告定位 */
.sidebar-ad-left {
  left: calc((100vw - 1024px) / 2 - 320px); /* 动态计算:屏幕中心 - 内容区一半 - 广告宽度 - 间距 */
}

/* 右侧广告定位 */
.sidebar-ad-right {
  right: calc((100vw - 1024px) / 2 - 320px); /* 动态计算:屏幕中心 - 内容区一半 - 广告宽度 - 间距 */
}

/* 广告容器基础样式 */
.sidebar-ad .ad-container {
  overflow: hidden;
}

/* 大屏幕: 显示 300px 宽度广告 (适配 300x600) */
@media (min-width: 1680px) {
  .sidebar-ad {
    display: block;
  }

  .sidebar-ad .ad-container {
    width: 300px;
    min-height: 600px;
  }

  .sidebar-ad-left {
    left: calc((100vw - 1024px) / 2 - 300px - 40px); /* 内容区左侧 - 广告宽 - 间距 */
  }

  .sidebar-ad-right {
    right: calc((100vw - 1024px) / 2 - 300px - 40px); /* 内容区右侧 - 广告宽 - 间距 */
  }
}

/* 中屏幕: 显示 160px 宽度广告 (适配 160x600) */
@media (min-width: 1280px) and (max-width: 1679px) {
  .sidebar-ad {
    display: block;
  }

  .sidebar-ad .ad-container {
    width: 160px;
    min-height: 600px;
  }

  .sidebar-ad-left {
    left: calc((100vw - 1024px) / 2 - 160px - 20px);
  }

  .sidebar-ad-right {
    right: calc((100vw - 1024px) / 2 - 160px - 20px);
  }
}

/* 小屏幕: 隐藏侧边广告 */
@media (max-width: 1279px) {
  .sidebar-ad {
    display: none !important;
  }
}

/* 博客文章内容样式 - 匹配隐私协议页面样式 */
.blog-content h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}

.blog-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.blog-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.blog-content p {
  color: #374151;
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.blog-content ul,
.blog-content ol {
  color: #374151;
  margin-left: 1rem;
  margin-bottom: 0.75rem;
}

.blog-content ul {
  list-style-type: disc;
}

.blog-content ol {
  list-style-type: decimal;
}

.blog-content li {
  margin-bottom: 0.25rem;
}

.blog-content a {
  color: #2563eb;
  text-decoration: underline;
}

.blog-content a:hover {
  color: #1e40af;
}

.blog-content strong {
  font-weight: 600;
}

.blog-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.blog-content table th,
.blog-content table td {
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.blog-content table th {
  background-color: #f9fafb;
  font-weight: 600;
  color: #111827;
}

.blog-content table td {
  color: #374151;
}

.blog-content code {
  background-color: #f3f4f6;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.blog-content pre {
  background-color: #f3f4f6;
  padding: 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.blog-content pre code {
  background-color: transparent;
  padding: 0;
}

/* Hours Calculator - 隐藏 number 输入框的微调器 */
.no-spinner::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spinner {
  -moz-appearance: textfield;
}

/* Hours Calculator - Add Multiple Times 删除按钮悬浮显示 */
.time-entry-wrapper {
  position: relative;
}

.time-entry-wrapper .remove-time-btn {
  /* 使用绝对定位，完全脱离文档流 */
  position: absolute;
  top: 50%;
  right: -22px; /* 按钮距离输入框 6px */
  transform: translateY(-50%);

  /* 固定按钮尺寸 */
  width: 20px;
  height: 20px;
  padding: 0;

  /* flexbox 居中 SVG */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  /* 过渡效果 */
  opacity: 0;
  transition: opacity 0.2s ease;

  /* 边框和背景 */
  border: none;
  background: transparent;
  cursor: pointer;
}

/* 确保只有多个条目时才显示删除按钮 */
.time-entry-wrapper .remove-time-btn.invisible {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}

/* 悬浮在 wrapper 上时显示按钮 */
.time-entry-wrapper.group:hover .remove-time-btn:not(.invisible) {
  opacity: 1;
}

/* 悬浮在按钮上时稍微变暗 */
.time-entry-wrapper .remove-time-btn:not(.invisible):hover {
  opacity: 0.7 !important;
}

/* Work Hours Calculator - 隐藏 number 输入框的步进器 */
#workHoursTable input[type="number"]::-webkit-inner-spin-button,
#workHoursTable input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#workHoursTable input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Work Hours Calculator - 固定Total列宽度防止抖动 */
#workHoursTable .daily-total {
  min-width: 80px;
  display: inline-block;
}

#workHoursTable #weeklyTotal {
  min-width: 80px;
  display: inline-block;
}

/* Work Hours Calculator - 增加Total列左侧间距 */
#workHoursTable thead th:last-child,
#workHoursTable tbody td:last-child,
#workHoursTable tfoot td:last-child {
  padding-left: 1.5rem;
}

