.chatlycare-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.chatlycare-widget-bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatlycare-widget-bottom-left {
    bottom: 20px;
    left: 20px;
}

.chatlycare-widget-button {
    padding: 15px 20px;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.chatlycare-widget-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chatlycare-icon {
    font-size: 20px;
}

.chatlycare-label {
    font-weight: 500;
}

.chatlycare-chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: 90vw;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    overflow: hidden;
}

.chatlycare-active .chatlycare-chat-container {
    display: block;
    animation: chatlycare-slide-up 0.3s ease;
}

@keyframes chatlycare-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatlycare-chat-header {
    background: linear-gradient(135deg, #3a86ff, #6a8eff);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatlycare-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatlycare-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatlycare-chat-body {
    height: 450px;
    /* Ditingkatkan sedikit agar muat dengan field yang lebih besar */
    display: flex;
    flex-direction: column;
}

.chatlycare-welcome-screen {
    padding: 20px !important;
    /* Diperkecil agar lebih compact */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
}

.chatlycare-welcome-screen h4 {
    margin-top: 0;
    margin-bottom: 15px !important;
    /* Diperkecil */
    color: #333;
    text-align: center;
    font-size: 1.1rem !important;
    font-weight: 700;
}

.chatlycare-form-group {
    margin-bottom: 12px !important;
    /* Jarak antar field lebih rapat */
    position: relative;
}

#chatlycare-widget .chatlycare-form-group input,
#chatlycare-widget .chatlycare-form-group select {
    width: 100% !important;
    padding: 12px 16px !important;
    /* Ukuran lebih proposional */
    border: 1px solid #b1bcc7 !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    /* Tidak terlalu besar, tetap terbaca */
    font-weight: 400 !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    background: #fbfbfb !important;
    color: #333 !important;
    height: auto !important;
    line-height: normal !important;
}

#chatlycare-widget .chatlycare-form-group input:focus,
#chatlycare-widget .chatlycare-form-group select:focus {
    outline: none !important;
    border-color: #3a86ff !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.1) !important;
}

.chatlycare-btn {
    background: linear-gradient(135deg, #3a86ff, #6a8eff);
    color: white;
    border: none;
    padding: 12px !important;
    /* Lebih compact */
    border-radius: 8px;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.chatlycare-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(58, 134, 255, 0.3);
}

@media (max-width: 480px) {
    .chatlycare-chat-body {
        height: 480px !important;
        /* Beri sedikit ruang lebih di mobile jika perlu */
    }

    .chatlycare-welcome-screen {
        padding: 15px !important;
    }

    #chatlycare-widget .chatlycare-form-group input,
    #chatlycare-widget .chatlycare-form-group select {
        padding: 10px 14px !important;
        /* Lebih rapat di mobile */
        font-size: 14px !important;
    }

    .chatlycare-form-group {
        margin-bottom: 10px !important;
    }
}

/* Spinner */
.chatlycare-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: chatlycare-spin 0.8s linear infinite;
}

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

.chatlycare-chat-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chatlycare-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chatlycare-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
}

.chatlycare-message-user {
    background: #3a86ff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chatlycare-message-ai {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

#chatlycare-widget .chatlycare-input-container {
    border-top: 1px solid #e9ecef !important;
    padding: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    background: white !important;
}

#chatlycare-widget .chatlycare-message-input {
    width: 100% !important;
    padding: 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    resize: none !important;
    font-size: 15px !important;
    font-family: inherit !important;
    max-height: 120px !important;
    min-height: 60px !important;
    background: #fff !important;
    color: #333 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

#chatlycare-widget .chatlycare-send-btn {
    background: linear-gradient(135deg, #3a86ff, #6a8eff) !important;
    color: white !important;
    border: none !important;
    padding: 12px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
    height: auto !important;
}

.chatlycare-send-btn:hover {
    background: linear-gradient(135deg, #2a76ef, #5a7eef);
}

/* Error Messages */
.chatlycare-error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.chatlycare-form-group input.error,
.chatlycare-form-group select.error {
    border-color: #dc3545;
}

.chatlycare-form-group input.error:focus,
.chatlycare-form-group select.error:focus {
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

/* Alert Messages */
.chatlycare-alert {
    padding: 10px 15px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 14px;
}

.chatlycare-alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.chatlycare-alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* Typing Indicator */
.chatlycare-typing {
    opacity: 0.8;
}

.chatlycare-typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 0;
}

.chatlycare-typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #666;
    border-radius: 50%;
    animation: chatlycare-typing 1.4s infinite ease-in-out;
}

.chatlycare-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.chatlycare-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes chatlycare-typing {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .chatlycare-chat-container {
        width: calc(100vw - 40px);
        right: -20px;
    }

    .chatlycare-widget-bottom-right {
        right: 10px;
        bottom: 10px;
    }

    .chatlycare-widget-bottom-left {
        left: 10px;
        bottom: 10px;
    }
}