/* 周易六爻占卜系统 - 样式文件 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8B4513;
    --primary-dark: #654321;
    --secondary-color: #D4AF37;
    --bg-color: #f5f0e6;
    --card-bg: #fff;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ddd;
    --success-color: #4CAF50;
    --error-color: #f44336;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'SimHei', sans-serif;
    background: linear-gradient(135deg, #f5f0e6 0%, #e8e0d0 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    text-align: center;
    padding: 30px 0;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 30px;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: bold;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
}

.settings-link {
    position: absolute;
    top: 30px;
    right: 0;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    transition: all 0.3s;
    background: var(--card-bg);
}

.settings-link:hover {
    background: var(--primary-color);
    color: white;
}

/* 主内容 */
.main-content {
    flex: 1;
}

/* 问题输入区域 */
.question-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.question-section label {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--primary-color);
}

#question {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#question:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 按钮区域 */
.action-section {
    text-align: center;
    margin: 30px 0;
}

.btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.4);
}

.btn-primary:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #b8960c);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.btn-secondary:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

/* 结果区域 */
.result-section {
    animation: fadeIn 0.5s ease-in;
}

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

/* 卦象卡片 */
.hexagram-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

.hexagram-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: bold;
}

.hexagram-symbol {
    font-size: 4rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 15px;
    letter-spacing: 10px;
}

.hexagram-name {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.hexagram-description {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.8;
    padding: 0 20px;
}

/* 上下卦信息 */
.trigram-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.trigram {
    text-align: center;
}

.trigram-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.trigram-name {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 3px;
}

.trigram-nature {
    display: block;
    font-size: 1rem;
    color: var(--text-light);
}

/* 爻象区域 */
.yaos-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.yaos-section h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.yaos-list {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.yao-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--bg-color);
    border-radius: 5px;
    border-left: 4px solid var(--primary-color);
}

.yao-symbol {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    width: 60px;
}

.yao-name {
    flex: 1;
    text-align: center;
    font-weight: bold;
}

.yao-changing {
    color: var(--error-color);
    font-size: 0.9rem;
}

/* 变爻区域 */
.changing-yaos-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.changing-yaos-section h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.changing-yaos-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.changing-yao-item {
    padding: 12px;
    background: #fff5f5;
    border-left: 4px solid var(--error-color);
    border-radius: 5px;
}

.changing-yao-name {
    font-weight: bold;
    color: var(--error-color);
    margin-bottom: 5px;
}

.changing-yao-text {
    color: var(--text-light);
    line-height: 1.6;
}

/* AI解卦结果 */
.interpretation-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.interpretation-section h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.interpretation-content {
    line-height: 1.8;
    color: var(--text-color);
}

/* Markdown 样式 */
.interpretation-content h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 25px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
}

.interpretation-content h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.interpretation-content h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin: 18px 0 10px 0;
}

.interpretation-content h4 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 15px 0 8px 0;
}

.interpretation-content h5,
.interpretation-content h6 {
    font-size: 1rem;
    color: var(--primary-color);
    margin: 12px 0 6px 0;
}

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

.interpretation-content strong {
    color: var(--primary-color);
    font-weight: bold;
}

.interpretation-content em {
    font-style: italic;
    color: var(--text-light);
}

.interpretation-content ul,
.interpretation-content ol {
    margin: 12px 0;
    padding-left: 25px;
}

.interpretation-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

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

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

.interpretation-content blockquote {
    margin: 15px 0;
    padding: 10px 20px;
    border-left: 4px solid var(--secondary-color);
    background: var(--bg-color);
    color: var(--text-light);
    font-style: italic;
}

.interpretation-content code {
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-dark);
}

.interpretation-content pre {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 15px 0;
}

.interpretation-content pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
}

.interpretation-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.interpretation-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.interpretation-content th,
.interpretation-content td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
}

.interpretation-content th {
    background: var(--bg-color);
    font-weight: bold;
    color: var(--primary-color);
}

.interpretation-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.interpretation-content a:hover {
    text-decoration: underline;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
}

/* 加载动画 */
.loading-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .settings-link {
        position: static;
        display: inline-block;
        margin-top: 15px;
        font-size: 1rem;
    }

    .hexagram-symbol {
        font-size: 3rem;
        letter-spacing: 5px;
    }

    .hexagram-name {
        font-size: 1.5rem;
    }

    .trigram-info {
        gap: 20px;
    }

    .trigram-name {
        font-size: 1.1rem;
    }

    .btn {
        padding: 12px 30px;
        font-size: 1rem;
        min-width: 150px;
    }

    .question-section,
    .yaos-section,
    .changing-yaos-section,
    .interpretation-section,
    .hexagram-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .hexagram-symbol {
        font-size: 2.5rem;
    }

    .hexagram-name {
        font-size: 1.3rem;
    }

    .trigram-info {
        flex-direction: column;
        gap: 15px;
    }

    .btn {
        padding: 10px 25px;
        font-size: 0.95rem;
        min-width: 120px;
    }

    .question-section,
    .yaos-section,
    .changing-yaos-section,
    .interpretation-section,
    .hexagram-card {
        padding: 15px;
    }
}
