/**
 * 天机问卦样式
 */

/* 主容器 */
.wengu-main {
    min-height: 100vh;
    padding-top: 80px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    position: relative;
}

.wengu-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="%23c9a96e" opacity="0.1"/></svg>') repeat;
    background-size: 50px 50px;
    pointer-events: none;
}

/* 天机真人介绍 */
.master-intro {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 30px 20px;
    position: relative;
    z-index: 1;
}

.master-avatar {
    position: relative;
    width: 80px;
    height: 80px;
}

.avatar-glow {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.avatar-img {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #c9a96e 0%, #8b7355 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: 0 4px 20px rgba(201, 169, 110, 0.3);
    position: relative;
    z-index: 1;
}

.master-info {
    text-align: left;
}

.master-name {
    font-size: 28px;
    color: #c9a96e;
    margin: 0;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(201, 169, 110, 0.3);
}

.master-title {
    font-size: 13px;
    color: #8888a8;
    margin: 5px 0 0;
}

/* 积分栏 */
.points-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 12px 20px;
    background: rgba(201, 169, 110, 0.1);
    border-top: 1px solid rgba(201, 169, 110, 0.2);
    border-bottom: 1px solid rgba(201, 169, 110, 0.2);
    position: relative;
    z-index: 1;
}

.points-label {
    color: #888;
    font-size: 14px;
}

.points-value {
    color: #c9a96e;
    font-size: 20px;
    font-weight: 600;
}

.points-cost {
    color: #666;
    font-size: 12px;
}

.points-free {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* 对话容器 */
.chat-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.chat-messages {
    min-height: 300px;
    max-height: calc(100vh - 400px);
    overflow-y: auto;
    padding: 10px 0;
    margin-bottom: 20px;
}

/* 消息样式 */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #c9a96e 0%, #8b7355 100%);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-content {
    max-width: 70%;
    margin: 0 12px;
}

.message-text {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 15px;
}

.message.assistant .message-text {
    background: rgba(201, 169, 110, 0.15);
    color: #e0e0e0;
    border: 1px solid rgba(201, 169, 110, 0.2);
    border-radius: 4px 16px 16px 16px;
}

.message.user .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 16px 4px 16px 16px;
}

.message-time {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

/* 打字机效果 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #c9a96e;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* 问题类型选择 */
.type-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.type-label {
    color: #888;
    font-size: 13px;
}

.type-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #aaa;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.type-btn:hover {
    background: rgba(201, 169, 110, 0.2);
    border-color: rgba(201, 169, 110, 0.3);
}

.type-btn.active {
    background: rgba(201, 169, 110, 0.3);
    border-color: #c9a96e;
    color: #c9a96e;
}

/* 输入区域 */
.input-area {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px;
}

.input-box {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 15px;
    resize: none;
    outline: none;
    line-height: 1.5;
}

.input-box::placeholder {
    color: #666;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.char-count {
    color: #666;
    font-size: 12px;
}

.send-btn {
    background: linear-gradient(135deg, #c9a96e 0%, #8b7355 100%);
    border: none;
    color: #1a1a2e;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(201, 169, 110, 0.4);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 结束按钮 */
.end-session {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.end-btn {
    background: transparent;
    border: 1px solid #c9a96e;
    color: #c9a96e;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.end-btn:hover {
    background: rgba(201, 169, 110, 0.2);
}

/* 卦象卡片弹窗 */
.card-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.card-content {
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    border: 1px solid rgba(201, 169, 110, 0.3);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    position: relative;
    max-width: 360px;
    width: 90%;
}

.card-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
}

.card-content h3 {
    color: #c9a96e;
    margin: 0 0 20px;
    font-size: 18px;
}

.card-body {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#cardCanvas {
    border-radius: 8px;
}

.card-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.card-btn {
    background: rgba(201, 169, 110, 0.2);
    border: 1px solid #c9a96e;
    color: #c9a96e;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.card-btn:hover {
    background: rgba(201, 169, 110, 0.3);
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* 历史记录页 */
.history-main {
    min-height: 100vh;
    padding-top: 80px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

.history-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header h1 {
    color: #c9a96e;
    font-size: 24px;
    margin: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    background: rgba(201, 169, 110, 0.1);
    border-color: rgba(201, 169, 110, 0.3);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-hexagram {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-symbol {
    font-size: 20px;
}

.history-name {
    color: #c9a96e;
    font-size: 16px;
}

.history-date {
    color: #666;
    font-size: 12px;
}

.history-question {
    color: #aaa;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-type {
    display: inline-block;
    background: rgba(201, 169, 110, 0.2);
    color: #c9a96e;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-right: 8px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .master-intro {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .master-info {
        text-align: center;
    }

    .master-name {
        font-size: 24px;
    }

    .points-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 15px;
    }

    .chat-container {
        padding: 15px;
    }

    .chat-messages {
        min-height: 250px;
        max-height: calc(100vh - 450px);
    }

    .message-content {
        max-width: 85%;
    }

    .type-selector {
        justify-content: flex-start;
    }

    .type-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .card-content {
        padding: 16px;
    }

    #cardCanvas {
        width: 280px;
        height: 350px;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 90%;
    }

    .type-label {
        width: 100%;
        margin-bottom: 5px;
    }

    .input-actions {
        flex-direction: column;
        gap: 10px;
    }

    .send-btn {
        width: 100%;
    }
}
