/* Chat Support Widget Styles */

/* Hide chat widget when body has no-chat class */
body.no-chat .chat-widget {
    display: none !important;
}

.chat-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    font-family: 'Montserrat', sans-serif;
}

.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.chat-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.chat-header .avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header .avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chat-header .info {
    flex: 1;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header .info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.85;
}

.chat-history-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.chat-history-link:hover {
    background: rgba(255, 255, 255, 0.28);
    color: white;
    transform: translateY(-1px);
}

.chat-history-link i {
    font-size: 12px;
}

.chat-header .close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chat-header .close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-header .close-chat svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    align-self: flex-start;
}

.message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.message .sender-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
    opacity: 0.8;
}

.message .message-text {
    white-space: pre-line;
}

.support-downpayment-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-downpayment-title {
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
}

.support-downpayment-amount {
    font-size: 14px;
    font-weight: 700;
    color: #0f5132;
}

.support-downpayment-copy {
    margin: 0;
    color: #374151;
    white-space: pre-line;
}

.support-downpayment-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.support-downpayment-status.pending {
    background: #fff3cd;
    color: #8a6d3b;
}

.support-downpayment-status.paid {
    background: #d1e7dd;
    color: #0f5132;
}

.support-downpayment-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1f7a4c 0%, #2fb36c 100%);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(31, 122, 76, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-downpayment-button:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(31, 122, 76, 0.24);
}

.message .time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
}

.typing-indicator {
    display: none;
    padding: 0 20px 12px;
}

.typing-indicator.active {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.chat-payment-action {
    padding: 0 16px 12px;
}

.chat-payment-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1f7a4c 0%, #2fb36c 100%);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(31, 122, 76, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-payment-link:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(31, 122, 76, 0.24);
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

.chat-input {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #eee;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: 'Montserrat', sans-serif;
}

.chat-input input:focus {
    border-color: #667eea;
}

.chat-input button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-input button:hover:not(:disabled) {
    transform: scale(1.05);
}

.chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-input button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 10px;
        left: 10px;
    }
    
    .chat-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 70px;
    }

    .chat-history-link span {
        display: none;
    }

    .chat-history-link {
        padding: 8px 10px;
    }
}
