/* 择吉日历 - 核心页面共享样式 */
/* 从 index.html 和 calendar-haoyun.html 抽取的重复样式 */

/* 安卓厂商浏览器兼容性重置和标准化 */
*, *::before, *::after {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 防止某些浏览器的默认行为 */
input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* 统一按钮样式 */
button, .nav-btn, .date-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

/* 统一链接样式 */
a {
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  color: inherit;
}

/* 图片优化 */
img {
  max-width: 100%;
  height: auto;
  -webkit-touch-callout: none;
  pointer-events: none;
}

/* 防止文字缩放 */
body {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 页面标题 */
.calendar-main-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin: 16px 0 8px 0;
  padding: 0;
  letter-spacing: 0.05em;
}

/* 月份导航 - 华为浏览器兼容性优化 */
.controls-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  -ms-flex-pack: justify;
  justify-content: space-between;
  margin: 2px 2px; /* 进一步减少边距 */
  padding: 2px 0;
  margin-top: -8px; /* 向上移动更多 */
}

.controls-row .date-picker {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #b8962e !important; /* 与标题相同的金色 */
  cursor: pointer;
  padding: 8px 2px;
  border-radius: var(--radius-md);
  transition: background-color 0.2s;
  min-width: 120px;
  white-space: nowrap;
  overflow: visible;
  margin: 0 0; /* 完全去除边距 */
  -webkit-tap-highlight-color: transparent;
}

.controls-row .date-picker:hover {
  background-color: var(--bg-warm);
}

.controls-row .nav-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-flex-shrink: 0;
  -ms-flex-negative: 0;
  flex-shrink: 0; /* 防止压缩 */
  -webkit-tap-highlight-color: transparent;
}

.controls-row .nav-btn.nav-btn-right {
  margin-left: -20px; /* 右箭头进一步向左移动 */
}

.controls-row .nav-btn:hover {
  background-color: var(--bg-warm);
}

.controls-row .nav-btn:hover img {
  opacity: 0.8;
}

.controls-row .nav-btn img {
  width: 20px;
  height: 20px;
  transition: filter 0.2s;
}

/* 年份干支样式调整 - 华为浏览器兼容性优化 */
.year-ganzhi-row {
    width: 100%;
    margin: 2px 0;
    padding: 0 16px;
    text-align: left;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 12px;
    margin-top: -8px; /* 向上移动更多 */
}

.year-ganzhi {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-left: 24px; /* 向右移动更多 */
    line-height: 1.2;
}

.year-zodiac {
    font-size: 20px;
    margin-left: 4px;
}

.year-position {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.year-position:hover {
    color: var(--primary);
}

/* 安卓厂商浏览器兼容性适配 */

/* 华为浏览器 */
.ishuawei .controls-row {
  display: -webkit-box !important;
}

.ishuawei .year-ganzhi-row {
  display: -webkit-box !important;
}

/* 小米浏览器 */
.isxiaomi .date-picker {
  font-size: 16px !important; /* 小米浏览器字体偏大 */
}

.isxiaomi .nav-btn {
  width: 36px !important;
  height: 36px !important;
}

/* OPPO浏览器 */
.isoppo .controls-row {
  -webkit-box-pack: justify !important;
}

.isoppo .year-ganzhi {
  font-size: 16px !important;
}

/* vivo浏览器 */
.isvivo .cell-content {
  font-size: 12px !important;
}

/* 三星浏览器 */
.issamsung .date-picker {
  line-height: 1.4 !important;
}

/* UC浏览器 */
.isuc .controls-row {
  display: -webkit-box !important;
  -webkit-box-orient: horizontal !important;
}

/* QQ浏览器 */
.isqq .nav-btn {
  -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}

/* 通用安卓浏览器优化 */
.android-browser .calendar-main-title {
  font-size: 24px !important; /* 安卓浏览器字体偏大 */
}

.android-browser .date-picker {
  font-size: 16px !important;
}

.android-browser .year-ganzhi {
  font-size: 16px !important;
}

.android-browser .cell-content div {
  font-size: 11px !important;
}

/* 五行颜色 */
.wu-xing-fire { color: #d32f2f; }  /* 火 - 红色 */
.wu-xing-earth { color: #8d6e63; }  /* 土 - 棕色 */
.wu-xing-metal { color: #757575; }  /* 金 - 灰色 */
.wu-xing-water { color: #1976d2; } /* 水 - 蓝色 */
.wu-xing-wood { color: #388e3c; }   /* 木 - 绿色 */

/* 年吉日统计弹窗样式 */
.lucky-days-popup {
    text-align: center;
    max-width: 320px;
    padding: 24px;
}

.lucky-days-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stats-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 16px 0;
}

/* 日期选择器弹窗样式 */
.date-picker-popup {
    max-width: 320px;
    min-width: 300px;
    padding: 20px;
}

.date-picker-controls {
    margin: 16px 0;
}

.picker-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.picker-row label {
    min-width: 45px;
    font-size: 14px;
    color: var(--text-secondary);
}

.picker-row select {
    flex: 1;
    padding: 8px 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-primary);
    min-width: 140px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    text-align-last: center;
}

.picker-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.picker-actions button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
}

.picker-actions button:last-child {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.year-ganzhi-sha-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.year-ganzhi {
    display: inline-block;
    font-size: 20px !important;
    font-weight: 700;
    white-space: nowrap;
}

.year-position {
    display: inline-block;
    font-size: 14px;
    padding: 4px 8px;
    background: linear-gradient(
        90deg, 
        #f5f10ada, #fa4ec6da, #ff6b6b, #4ecdc4, #45b7d1, #45e430
    );
    background-size: 600% 100%;
    animation: gradientFlow 10s linear infinite;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 600% 50%; }
}

/* 日期选择器样式 */
.date-picker {
    flex: 0 1 auto;
    text-align: left;
    font-size: 20px;
    color: #b8962e;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all var(--transition-base, 200ms ease);
    user-select: none;
    min-width: 100px;
    max-width: 140px;
}

.date-picker:hover {
    background: rgba(212, 175, 55, 0.1);
}

#dateDisplay {
    display: inline-block;
}

/* 导航按钮样式 - 增强触摸体验 */
.nav-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.3s ease;
    position: relative;
}

/* 触摸增强 - 确保热区达到44px */
.nav-btn.touch-enhanced {
    width: 44px;
    height: 44px;
}

.nav-btn:hover {
    background: transparent;
}

.nav-btn:active {
    transform: scale(0.9);
    opacity: 0.8;
}

.nav-btn img {
    width: 24px;
    height: 24px;
    pointer-events: none; /* 防止图片阻挡触摸事件 */
}
