/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #333;
    min-height: 100vh;
}

/* 容器样式 */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
}

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

.loading-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.loading-icon {
    margin-bottom: 20px;
}

.loading-image {
    width: 80px;
    height: 80px;
    animation: rotate 2s linear infinite;
}

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

.progress-bar {
    width: 200px;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin: 15px auto;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9c684b 0%, #c6976a 100%);
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 16px;
    color: #555;
}

/* 顶部标题和搜索框 */
.header {
    display: flex;
    flex-direction: column;
    padding: 20px 30px;
    background: linear-gradient(135deg, #1a535c 0%, #4ecdc4 100%);
    color: white;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.header h1 {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
}

/* 搜索框容器布局 */
.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 15px;
}

.search-input {
    flex: 1;
    height: 36px;
    padding: 0 15px;
    font-size: 14px;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 18px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: white;
    background: white;
}

/* 起卦按钮样式 */
.divine-btn {
    width: 80px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 18px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.divine-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.divine-btn:active {
    transform: scale(0.96);
}

/* 搜索按钮样式 */
.search-btn {
    width: 80px;
    height: 36px;
    background: linear-gradient(135deg, #1a535c 0%, #2b7a78 100%);
    color: white;
    border-radius: 18px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    box-shadow: 0 4px 12px rgba(26, 83, 92, 0.4);
}

.search-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 6px rgba(26, 83, 92, 0.4);
}

/* 卦象滚动区域 */
.hexagram-scroll {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 30px;
}

/* 卦象网格 */
.hexagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
}

/* 卦象按钮 */
.hexagram-button {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hexagram-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 卦象线条 */
.hexagram-lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.hexagram-line {
    width: 80px;
    height: 2px;
    background: #1a535c;
    position: relative;
}

.hexagram-line.yao-2::before, .hexagram-line.yao-2::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: #1a535c;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.hexagram-line.yao-2::before {
    left: 20px;
}

.hexagram-line.yao-2::after {
    right: 20px;
}

/* 卦名 */
.hexagram-name {
    font-size: 14px;
    color: #1a535c;
    text-align: center;
    font-weight: 600;
}

/* 底部操作按钮 */
.footer-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: auto;
    padding: 20px 0;
}

.footer-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #1a535c 0%, #2b7a78 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.footer-btn.highlight {
    background: linear-gradient(135deg, #f9c80e 0%, #f8961e 100%);
    color: #1a535c;
    border-color: #f9c80e;
    box-shadow: 0 4px 16px rgba(249, 200, 14, 0.4);
    font-size: 15px;
    transform: scale(1.05);
}

.footer-btn.highlight:hover {
    box-shadow: 0 6px 20px rgba(249, 200, 14, 0.6);
    transform: scale(1.08);
}

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

.footer-btn:active {
    transform: scale(0.96);
}

/* 卦象详情弹窗 */
.index-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    display: none;
    padding: 20px;
}

.modal-container {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.index-modal-header {
    background: linear-gradient(135deg, #1a535c 0%, #2b7a78 100%);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.index-modal-title {
    font-size: 20px;
    font-weight: bold;
}

.modal-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 弹窗内容 */
.index-modal-content {
    flex: 1;
    background: white;
    overflow-y: auto;
    padding: 40px;
}

/* 内容区块 */
.section {
    margin-bottom: 30px;
}

/* 弹窗底部 */
.modal-footer {
    padding: 20px 40px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #1a535c;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.section-text {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

/* 爻辞列表 */
.line-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.line-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

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

.line-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hexagram-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .footer-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .index-modal-content {
        padding: 20px;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: #4ecdc4;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2b7a78;
}