/* Modern Glassmorphic Chatbot CSS */

:root {
    --pse-cb-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --pse-cb-primary-hover: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    --pse-cb-bg: rgba(255, 255, 255, 0.85);
    --pse-cb-border: rgba(226, 232, 240, 0.8);
    --pse-cb-text-dark: #1e293b;
    --pse-cb-text-light: #64748b;
    --pse-cb-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --pse-cb-glass-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.5);
}

/* Floating Bubble */
.pse-chatbot-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: var(--pse-cb-primary);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    z-index: 999999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pse-cb-pulse 2s infinite;
}

.pse-chatbot-bubble:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.6);
}

.pse-chatbot-bubble svg {
    width: 28px;
    height: 28px;
}

.pse-chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* Chat Window Container */
.pse-chatbot-window {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 380px;
    max-width: calc(100vw - 50px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--pse-cb-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--pse-cb-border);
    border-radius: 16px;
    box-shadow: var(--pse-cb-shadow), var(--pse-cb-glass-shadow);
    display: flex;
    flex-direction: column;
    z-index: 999998;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.4s cubic-bezier(0.075, 0.82, 0.165, 1);
    transform-origin: bottom right;
}

.pse-chatbot-window.pse-hidden {
    opacity: 0;
    transform: scale(0.8) translateY(40px);
    pointer-events: none;
}

/* Header */
.pse-chatbot-header {
    background: var(--pse-cb-primary);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
}

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

.pse-chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.pse-chatbot-header-text h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff !important;
}

.pse-chatbot-header-text p {
    margin: 2px 0 0 0;
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #f1f5f9 !important;
}

.pse-online-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
}

.pse-chatbot-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.pse-chatbot-close:hover {
    color: #fff;
}

/* Chat Messages Area */
.pse-chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: rgba(248, 250, 252, 0.4);
}

/* Scrollbars */
.pse-chatbot-messages::-webkit-scrollbar {
    width: 5px;
}
.pse-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.pse-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

/* Message Bubbles */
.pse-cb-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.pse-cb-message.bot {
    align-self: flex-start;
    background: #fff;
    color: var(--pse-cb-text-dark);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.pse-cb-message.user {
    align-self: flex-end;
    background: var(--pse-cb-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
}

/* Quick Replies / Options */
.pse-cb-options-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    align-self: flex-start;
    width: 80%;
}

.pse-cb-option-btn {
    background: #fff;
    border: 1px solid #6366f1;
    color: #4f46e5;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.pse-cb-option-btn:hover {
    background: #4f46e5;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.15);
}

/* Loader / Typing Indicator */
.pse-cb-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 12px;
    align-self: flex-start;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.pse-cb-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: pse-cb-blink 1.4s infinite both;
}

.pse-cb-typing span:nth-child(2) {
    animation-delay: .2s;
}
.pse-cb-typing span:nth-child(3) {
    animation-delay: .4s;
}

/* Form Integrations inside message stack */
.pse-chatbot-form-wrapper {
    align-self: flex-start;
    width: 95%;
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin: 8px 0;
}

.pse-cb-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pse-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pse-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pse-form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--pse-cb-text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
}

.pse-cb-form input[type="text"],
.pse-cb-form input[type="number"],
.pse-cb-form input[type="tel"],
.pse-cb-form input[type="email"],
.pse-cb-form select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--pse-cb-text-dark);
    outline: none;
    transition: border-color 0.2s;
    background: #f8fafc;
    width: 100%;
    box-sizing: border-box;
}

.pse-cb-form input:focus,
.pse-cb-form select:focus {
    border-color: #6366f1;
    background: #fff;
}

/* File Upload dragzone */
.pse-cb-file-drop {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.pse-cb-file-drop:hover, .pse-cb-file-drop.dragover {
    border-color: #6366f1;
    background: #e0e7ff;
}

.pse-cb-drop-icon {
    font-size: 20px;
    color: #64748b;
    display: block;
    margin-bottom: 2px;
}

.pse-cb-drop-text {
    font-size: 11px;
    color: #64748b;
    margin: 0;
}

.pse-cb-file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 8px;
    margin-top: 4px;
}

.pse-cb-file-name {
    font-size: 11px;
    color: #334155;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.pse-cb-file-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Submit Button */
.pse-cb-submit-btn {
    background: var(--pse-cb-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.1);
}

.pse-cb-submit-btn:hover {
    background: var(--pse-cb-primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Footer Input Area */
.pse-chatbot-footer {
    padding: 12px;
    background: #fff;
    border-top: 1px solid var(--pse-cb-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pse-chatbot-footer input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    outline: none;
    color: var(--pse-cb-text-dark);
    transition: all 0.2s;
    background: #f8fafc;
}

.pse-chatbot-footer input:focus {
    border-color: #6366f1;
    background: #fff;
}

.pse-chatbot-send {
    background: var(--pse-cb-primary);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(79, 70, 229, 0.2);
}

.pse-chatbot-send:hover {
    background: var(--pse-cb-primary-hover);
    transform: scale(1.05);
}

.pse-chatbot-send svg {
    width: 16px;
    height: 16px;
    margin-right: -2px; /* visual center balance */
}

/* Result Tables / Cards for Bot response */
.pse-cb-status-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    margin-top: 6px;
}

.pse-cb-status-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
}

.pse-cb-status-row:last-child {
    border-bottom: none;
}

.pse-cb-status-label {
    font-weight: 600;
    color: var(--pse-cb-text-light);
}

.pse-cb-status-val {
    color: var(--pse-cb-text-dark);
}

/* Badges for Job Status */
.pse-status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.pse-status-badge.pending { background: #fef3c7; color: #d97706; }
.pse-status-badge.estimate { background: #ffe8cc; color: #ea580c; }
.pse-status-badge.printing { background: #e0f2fe; color: #0284c7; }
.pse-status-badge.lamination { background: #f3e8ff; color: #7c3aed; }
.pse-status-badge.cutting { background: #ffe4e6; color: #e11d48; }
.pse-status-badge.completed { background: #d1fae5; color: #059669; }
.pse-status-badge.paid { background: #d1fae5; color: #059669; }
.pse-status-badge.unpaid { background: #fee2e2; color: #dc2626; }

/* General utility */
.pse-hidden {
    display: none !important;
}

/* Animations */
@keyframes pse-cb-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

@keyframes pse-cb-blink {
    0% {
        opacity: .2;
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: .2;
    }
}
