/**
 * Freelix Chat Button Styles
 * 統一設計風格，使用base.css定義的變數
 */

/* 聊天按鈕樣式 */
.freelix-chat-button-wrapper {
    display: inline-block;
    width: 100%;
}

.freelix-chat-button {
    width: 100%;
    background-color: white;
}

.freelix-chat-button:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.freelix-chat-button i {
    font-size: 18px;
    margin-right: var(--spacing-2);
}

/* 彈出框樣式 */
.freelix-chat-popup {
    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: 9999;
}

.chat-popup-content {
    background: var(--neutral-50);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.chat-popup-header {
    padding: var(--spacing-5);
    border-bottom: 1px solid var(--neutral-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-popup-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--neutral-900);
    font-family: var(--font-heading);
    font-weight: 600;
}

.close-popup {
    background: none;
    border: none;
    font-size: var(--text-2xl);
    color: var(--neutral-600);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-popup:hover {
    color: var(--neutral-900);
}

.chat-popup-form {
    padding: var(--spacing-5);
}

.form-group {
    margin-bottom: var(--spacing-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-2);
    font-weight: 500;
    color: var(--neutral-700);
    font-family: var(--font-body);
    font-size: var(--text-sm);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--spacing-3);
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: var(--font-body);
    color: var(--neutral-900);
    background-color: var(--neutral-50);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: var(--spacing-3);
    justify-content: flex-end;
}

.submit-button,
.cancel-button {
    padding: var(--spacing-3) var(--spacing-5);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-button {
    background: var(--primary-color);
    color: var(--neutral-50);
}

.submit-button:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.submit-button:disabled {
    background: var(--neutral-400);
    cursor: not-allowed;
}

.cancel-button {
    background: var(--neutral-200);
    color: var(--neutral-700);
}

.cancel-button:hover {
    background: var(--neutral-300);
    transform: translateY(-1px);
}

/* 聊天頭部樣式 */
.chat-header-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-user-details {
    display: flex;
    flex-direction: column;
}

.chat-user-name {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--neutral-900);
    font-family: var(--font-body);
}

.chat-user-status {
    font-size: var(--text-xs);
    color: var(--neutral-600);
    font-family: var(--font-body);
}

.chat-input {
    display: flex;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    background: var(--neutral-100);
    border-radius: var(--radius-lg);
    margin-top: var(--spacing-3);
}

.chat-input textarea {
    flex: 1;
    border: none;
    background: none;
    resize: none;
    padding: var(--spacing-2);
    font-size: var(--text-sm);
    line-height: var(--leading-body);
    min-height: 40px;
    max-height: 100px;
    font-family: var(--font-body);
    color: var(--neutral-900);
}

.chat-input textarea:focus {
    outline: none;
}

.chat-input .send-message {
    background: var(--primary-color);
    color: var(--neutral-50);
    border: none;
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-input .send-message:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .freelix-chat-popup {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-popup-content {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
    }
    
    .chat-popup-header {
        padding: var(--spacing-4);
    }
    
    .chat-popup-form {
        padding: var(--spacing-4);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .submit-button,
    .cancel-button {
        width: 100%;
    }
}

/* 消息狀態樣式 */
.chat-message.pending {
    opacity: 0.7;
}

.chat-message.pending::after,
.chat-message.sent::after,
.chat-message.failed::after,
.chat-message.queued::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    position: absolute;
    bottom: 5px;
    right: 5px;
}

.chat-message.pending::after {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>') no-repeat center center;
    animation: rotating 2s linear infinite;
}

.chat-message.sent::after {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"></path></svg>') no-repeat center center;
}

.chat-message.failed::after {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>') no-repeat center center;
}

.chat-message.queued::after {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 1l4 4-4 4"></path><path d="M3 11V9a4 4 0 014-4h14"></path><path d="M7 23l-4-4 4-4"></path><path d="M21 13v2a4 4 0 01-4 4H3"></path></svg>') no-repeat center center;
}

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

.retry-button {
    position: absolute;
    bottom: -20px;
    right: 0;
    background: var(--error-color);
    color: var(--neutral-50);
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--spacing-1) var(--spacing-2);
    font-size: var(--text-xs);
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-button:hover {
    opacity: 0.9;
    box-shadow: var(--shadow-sm);
} 