/**
 * GoValid Putri Chatbot Widget Styles
 * @version 3.0.0
 */

/* Widget Container */
.govalid-putri-widget {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.govalid-putri-widget.bottom-right {
    bottom: 80px;
    right: 20px;
}

.govalid-putri-widget.bottom-left {
    bottom: 80px;
    left: 20px;
}

/* Toggle Button */
.putri-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4169E1 0%, #2c4ba8 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(65, 105, 225, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.putri-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(65, 105, 225, 0.5);
}

.putri-toggle-btn:active {
    transform: scale(0.95);
}

.putri-icon-close {
    display: none;
}

.govalid-putri-widget.open .putri-icon-chat {
    display: none;
}

.govalid-putri-widget.open .putri-icon-close {
    display: block;
}

/* Unread Badge */
.putri-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* Chat Window */
.putri-chat-window {
    position: absolute;
    bottom: 70px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.bottom-right .putri-chat-window {
    right: 0;
}

.bottom-left .putri-chat-window {
    left: 0;
}

.govalid-putri-widget.open .putri-chat-window {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Header - Royal Blue */
.putri-header {
    background: linear-gradient(135deg, #4169E1 0%, #2c4ba8 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.putri-header h4 {
    color: #fff !important;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.putri-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.putri-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.putri-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.putri-staff-badge {
    position: absolute !important;
    bottom: -2px !important;
    right: -2px !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    background: #fff !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    z-index: 10;
}

.putri-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.putri-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.putri-header-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.putri-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.putri-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
}

.putri-welcome-message {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
}

.putri-welcome-message p {
    margin: 0;
    color: #374151;
    line-height: 1.5;
}

/* Message Bubbles */
.putri-message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.putri-message.user {
    justify-content: flex-end;
}

.putri-message.assistant {
    justify-content: flex-start;
}

.putri-message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.putri-message.user .putri-message-bubble {
    background: linear-gradient(135deg, #4169E1 0%, #2c4ba8 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.putri-message.assistant .putri-message-bubble {
    background: #fff;
    color: #374151;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Typing Indicator */
.putri-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.putri-typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.putri-typing span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Input Area */
.putri-input-area {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.putri-input-form {
    display: flex;
    gap: 12px;
}

.putri-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.putri-input:focus {
    border-color: #4169E1;
}

.putri-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4169E1 0%, #2c4ba8 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.putri-send-btn:hover {
    transform: scale(1.05);
}

.putri-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Powered By */
.putri-powered-by {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 12px;
}

.putri-powered-by a {
    color: #4169E1;
    text-decoration: none;
}

.putri-powered-by a:hover {
    text-decoration: underline;
}

/* Dark Theme */
.theme-dark .putri-chat-window {
    background: #1f2937;
}

.theme-dark .putri-messages {
    background: #111827;
}

.theme-dark .putri-welcome-message {
    background: #374151;
}

.theme-dark .putri-welcome-message p {
    color: #e5e7eb;
}

.theme-dark .putri-message.assistant .putri-message-bubble {
    background: #374151;
    color: #e5e7eb;
}

.theme-dark .putri-input-area {
    background: #1f2937;
    border-color: #374151;
}

.theme-dark .putri-input {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.theme-dark .putri-input::placeholder {
    color: #9ca3af;
}

/* Trigger Button (for shortcode) */
.govalid-putri-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Responsive */
@media (max-width: 480px) {
    .putri-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 80px;
        max-height: 600px;
    }

    .bottom-right .putri-chat-window,
    .bottom-left .putri-chat-window {
        right: 0;
        left: 0;
        margin: 0 auto;
    }

    .govalid-putri-widget.bottom-right,
    .govalid-putri-widget.bottom-left {
        right: 20px;
        left: auto;
    }
}

/* Scrollbar */
.putri-messages::-webkit-scrollbar {
    width: 6px;
}

.putri-messages::-webkit-scrollbar-track {
    background: transparent;
}

.putri-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.putri-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Attachment Button */
/* Attachment Button */
.putri-attach-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 50% !important;
    border: 2px solid #e5e7eb !important;
    background: #fff !important;
    color: #6b7280 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    margin-right: 8px !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.putri-attach-btn:hover {
    background: #4169E1;
    border-color: #4169E1;
    color: #fff;
    transform: scale(1.05);
}

.putri-attach-btn:active {
    transform: scale(0.95);
}

.putri-attach-btn svg {
    pointer-events: none;
}

.theme-dark .putri-attach-btn {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
}

.theme-dark .putri-attach-btn:hover {
    background: #4169E1;
    border-color: #4169E1;
    color: #fff;
}

/* Attachment Preview */
.putri-attachment-preview {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.putri-attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.putri-attachment-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    background: #f3f4f6;
}

.putri-attachment-name {
    flex: 1;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.putri-attachment-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #fee2e2;
    color: #ef4444;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.putri-attachment-remove:hover {
    background: #fecaca;
}

.theme-dark .putri-attachment-preview {
    background: #1f2937;
    border-color: #374151;
}

.theme-dark .putri-attachment-item {
    background: #374151;
    border-color: #4b5563;
}

.theme-dark .putri-attachment-name {
    color: #e5e7eb;
}

/* Message Attachments */
.putri-message-attachment {
    margin-top: 8px;
}

.putri-message-attachment img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
}

.putri-message-attachment .pdf-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff3cd;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
}

.putri-message-attachment .pdf-attachment svg {
    width: 20px;
    height: 20px;
}

/* Upload Progress */
.putri-upload-progress {
    margin-top: 8px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

/* Message Wrapper */
.putri-message-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 85%;
    /* Slightly wider to accommodate content */
    width: fit-content;
    width: -moz-fit-content;
}

.putri-message.user .putri-message-wrapper {
    align-items: flex-end;
}

.putri-message-bubble {
    width: fit-content;
    max-width: 100%;
    /* Use wrapper's max-width */
}

/* Header Actions */
.putri-header-actions {
    display: flex !important;
    align-items: center;
    gap: 4px;
}

/* Feedback Buttons */
.putri-feedback {
    display: flex;
    gap: 6px;
    margin-top: 2px;
    opacity: 0.8;
    transition: opacity 0.2s;
    margin-left: 2px;
}

.putri-message:hover .putri-feedback {
    opacity: 1;
}

.putri-feedback-btn {
    background: none;
    border: none;
    padding: 4px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.putri-feedback-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #4b5563;
}

.putri-feedback-btn.selected {
    color: #4169E1;
    background: rgba(65, 105, 225, 0.1);
}

.putri-feedback.submitted .putri-feedback-btn:not(.selected) {
    display: none;
}

.theme-dark .putri-feedback-btn {
    color: #9ca3af;
}

.theme-dark .putri-feedback-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

/* Close/End Chat Button */
.putri-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.putri-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* End Chat Modal */
.putri-end-modal {
    position: absolute;
    top: 76px;
    /* Below header (16+44+16) */
    left: 0;
    width: 100%;
    height: calc(100% - 76px);
    background: #fff;
    z-index: 20;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.putri-end-content {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.putri-end-content h4 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #1f2937;
}

.putri-rating {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.putri-star-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #d1d5db;
    transition: all 0.2s;
}

.putri-star-btn svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.putri-star-btn.active,
.putri-star-btn:hover,
.putri-star-btn.hover {
    color: #fbbf24;
}

.putri-feedback-text {
    width: 100%;
    height: 60px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 16px;
    background: #f9fafb;
}

.putri-feedback-text:focus {
    outline: none;
    border-color: #4169E1;
    background: #fff;
}

.putri-email-transcript {
    text-align: left;
    margin-bottom: 24px;
    font-size: 14px;
    color: #4b5563;
}

.putri-email-transcript label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 8px;
}

.putri-email-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 8px;
}

.putri-end-actions {
    display: flex;
    gap: 12px;
}

.putri-end-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.putri-btn-cancel {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #4b5563;
}

.putri-btn-cancel:hover {
    background: #e5e7eb;
}

.putri-btn-confirm {
    background: #ef4444;
    border: 1px solid #ef4444;
    color: #fff;
}

.putri-btn-confirm:hover {
    background: #dc2626;
}

.putri-btn-confirm:disabled {
    background: #fca5a5;
    border-color: #fca5a5;
    cursor: not-allowed;
}

.theme-dark .putri-end-modal {
    background: #1f2937;
}

.theme-dark .putri-end-content h4 {
    color: #f9fafb;
}

.theme-dark .putri-star-btn {
    color: #4b5563;
}

.theme-dark .putri-star-btn.active {
    color: #fbbf24;
}

.theme-dark .putri-feedback-text,
.theme-dark .putri-email-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.theme-dark .putri-btn-cancel {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

.theme-dark .putri-email-transcript {
    color: #d1d5db;
}