/* 商用级样式表 */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #50e3c2;
    --success-color: #7ed321;
    --warning-color: #f5a623;
    --danger-color: #d0021b;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --card-bg: #fff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: all 0.3s ease;
}



/* 基础样式 */
body {
    background-color: var(--bg-color);
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    position: relative; /* 确保水印相对body定位 */
}

/* 水印样式 */
body::after {
    content: "中国宝钰";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 120px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.05);
    z-index: -100; /* 降低层级确保在背景最底层 */
    transform: rotate(-15deg);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0.8; /* 微调透明度 */
}

/* 针对不同页面的微调 */
.index-page::after {
    /* 首页水印可稍大 */
    font-size: 150px;
}

.result-page::after {
    /* 结果页水印可稍小 */
    font-size: 100px;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    padding: 2rem 1rem;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-bottom: 2rem;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 2rem;
}

/* 表单样式 */
.form-control {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    transition: var(--transition);
    background-color: white;
    color: var(--text-color);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Flatpickr 样式 */
.flatpickr-calendar {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-family: inherit;
}

.flatpickr-day.selected, 
.flatpickr-day.selected:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.flatpickr-time input {
    color: var(--text-color);
}

.flatpickr-input {
    background: white url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234a90e2'%3e%3cpath d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V9h14v10zM5 7V5h14v2H5z'/%3e%3c/svg%3e") no-repeat right 0.75rem center/16px 16px;
    padding-right: 2.5rem;
    cursor: pointer;
}

.flatpickr-input[readonly] {
    background-color: white;
}

.flatpickr-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* 响应式样式 */
@media (max-width: 768px) {
    .flatpickr-calendar {
        width: 100%;
        max-width: 300px;
        left: 50% !important;
        transform: translateX(-50%);
    }
    
    .flatpickr-input {
        padding: 0.75rem;
        background-position: right 0.5rem center;
    }
}

/* 响应式时间选择器 */
@media (max-width: 768px) {
    input[type="date"],
    input[type="time"] {
        padding: 0.75rem;
        background-position: right 0.5rem center;
    }
}

/* 按钮样式 */
.btn {
    border-radius: 25px;
    padding: 0.75rem 2rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    border: none;
}

.btn-primary:hover {
    background: #357abd;
}

/* 分析内容样式 */
.analysis-content {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 1.1rem;
    color: var(--text-color);
    animation: fadeIn 0.5s ease;
}

/* 表格样式 */
.table {
    margin-top: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.table th {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
    padding: 1rem;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .card {
        margin: 0.5rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .analysis-content {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* 五行颜色样式 */
.wuxing-wood { 
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}
.wuxing-fire { 
    color: #F44336;
    background-color: rgba(244, 67, 54, 0.1);
}
.wuxing-earth { 
    color: #795548;
    background-color: rgba(121, 85, 72, 0.1);
}
.wuxing-metal { 
    color: #FFD700;
    background-color: rgba(255, 215, 0, 0.1);
}
.wuxing-water { 
    color: #2196F3;
    background-color: rgba(33, 150, 243, 0.1);
}

/* 基础响应式设置 */
@media (max-width: 992px) {
    .container {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* 八字网格调整 */
    .bazi-grid {
        grid-template-columns: auto repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .bazi-header {
        grid-column: 2 / 4;
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 信息卡片调整 */
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .info-value {
        width: 100%;
        text-align: left !important;
    }
    
    /* 按钮调整 */
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    /* 页脚操作区调整为垂直排列 */
    .footer-actions {
        flex-direction: column;
    }
}

@media (max-width: 576px) {
    /* 进一步简化八字网格 */
    .bazi-grid {
        grid-template-columns: auto 1fr;
    }
    
    .bazi-header {
        grid-column: 2 / 3;
        grid-template-columns: 1fr;
    }
    
    /* 调整字体大小 */
    .card-title {
        font-size: 1.2rem;
    }
    
    .tiangan, .dizhi {
        font-size: 1.1rem;
        padding: 0.6rem;
    }
    
    /* 表单元素调整 */
    .form-control, .form-select {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    /* 五行标签调整 */
    .wuxing-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    /* 网格布局改为单列 */
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* 确保移动端滚动顺畅 */
html {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* 移动端表单元素优化 */
@media (max-width: 576px) {
    .form-section {
        margin-bottom: 15px;
    }
    
    .form-check {
        margin-bottom: 10px;
    }
    
    .region-selector .layui-form-item {
        flex-direction: column;
    }
    
    .region-selector .flex-fill {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* 移动端提示框调整 */
@media (max-width: 576px) {
    .alert, .alert2 {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .alert i, .alert2 i {
        font-size: 1rem;
    }
}