/* 六爻算卦系统样式 */

/* 基础样式 */
body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 中式标题样式 */
.chinese-title {
    font-family: '华文楷体', 'STKaiti', 'KaiTi', serif;
    font-weight: bold;
    color: #2c3e50;
}

.navbar .chinese-title {
    color: #fff !important;
    font-size: 1.5rem;
}

/* 中式按钮样式 */
.chinese-btn {
    font-family: '华文楷体', 'STKaiti', 'KaiTi', serif;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 12px 30px;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.chinese-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 主要内容区域 */
.main-content {
    min-height: calc(100vh - 76px);
    padding: 20px 0;
}

/* 算卦卡片样式 */
.divination-card {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.divination-card .card-header {
    background: linear-gradient(45deg, #f39c12, #e74c3c);
    color: white;
    border-radius: 15px 15px 0 0;
    border: none;
}

/* 爻的显示样式 */
.lines-container {
    max-width: 600px;
    margin: 0 auto;
}

.line-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #007bff;
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.line-position {
    font-weight: bold;
    color: #495057;
    min-width: 60px;
}

.random-numbers {
    display: flex;
    gap: 5px;
}

.random-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.random-number.zero {
    background: #6c757d;
}

.random-number.one {
    background: #28a745;
}

.line-result {
    display: flex;
    align-items: center;
    gap: 10px;
}

.line-symbol {
    font-size: 1.5rem;
    font-weight: bold;
}

.line-type {
    font-size: 0.9rem;
    color: #6c757d;
}

/* 卦象显示样式 */
.hexagram-display {
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    margin: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hexagram-visual {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    line-height: 1.5;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    white-space: pre-line;
}

.hexagram-info h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.hexagram-judgment {
    font-style: italic;
    color: #7f8c8d;
    margin-top: 10px;
}

/* 历史记录样式 */
.history-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fff;
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.history-date {
    color: #6c757d;
    font-size: 0.9rem;
}

.history-hexagrams {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.history-hexagram {
    flex: 1;
    text-align: center;
}

.history-hexagram-name {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

/* 加载覆盖层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .line-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .hexagram-display {
        margin: 5px;
        padding: 15px;
    }
    
    .history-hexagrams {
        flex-direction: column;
        gap: 10px;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.5s ease;
}

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

/* AI解卦面板样式 */
.ai-panel {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.ai-panel .card-header {
    background: linear-gradient(45deg, #9b59b6, #3498db);
    color: white;
    border-radius: 15px 15px 0 0;
    border: none;
}

.ai-result-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.ai-result-content h1,
.ai-result-content h2,
.ai-result-content h3,
.ai-result-content h4,
.ai-result-content h5,
.ai-result-content h6 {
    color: #2c3e50;
    margin-top: 20px;
    margin-bottom: 10px;
}

.ai-result-content h2 {
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.ai-result-content p {
    margin-bottom: 12px;
    text-align: justify;
}

.ai-result-content ul,
.ai-result-content ol {
    padding-left: 20px;
    margin-bottom: 15px;
}

.ai-result-content li {
    margin-bottom: 5px;
}

.ai-result-content strong {
    color: #e74c3c;
}

.ai-result-content em {
    color: #8e44ad;
    font-style: italic;
}

.ai-result-content blockquote {
    border-left: 4px solid #3498db;
    padding-left: 15px;
    margin: 15px 0;
    color: #7f8c8d;
    font-style: italic;
}

/* AI解卦按钮样式 */
.ai-button-container {
    min-width: 120px;
}

#ai-interpret-btn {
    background: linear-gradient(45deg, #9b59b6, #3498db);
    border: none;
    color: white;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 20px;
}

#ai-interpret-btn:hover {
    background: linear-gradient(45deg, #8e44ad, #2980b9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4);
}

#ai-interpret-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* AI解卦结果弹窗样式 */
.ai-result-modal-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.ai-result-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* Markdown样式优化 */
.ai-result-content h1 {
    font-size: 20px;
    color: #2c3e50;
    margin: 20px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
    font-weight: 600;
}

.ai-result-content h2 {
    font-size: 18px;
    color: #34495e;
    margin: 18px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #bdc3c7;
    font-weight: 600;
}

.ai-result-content h3 {
    font-size: 16px;
    color: #2c3e50;
    margin: 16px 0 10px 0;
    font-weight: 600;
}

.ai-result-content h4,
.ai-result-content h5,
.ai-result-content h6 {
    font-size: 15px;
    color: #2c3e50;
    margin: 14px 0 8px 0;
    font-weight: 600;
}

.ai-result-content p {
    margin: 0 0 12px 0;
    text-align: justify;
    font-size: 14px;
    line-height: 1.6;
}

.ai-result-content ul,
.ai-result-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-result-content li {
    margin: 6px 0;
    font-size: 14px;
    line-height: 1.5;
}

.ai-result-content strong {
    color: #e74c3c;
    font-weight: 600;
}

.ai-result-content em {
    color: #8e44ad;
    font-style: italic;
}

.ai-result-content code {
    background: #f1f2f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e74c3c;
}

.ai-result-content pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    margin: 15px 0;
    overflow-x: auto;
    font-size: 13px;
}

.ai-result-content blockquote {
    border-left: 4px solid #3498db;
    padding: 10px 15px;
    margin: 15px 0;
    background: #f8f9fa;
    color: #7f8c8d;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

.ai-result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 14px;
}

.ai-result-content th,
.ai-result-content td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.ai-result-content th {
    background: #f1f2f6;
    font-weight: 600;
    color: #2c3e50;
}

.ai-result-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, #3498db, transparent);
    margin: 20px 0;
}

/* 流式文本动画 */
.ai-streaming-text {
    position: relative;
}

.ai-streaming-text::after {
    content: '|';
    animation: blink 1s infinite;
    color: #3498db;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 弹窗响应式调整 */
@media (max-width: 1200px) {
    .modal-xl {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    .ai-result-modal-content {
        max-height: 60vh;
        padding: 15px;
    }
    
    .ai-result-content {
        padding: 15px;
        font-size: 13px;
    }
    
    .ai-result-content h1 {
        font-size: 18px;
    }
    
    .ai-result-content h2 {
        font-size: 16px;
    }
    
    .ai-result-content h3 {
        font-size: 15px;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
    }
}

/* 打印样式 */
@media print {
    .modal-header,
    .modal-footer {
        display: none !important;
    }
    
    .ai-result-modal-content {
        max-height: none;
        overflow: visible;
        padding: 0;
        background: white;
    }
    
    .ai-result-content {
        box-shadow: none;
        border: none;
        padding: 0;
    }
}
