/* ===== AI Helper 浮動按鈕 ===== */
.pa-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #92400e;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.pa-fab:hover {
    background: #fef3c7;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    color: #78350f;
}

.pa-fab:active {
    transform: scale(0.97);
}

/* ===== AI Helper 彈出視窗 ===== */
.pa-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 20px;
}

.pa-modal.show {
    display: flex;
}

.pa-card {
    width: min(420px, calc(100vw - 40px));
    height: min(560px, calc(100vh - 40px));
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: none;
    background: linear-gradient(135deg, #f0c14b 0%, #e6b33a 100%);
}

.pa-title {
    font-weight: 700;
    font-size: 1.4rem;
    color: #fff;
}

.pa-close,
.pa-header .btn-close {
    border: 0;
    background: transparent !important;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 4px 12px;
    color: #fff;
    transition: all 0.2s;
}

.pa-close:hover,
.pa-header .btn-close:hover {
    color: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
}

.pa-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.pa-msg {
    margin: 10px 0;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pa-user {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    margin-left: auto;
    max-width: 85%;
    border-radius: 16px 16px 6px 16px;
    border: 1px solid #a7f3d0;
}

.pa-assistant {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8efff 100%);
    max-width: 85%;
    border-radius: 16px 16px 16px 6px;
    border: 1px solid #dbeafe;
}

.pa-msg.system {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f0c14b;
    font-size: 0.9rem;
}

.pa-inputbar {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

.pa-input,
#paInput {
    flex: 1;
    resize: none;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    padding: 12px 16px;
    font-size: 16px;
    transition: all 0.2s ease;
}

.pa-input:focus,
#paInput:focus {
    border-color: #f0c14b;
    outline: none;
    box-shadow: 0 0 0 4px rgba(240, 193, 75, 0.2);
}

.pa-send,
#paSend {
    border: 0;
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    background: linear-gradient(135deg, #f0c14b 0%, #e6b33a 100%);
    color: #fff;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(240, 193, 75, 0.3);
}

.pa-send:hover,
#paSend:hover {
    background: linear-gradient(135deg, #e6b33a 0%, #d4a12e 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(240, 193, 75, 0.4);
}

.pa-hint {
    font-size: 12px;
    color: #94a3b8;
    padding: 0 16px 14px;
    background: #fff;
}

.pa-speak-btn {
    background: transparent;
    border: none;
    color: #d4a12e;
    font-size: 1rem;
    padding: 2px 6px;
    margin-left: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.pa-speak-btn:hover {
    color: #b8860b;
    transform: scale(1.2);
}

/* ===== 手機版 AI Helper ===== */
@media (max-width: 640px) {
    .pa-fab {
        right: 14px;
        bottom: 14px;
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .pa-card {
        width: calc(100vw - 32px);
        height: 70vh;
        max-height: 500px;
        border-radius: 16px;
        margin: auto;
    }
    
    .pa-modal {
        align-items: center;
        justify-content: center;
        padding: 16px;
    }
    
    .pa-header {
        padding: 14px 16px;
    }
    
    .pa-header .btn-close {
        font-size: 1.6rem;
        padding: 8px 12px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* ===== AI Helper 滾動條 ===== */
.pa-body::-webkit-scrollbar {
    width: 6px;
}

.pa-body::-webkit-scrollbar-track {
    background: transparent;
}

.pa-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.pa-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}