/**
 * AI 心灵对话 + 诗意生成器 共享样式
 * Cosky Art - AI Mind Chat & Poetry
 */

/* ==================== 心灵对话页面 ==================== */

/* 聊天容器 */
.mindchat-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
    min-height: 500px;
    max-width: 700px;
    margin: 0 auto;
    background: rgba(15, 18, 35, 0.6);
    border: 1px solid rgba(100, 120, 200, 0.2);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 聊天头部 */
.mindchat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(100, 120, 200, 0.15);
    background: rgba(20, 24, 50, 0.5);
}

.mindchat-header-icon {
    font-size: 28px;
}

.mindchat-header-info h3 {
    margin: 0;
    font-size: 16px;
    color: #e8eaf0;
    font-weight: 600;
}

.mindchat-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #8888aa;
}

/* 消息区域 */
.mindchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mindchat-messages::-webkit-scrollbar { width: 4px; }
.mindchat-messages::-webkit-scrollbar-track { background: transparent; }
.mindchat-messages::-webkit-scrollbar-thumb { background: rgba(100, 120, 200, 0.3); border-radius: 2px; }

/* 消息气泡 */
.mindchat-msg {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: mindchat-fadeIn 0.3s ease;
}

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

.mindchat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.mindchat-msg.ai {
    align-self: flex-start;
}

.mindchat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.mindchat-msg.user .mindchat-avatar {
    background: rgba(100, 120, 200, 0.3);
}

.mindchat-msg.ai .mindchat-avatar {
    background: rgba(200, 150, 100, 0.3);
}

.mindchat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
}

.mindchat-msg.user .mindchat-bubble {
    background: rgba(100, 120, 200, 0.2);
    border: 1px solid rgba(100, 120, 200, 0.3);
    color: #d0d4e8;
    border-bottom-right-radius: 4px;
}

.mindchat-msg.ai .mindchat-bubble {
    background: rgba(30, 35, 65, 0.8);
    border: 1px solid rgba(100, 120, 200, 0.15);
    color: #c5cae0;
    border-bottom-left-radius: 4px;
}

.mindchat-bubble strong { color: #b0b8d0; }
.mindchat-bubble em { color: #a0a8c0; }

/* 快捷按钮 */
.mindchat-quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid rgba(100, 120, 200, 0.1);
    background: rgba(20, 24, 50, 0.3);
}

.mindchat-quick-btn {
    padding: 6px 14px;
    background: rgba(100, 120, 200, 0.12);
    border: 1px solid rgba(100, 120, 200, 0.2);
    border-radius: 20px;
    color: #a0a8c0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mindchat-quick-btn:hover {
    background: rgba(100, 120, 200, 0.25);
    color: #d0d4e8;
    border-color: rgba(100, 120, 200, 0.4);
}

/* 输入区域 */
.mindchat-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid rgba(100, 120, 200, 0.1);
    background: rgba(20, 24, 50, 0.5);
}

.mindchat-input {
    flex: 1;
    padding: 10px 16px;
    background: rgba(30, 35, 65, 0.8);
    border: 1px solid rgba(100, 120, 200, 0.2);
    border-radius: 25px;
    color: #d0d4e8;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.mindchat-input:focus {
    border-color: rgba(100, 120, 200, 0.5);
}

.mindchat-input::placeholder {
    color: #666688;
}

.mindchat-send-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(100, 120, 200, 0.3), rgba(150, 100, 200, 0.3));
    border: 1px solid rgba(100, 120, 200, 0.3);
    border-radius: 25px;
    color: #d0d4e8;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mindchat-send-btn:hover {
    background: linear-gradient(135deg, rgba(100, 120, 200, 0.5), rgba(150, 100, 200, 0.5));
    transform: translateY(-1px);
}

.mindchat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 欢迎消息 */
.mindchat-welcome {
    text-align: center;
    padding: 20px;
    color: #8888aa;
    font-size: 14px;
    line-height: 1.8;
}

.mindchat-welcome .welcome-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

/* 加载指示器 */
.mindchat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.mindchat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8888aa;
    animation: mindchat-bounce 1.4s ease-in-out infinite;
}

.mindchat-typing span:nth-child(2) { animation-delay: 0.2s; }
.mindchat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mindchat-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ==================== 诗意生成器 ==================== */

/* 诗意生成器入口卡片 */
#poetry-entry {
    cursor: pointer;
}

/* 入口卡片 */
.poetry-entry-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(100, 120, 200, 0.1), rgba(150, 100, 200, 0.1));
    border: 1px solid rgba(150, 150, 200, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #c5cae0;
}

.poetry-entry-card:hover {
    background: linear-gradient(135deg, rgba(100, 120, 200, 0.2), rgba(150, 100, 200, 0.2));
    border-color: rgba(150, 150, 220, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(100, 120, 200, 0.15);
}

.poetry-entry-card .entry-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.poetry-entry-card .entry-info h4 {
    margin: 0 0 4px;
    font-size: 15px;
    color: #e8eaf0;
}

.poetry-entry-card .entry-info p {
    margin: 0;
    font-size: 13px;
    color: #8888aa;
}

/* 诗意弹窗 */
.poetry-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0; visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.poetry-modal-overlay.active { opacity: 1; visibility: visible; }

.poetry-modal-container {
    background: rgba(15, 18, 35, 0.95);
    border: 1px solid rgba(100, 120, 200, 0.3);
    border-radius: 16px;
    max-width: 520px; width: 100%;
    box-shadow: 0 0 40px rgba(100, 120, 200, 0.15), 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.poetry-modal-overlay.active .poetry-modal-container {
    transform: translateY(0) scale(1);
}

.poetry-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(100, 120, 200, 0.15);
}

.poetry-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #e8eaf0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.poetry-modal-close {
    background: none; border: none;
    color: #8888aa; font-size: 24px;
    cursor: pointer; padding: 4px 8px;
    border-radius: 8px; transition: all 0.2s ease;
}

.poetry-modal-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.poetry-modal-body { padding: 20px; }

/* 诗意输入区 */
.poetry-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.poetry-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(30, 35, 65, 0.8);
    border: 1px solid rgba(100, 120, 200, 0.2);
    border-radius: 25px;
    color: #d0d4e8;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.poetry-input:focus { border-color: rgba(100, 120, 200, 0.5); }
.poetry-input::placeholder { color: #666688; }

.poetry-generate-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(150, 100, 200, 0.3), rgba(100, 120, 200, 0.3));
    border: 1px solid rgba(150, 100, 200, 0.3);
    border-radius: 25px;
    color: #d0d4e8;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.poetry-generate-btn:hover {
    background: linear-gradient(135deg, rgba(150, 100, 200, 0.5), rgba(100, 120, 200, 0.5));
    transform: translateY(-1px);
}

.poetry-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* 快捷关键词 */
.poetry-quick-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.poetry-quick-keywords span {
    padding: 5px 12px;
    background: rgba(100, 120, 200, 0.1);
    border: 1px solid rgba(100, 120, 200, 0.15);
    border-radius: 15px;
    color: #8888aa;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poetry-quick-keywords span:hover {
    background: rgba(100, 120, 200, 0.25);
    color: #c5cae0;
}

/* 诗卡展示 */
.poetry-card {
    background: linear-gradient(135deg, rgba(20, 24, 50, 0.9), rgba(30, 25, 60, 0.9));
    border: 1px solid rgba(150, 150, 200, 0.2);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    animation: poetry-reveal 0.6s ease;
}

@keyframes poetry-reveal {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.poetry-card .poem-title {
    font-size: 18px;
    color: #e8eaf0;
    margin: 0 0 16px;
    font-weight: 600;
}

.poetry-card .poem-body {
    font-size: 15px;
    color: #c5cae0;
    line-height: 2;
    white-space: pre-line;
}

.poetry-card .poem-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(100, 120, 200, 0.1);
    display: flex;
    justify-content: center;
    gap: 12px;
}

.poem-copy-btn {
    padding: 6px 16px;
    background: rgba(100, 120, 200, 0.15);
    border: 1px solid rgba(100, 120, 200, 0.2);
    border-radius: 15px;
    color: #a0a8c0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poem-copy-btn:hover { background: rgba(100, 120, 200, 0.3); color: #d0d4e8; }

/* 诗意加载动画 */
.poetry-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    color: #8888aa;
}

.poetry-loading-spinner {
    width: 40px; height: 40px;
    border: 2px solid rgba(100, 120, 200, 0.2);
    border-top-color: rgba(150, 170, 255, 0.6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

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

/* ==================== AI 文章共鸣 ==================== */

/* 共鸣按钮 */
.ai-resonance-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(150, 100, 200, 0.12), rgba(100, 120, 200, 0.12));
    border: 1px solid rgba(150, 100, 200, 0.2);
    border-radius: 12px;
    color: #c5cae0;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 16px;
}

.ai-resonance-btn:hover {
    background: linear-gradient(135deg, rgba(150, 100, 200, 0.25), rgba(100, 120, 200, 0.25));
    border-color: rgba(150, 100, 200, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(150, 100, 200, 0.15);
}

/* 共鸣弹窗 */
.resonance-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0; visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.resonance-modal-overlay.active { opacity: 1; visibility: visible; }

.resonance-modal-container {
    background: rgba(15, 18, 35, 0.95);
    border: 1px solid rgba(100, 120, 200, 0.3);
    border-radius: 16px;
    max-width: 520px; width: 100%;
    max-height: 85vh; overflow: hidden;
    box-shadow: 0 0 40px rgba(100, 120, 200, 0.15), 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.resonance-modal-overlay.active .resonance-modal-container {
    transform: translateY(0) scale(1);
}

.resonance-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(100, 120, 200, 0.15);
}

.resonance-modal-header h3 {
    margin: 0; font-size: 16px; color: #e8eaf0;
    display: flex; align-items: center; gap: 8px;
}

.resonance-modal-close {
    background: none; border: none; color: #8888aa; font-size: 24px;
    cursor: pointer; padding: 4px 8px; border-radius: 8px;
    transition: all 0.2s ease;
}

.resonance-modal-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.resonance-modal-body { padding: 20px; overflow-y: auto; }

/* 文章信息 */
.resonance-article-info {
    padding: 10px 14px;
    background: rgba(100, 120, 200, 0.08);
    border-radius: 10px;
    margin-bottom: 16px;
}

.resonance-article-label {
    font-size: 11px; color: #8888aa; margin-bottom: 4px;
}

.resonance-article-name {
    font-size: 14px; color: #d0d4e8; font-weight: 500;
}

/* 输入区 */
.resonance-input-area {
    display: flex; flex-direction: column; gap: 12px;
}

.resonance-textarea {
    width: 100%; min-height: 80px; padding: 12px 16px;
    background: rgba(30, 35, 65, 0.8);
    border: 1px solid rgba(100, 120, 200, 0.2);
    border-radius: 12px; color: #d0d4e8; font-size: 14px;
    outline: none; resize: vertical; font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.resonance-textarea:focus { border-color: rgba(100, 120, 200, 0.5); }
.resonance-textarea::placeholder { color: #666688; }

.resonance-send-btn {
    align-self: flex-end;
    padding: 10px 24px;
    background: linear-gradient(135deg, rgba(150, 100, 200, 0.3), rgba(100, 120, 200, 0.3));
    border: 1px solid rgba(150, 100, 200, 0.3);
    border-radius: 25px; color: #d0d4e8; font-size: 14px;
    cursor: pointer; transition: all 0.2s ease;
}

.resonance-send-btn:hover {
    background: linear-gradient(135deg, rgba(150, 100, 200, 0.5), rgba(100, 120, 200, 0.5));
    transform: translateY(-1px);
}

.resonance-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* 共鸣回应 */
.resonance-response {
    margin-top: 16px;
    padding: 16px;
    background: rgba(30, 35, 65, 0.6);
    border: 1px solid rgba(100, 120, 200, 0.15);
    border-radius: 12px;
    animation: resonance-fadeIn 0.4s ease;
}

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

.resonance-response-icon {
    font-size: 20px; margin-bottom: 8px;
}

.resonance-response-content {
    font-size: 14px; color: #c5cae0; line-height: 1.8;
}

.resonance-response-content strong { color: #b0b8d0; }
.resonance-response-content em { color: #a0a8c0; }

/* 共鸣加载 */
.resonance-loading {
    display: flex; flex-direction: column;
    align-items: center; padding: 30px;
    color: #8888aa;
}

.resonance-loading-spinner {
    width: 40px; height: 40px;
    border: 2px solid rgba(100, 120, 200, 0.2);
    border-top-color: rgba(150, 170, 255, 0.6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

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

/* 移动端适配 */
@media (max-width: 768px) {
    .resonance-modal-overlay { padding: 10px; align-items: flex-end; }

    .resonance-modal-container {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 80vh;
    }

    .mindchat-container {
        height: 80vh;
        border-radius: 12px;
    }

    .mindchat-msg { max-width: 92%; }

    .poetry-modal-overlay { padding: 10px; align-items: flex-end; }

    .poetry-modal-container {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }
}
