/**
 * 乾坤门老黄历 - 中国古风样式表
 * 版本：V2.0
 * 创建时间：2025-11-08
 * 设计主题：传统中式 + 现代响应式
 */

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== 全局样式 ==================== */
body {
    font-family: "Microsoft YaHei", "SimSun", "STSong", serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
    color: #2c3e50;
    position: relative;
    overflow-x: hidden;
}

/* 祥云背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ==================== 页面头部 ==================== */
.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header-decoration {
    position: relative;
    display: inline-block;
    padding: 30px 60px;
}

/* 印章风格边框 */
.header-decoration::before,
.header-decoration::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid #D4A373;
}

.header-decoration::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.header-decoration::after {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.header h1 {
    font-size: 3em;
    background: linear-gradient(135deg, #C8161D 0%, #D4A373 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 8px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.header h1::before {
    content: '🏮';
    position: absolute;
    left: -50px;
    animation: swing 3s ease-in-out infinite;
}

.header h1::after {
    content: '🏮';
    position: absolute;
    right: -50px;
    animation: swing 3s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes swing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

.header-subtitle {
    color: #F5E6D3;
    font-size: 1.2em;
    margin-bottom: 8px;
    letter-spacing: 3px;
}

.header-note {
    color: rgba(245, 230, 211, 0.7);
    font-size: 0.95em;
    letter-spacing: 2px;
}

/* ==================== 主布局 ==================== */
.main-wrapper {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 25px;
    margin-bottom: 25px;
}

/* ==================== 中式卡片通用样式 ==================== */
.chinese-card {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
}

/* 卡片边框装饰 */
.chinese-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

/* ==================== 日历容器 ==================== */
.calendar-wrapper {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

.calendar-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

/* 日历头部 */
.calendar-header {
    background: linear-gradient(135deg, #C8161D 0%, #8B0000 100%);
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
}

/* 祥云装饰 */
.calendar-header::after {
    content: '☁️';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3em;
    opacity: 0.1;
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 20px;
}

.month-selector button {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.month-selector button:hover {
    background: rgba(255,255,255,0.25);
    border-color: #D4A373;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.month-selector button:active {
    transform: scale(0.95);
}

.current-date {
    color: white;
    font-size: 1.8em;
    font-weight: bold;
    letter-spacing: 3px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.date-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-picker input[type="date"] {
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.9);
    font-size: 16px;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.date-picker input[type="date"]:focus {
    outline: none;
    border-color: #D4A373;
    box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.2);
}

.date-picker button {
    background: white;
    color: #C8161D;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.date-picker button:hover {
    background: #D4A373;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* ==================== 日历网格 ==================== */
.calendar-grid {
    padding: 25px;
    background: linear-gradient(to bottom, #F5E6D3 0%, #fff 100%);
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.weekday {
    text-align: center;
    font-weight: bold;
    color: #2c3e50;
    padding: 12px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #fff 0%, #F5E6D3 100%);
    border-radius: 8px;
    border: 2px solid #D4A373;
}

.weekday.weekend {
    color: #C8161D;
    border-color: #C8161D;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.day {
    aspect-ratio: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.day:hover {
    background: linear-gradient(135deg, #fff 0%, #F5E6D3 100%);
    border-color: #C8161D;
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 8px 16px rgba(200, 22, 29, 0.2);
}

.day.weekend {
    background: #fff5f5;
}

.day.today {
    background: linear-gradient(135deg, #C8161D 0%, #8B0000 100%);
    color: white;
    font-weight: bold;
    border-color: #D4A373;
    box-shadow: 0 8px 24px rgba(200, 22, 29, 0.4);
}

.day.selected {
    background: linear-gradient(135deg, #D4A373 0%, #C8A876 100%);
    color: white;
    border-color: #C8161D;
    box-shadow: 0 8px 24px rgba(212, 163, 115, 0.4);
}

.day.other-month {
    opacity: 0.25;
    pointer-events: none;
}

.day-number {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 4px;
}

.day-lunar {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

.day.today .day-lunar,
.day.selected .day-lunar {
    color: rgba(255,255,255,0.9);
}

/* 节日标记 */
.holiday-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #C8161D;
    color: white;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.7em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 节气标记 */
.solar-term-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #2BAE85;
    color: white;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.7em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-card {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.sidebar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

.sidebar-card h3 {
    color: #C8161D;
    margin-bottom: 18px;
    font-size: 1.2em;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0e6d8;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 2px;
}

/* 信息项 */
.quick-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #e0d5c7;
    transition: all 0.3s ease;
}

.quick-info-item:hover {
    padding-left: 8px;
    background: rgba(200, 22, 29, 0.05);
}

.quick-info-item:last-child {
    border-bottom: none;
}

.quick-info-label {
    color: #666;
    font-size: 0.95em;
}

.quick-info-value {
    font-weight: bold;
    color: #2c3e50;
}

/* 神煞卡片特殊样式 */
.shensha-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.shensha-item {
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #D4A373;
    transition: all 0.3s ease;
    cursor: pointer;
}

.shensha-item:hover {
    border-left-color: #C8161D;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateX(4px);
}

.shensha-name {
    font-weight: bold;
    color: #C8161D;
    margin-bottom: 6px;
    font-size: 1.05em;
}

.shensha-type {
    display: inline-block;
    background: #D4A373;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-right: 6px;
}

.shensha-description {
    color: #666;
    font-size: 0.9em;
    line-height: 1.6;
    margin-top: 8px;
    display: none; /* 默认隐藏，点击展开 */
}

.shensha-item.expanded .shensha-description {
    display: block;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.search-box input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0d5c7;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #D4A373;
    box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.1);
}

.search-box button {
    background: linear-gradient(135deg, #C8161D 0%, #8B0000 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: linear-gradient(135deg, #D4A373 0%, #C8A876 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 节日列表 */
.holiday-list {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.holiday-item {
    padding: 12px;
    border-bottom: 1px solid #f0e6d8;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.holiday-item:hover {
    background: linear-gradient(135deg, rgba(200, 22, 29, 0.05) 0%, rgba(212, 163, 115, 0.05) 100%);
    padding-left: 16px;
    border-left: 3px solid #C8161D;
}

.holiday-date {
    font-size: 0.9em;
    color: #666;
}

.holiday-name {
    font-weight: bold;
    color: #2c3e50;
    margin-top: 5px;
}

/* ==================== 详细信息面板 ==================== */
.info-panel {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    padding: 35px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-top: 25px;
    position: relative;
}

.info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

.info-panel h2 {
    color: #C8161D;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.8em;
    letter-spacing: 4px;
    position: relative;
    padding-bottom: 15px;
}

.info-panel h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #D4A373, transparent);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.info-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #f0e6d8;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.info-card:hover {
    border-color: #D4A373;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-4px);
}

.info-card h3 {
    color: #C8161D;
    margin-bottom: 20px;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0e6d8;
    letter-spacing: 2px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #e0d5c7;
    align-items: flex-start;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: #666;
    font-size: 0.95em;
    min-width: 100px;
}

.info-value {
    font-weight: 500;
    color: #2c3e50;
    text-align: right;
    flex: 1;
    word-break: break-word;
}

/* 十二时辰列表 */
.hour-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.hour-item {
    background: linear-gradient(135deg, #fff 0%, #F5E6D3 100%);
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #D4A373;
    text-align: center;
    transition: all 0.3s ease;
}

.hour-item:hover {
    border-color: #C8161D;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(200, 22, 29, 0.2);
}

.hour-name {
    font-weight: bold;
    color: #C8161D;
    margin-bottom: 6px;
    font-size: 1.05em;
}

.hour-time {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

.hour-ganzhi {
    font-size: 1.1em;
    font-weight: bold;
    color: #2c3e50;
}

/* ==================== 加载和错误状态 ==================== */
.loading {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 1.05em;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f0e6d8;
    border-top-color: #C8161D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 20px;
    color: #C8161D;
    background: rgba(200, 22, 29, 0.1);
    border-radius: 8px;
    margin: 20px 0;
    border: 2px solid rgba(200, 22, 29, 0.3);
}

/* 缓存指示器 */
.cache-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(212, 163, 115, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
}

.cache-indicator.show {
    display: block;
    animation: slideInUp 0.3s ease;
}

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

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

::-webkit-scrollbar-track {
    background: #f0e6d8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #C8161D 0%, #D4A373 100%);
    border-radius: 4px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8B0000 0%, #C8A876 100%);
}

/* ==================== 响应式设计 ==================== */

/* 平板设备 */
@media (max-width: 1023px) {
    .main-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .header h1 {
        font-size: 2.5em;
        letter-spacing: 4px;
    }
    
    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* 手机设备 */
@media (max-width: 767px) {
    body {
        padding: 10px;
    }
    
    .container {
        max-width: 100%;
    }
    
    /* 头部调整 */
    .header {
        margin-bottom: 20px;
    }
    
    .header-decoration {
        padding: 20px 30px;
    }
    
    .header-decoration::before,
    .header-decoration::after {
        width: 50px;
        height: 50px;
        border-width: 2px;
    }
    
    .header h1 {
        font-size: 1.8em;
        letter-spacing: 2px;
    }
    
    .header h1::before,
    .header h1::after {
        display: none;
    }
    
    .header-subtitle {
        font-size: 1em;
        letter-spacing: 2px;
    }
    
    .header-note {
        font-size: 0.85em;
    }
    
    /* 日历头部 */
    .calendar-header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }
    
    .calendar-header::after {
        display: none;
    }
    
    .month-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .month-selector button {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    .current-date {
        font-size: 1.4em;
        letter-spacing: 2px;
    }
    
    .date-picker {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .date-picker input[type="date"] {
        flex: 1;
        min-width: 150px;
        padding: 10px;
        font-size: 14px;
    }
    
    .date-picker button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* 日历网格 */
    .calendar-grid {
        padding: 15px 10px;
    }
    
    .weekdays {
        gap: 5px;
    }
    
    .weekday {
        padding: 8px 4px;
        font-size: 0.9em;
        border-width: 1px;
    }
    
    .days {
        gap: 5px;
    }
    
    .day {
        padding: 6px;
        border-width: 1px;
        min-height: 60px;
    }
    
    .day-number {
        font-size: 1.1em;
    }
    
    .day-lunar {
        font-size: 0.7em;
    }
    
    .holiday-badge,
    .solar-term-badge {
        padding: 2px 4px;
        font-size: 0.6em;
        border-radius: 4px;
    }
    
    /* 侧边栏 */
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    .sidebar-card {
        padding: 20px;
    }
    
    .sidebar-card h3 {
        font-size: 1.1em;
    }
    
    .shensha-list,
    .holiday-list {
        max-height: 300px;
    }
    
    /* 信息面板 */
    .info-panel {
        padding: 20px 15px;
    }
    
    .info-panel h2 {
        font-size: 1.4em;
        letter-spacing: 2px;
        margin-bottom: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-card {
        padding: 18px;
    }
    
    .info-card h3 {
        font-size: 1.05em;
    }
    
    .info-item {
        flex-direction: column;
        gap: 6px;
        padding: 8px 0;
    }
    
    .info-label {
        min-width: auto;
    }
    
    .info-value {
        text-align: left;
    }
    
    /* 时辰列表 */
    .hour-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .hour-item {
        padding: 10px;
    }
    
    /* 搜索框 */
    .search-box {
        flex-wrap: wrap;
    }
    
    .search-box input {
        min-width: 70px;
    }
    
    /* 缓存指示器 */
    .cache-indicator {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 0.8em;
    }
}

/* 超小屏幕 */
@media (max-width: 375px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    .current-date {
        font-size: 1.2em;
    }
    
    .day {
        min-height: 50px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 1em;
    }
    
    .day-lunar {
        font-size: 0.65em;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    body {
        background: white;
    }
    
    .date-picker,
    .search-box,
    .cache-indicator {
        display: none;
    }
    
    .info-panel {
        page-break-before: always;
    }
}

/* ==================== 辅助类 ==================== */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

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