/* ==========================================================================
   VSTEP FAKE CHAT WIDGET STYLES
   ========================================================================== */

.vstep-chat-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Floating Trigger Button */
.vstep-chat-trigger {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0275d8 0%, #004085 100%);
    color: #ffffff;
    border: none;
    outline: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(2, 117, 216, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    margin-left: auto;
}

.vstep-chat-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 28px rgba(2, 117, 216, 0.5);
}

.vstep-chat-trigger:active {
    transform: scale(0.95);
}

.vstep-chat-trigger-icon,
.vstep-chat-trigger-close {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.vstep-chat-trigger-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.vstep-chat-wrapper.is-open .vstep-chat-trigger-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.vstep-chat-wrapper.is-open .vstep-chat-trigger-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Badge & Pulse Ring */
.vstep-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    height: 20px;
    min-width: 20px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.vstep-chat-wrapper.is-open .vstep-chat-badge {
    opacity: 0;
    transform: scale(0);
}

.vstep-chat-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(2, 117, 216, 0.6);
    animation: vstepPulse 2s infinite;
    pointer-events: none;
}

.vstep-chat-wrapper.is-open .vstep-chat-pulse {
    display: none;
}

@keyframes vstepPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Main Chat Box */
.vstep-chat-box {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease, visibility 0.35s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Open / Closed Animation States */
.vstep-chat-wrapper.is-closed .vstep-chat-box {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.92);
    pointer-events: none;
}

.vstep-chat-wrapper.is-open .vstep-chat-box {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Chat Header */
.vstep-chat-header {
    background: linear-gradient(135deg, #0275d8 0%, #004085 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.vstep-chat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.vstep-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.vstep-chat-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    border: 2px solid #0275d8;
    border-radius: 50%;
}

.vstep-chat-header-info {
    flex-grow: 1;
}

.vstep-chat-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

.vstep-chat-subtitle {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot-live {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.vstep-chat-minimize {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.vstep-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Body */
.vstep-chat-body {
    padding: 18px;
    background: #f8fafc;
    max-height: 420px;
    overflow-y: auto;
}

/* Simulated Message */
.vstep-chat-msg-row {
    margin-bottom: 16px;
}

.vstep-chat-msg-bubble {
    background: #ffffff;
    padding: 12px 14px;
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.vstep-chat-msg-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
}

.vstep-chat-msg-text strong {
    color: #0275d8;
}

.vstep-chat-msg-time {
    display: block;
    margin-top: 5px;
    font-size: 10px;
    color: #94a3b8;
    text-align: right;
}

/* Form Controls */
.vstep-chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vstep-form-group {
    margin: 0;
}

.vstep-form-input,
.vstep-form-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    color: #1e293b;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.vstep-form-input:focus,
.vstep-form-select:focus {
    border-color: #0275d8;
    box-shadow: 0 0 0 3px rgba(2, 117, 216, 0.15);
}

.vstep-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.vstep-chat-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #8b0000 0%, #580000 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(139, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.vstep-chat-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(139, 0, 0, 0.45);
    background: linear-gradient(135deg, #990000 0%, #680000 100%);
}

.vstep-chat-submit-btn:active {
    transform: translateY(0);
}

/* Alert & Success */
.vstep-chat-alert {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.vstep-chat-success {
    text-align: center;
    padding: 20px 10px;
}

.vstep-success-icon {
    margin-bottom: 10px;
}

.vstep-chat-success h5 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    color: #065f46;
}

.vstep-chat-success p {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.4;
}

.vstep-chat-reset-btn {
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.vstep-chat-reset-btn:hover {
    background: #d1d5db;
}

/* Chat Footer (Quick Action Links) */
.vstep-chat-footer {
    padding: 10px 16px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
}

.vstep-chat-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.vstep-chat-action-btn.zalo {
    background: #0088ff;
    color: #ffffff;
}

.vstep-chat-action-btn.phone {
    background: #10b981;
    color: #ffffff;
}

.vstep-chat-action-btn:hover {
    opacity: 0.9;
    color: #ffffff;
    text-decoration: none;
}

/* Responsive Behavior */
@media (min-width: 768px) {
    /* On Desktop, widget starts OPEN by default (unless user clicks to close) */
    .vstep-chat-wrapper:not(.is-closed-user) {

    }
}

@media (max-width: 767px) {
    .vstep-chat-wrapper {
        bottom: 16px;
        right: 16px;
    }
    
    .vstep-chat-box {
        bottom: 68px;
        right: 0;
        width: 320px;
    }
}
