/* ============================================
   MsgText — Chat Widget Styles
   Matches main design system (styles.css)
   ============================================ */

/* === Widget Container === */
.webchat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* === Mobile Close Button === */
.webchat-mobile-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 25;
    transition: all .15s;
    padding: 0;
    line-height: 1;
}
.webchat-mobile-close:hover {
    background: rgba(255,255,255,0.3);
}
.webchat-mobile-close:active {
    transform: scale(0.95);
}

/* === Toggle Button === */
.webchat-toggle {
    width: auto;
    min-width: 140px;
    height: 48px;
    background: linear-gradient(135deg, var(--pri), var(--sec));
    border: none;
    border-radius: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shd3);
    transition: all .2s;
    position: relative;
    overflow: hidden;
    padding: 0 18px;
    gap: 8px;
}
.webchat-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left .5s;
}
.webchat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(108,60,225,0.25);
}
.webchat-toggle:hover::before {
    left: 100%;
}
.webchat-toggle:active {
    transform: translateY(-1px);
}
.webchat-toggle i {
    font-size: 16px;
    color: white;
    z-index: 1;
    transition: transform .15s;
}
.webchat-toggle:hover i {
    transform: scale(1.1);
}
.webchat-toggle-text {
    color: white;
    font-weight: 600;
    font-size: .8125rem;
    z-index: 1;
    white-space: nowrap;
}
.webchat-close-text {
    color: white;
    font-weight: 600;
    font-size: .8125rem;
    z-index: 1;
    white-space: nowrap;
}

/* Notification Badge */
.webchat-notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    font-size: .5625rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: var(--shd2);
    animation: wcPulse 2s infinite;
    z-index: 2;
}
@keyframes wcPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* === Chat Box === */
.webchat-box {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: 360px;
    height: 520px;
    background: var(--bg);
    border-radius: var(--r-xl);
    display: none;
    flex-direction: column;
    box-shadow: var(--shd3);
    overflow: hidden;
    animation: wcSlideUp .3s cubic-bezier(.4,0,.2,1);
    border: 1px solid var(--bdr);
}
@keyframes wcSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.webchat-box.webchat-open {
    display: flex;
}

/* === Control Buttons === */
.webchat-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}
.webchat-control-btn {
    visibility: hidden;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    color: white;
    font-size: .75rem;
    pointer-events: auto;
}
.webchat-control-btn:hover {
    background: rgba(255,255,255,0.25);
}
.webchat-connection-status.webchat-online { color: var(--acc); }
.webchat-connection-status.webchat-offline { color: var(--danger); }
.webchat-connection-status.webchat-connecting { color: var(--warn); }

/* === Pre-Chat Form (FIXED: gradient only on welcome, not form bottom) === */
#webchat-pre-chat-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
    position: relative;
    overflow: hidden;
}
.webchat-welcome-section {
    text-align: center;
    padding: 5rem 1.5rem 1.5rem;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--pri) 0%, var(--sec) 100%);
    border-radius: 0 0 24px 24px;
}
.webchat-welcome-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .75rem;
    font-size: 1.375rem;
    color: white;
    animation: wcPulse 2s infinite;
}
.webchat-welcome-title {
    color: white;
    font-weight: 800;
    font-size: 1.125rem;
    margin-bottom: .25rem;
    letter-spacing: -.02em;
}
.webchat-welcome-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: .8125rem;
}
.webchat-form-container {
    background: var(--bg);
    border-radius: 0;
    padding: 1.25rem;
    margin-top: auto;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    flex-shrink: 0;
    flex: 1;
}
.webchat-input-group {
    position: relative;
    margin-bottom: .75rem;
}
.webchat-input-group input {
    width: 100%;
    padding: .6rem .875rem .6rem 2.25rem;
    border: 1.5px solid var(--bdr);
    border-radius: 10px;
    font-size: .8125rem;
    background: var(--bg);
    transition: all .15s;
    font-family: 'Inter', sans-serif;
    color: var(--txt);
}
.webchat-input-group input::placeholder {
    color: var(--txt3);
}
.webchat-input-group input:focus {
    border-color: var(--pri);
    box-shadow: 0 0 0 3px rgba(108,60,225,0.08);
    outline: none;
    background: var(--bg);
}
.webchat-input-group i {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--txt3);
    font-size: .8125rem;
    transition: color .15s;
    z-index: 1;
}
.webchat-input-group input:focus ~ i,
.webchat-input-group input:focus + i {
    color: var(--pri);
}
.webchat-submit-btn {
    width: 100%;
    padding: .6rem 1.375rem;
    background: var(--pri);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: 'Inter', sans-serif;
    margin-top: .25rem;
}
.webchat-submit-btn:hover {
    background: var(--pri-d);
    color: white;
    box-shadow: 0 4px 14px rgba(108,60,225,0.3);
    transform: translateY(-1px);
}
.webchat-submit-btn:active {
    transform: translateY(0);
}
.webchat-submit-btn:disabled {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === Waiting Form === */
#webchat-waiting-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(135deg, var(--pri) 0%, var(--sec) 100%);
    position: relative;
    overflow: hidden;
}
.webchat-waiting-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}
.webchat-waiting-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.375rem;
    color: white;
    animation: wcPulse 2s infinite;
}
.webchat-waiting-text {
    color: white;
    font-size: .9375rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}
.webchat-waiting-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 1rem;
}
.webchat-waiting-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    animation: wcBounce 1.4s infinite ease-in-out both;
}
.webchat-waiting-dot:nth-child(1) { animation-delay: -0.32s; }
.webchat-waiting-dot:nth-child(2) { animation-delay: -0.16s; }
.webchat-waiting-dot:nth-child(3) { animation-delay: 0; }
@keyframes wcBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0; }
    40% { transform: scale(1); opacity: 1; }
}
.webchat-cancel-btn {
    padding: .5rem 1.25rem;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: 'Inter', sans-serif;
}
.webchat-cancel-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* === Ended Form === */
#webchat-ended-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(135deg, var(--acc) 0%, #34D399 100%);
    position: relative;
    overflow: hidden;
}
.webchat-ended-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
    overflow-y: auto;
}
.webchat-ended-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.375rem;
    color: white;
}
.webchat-ended-text {
    color: white;
    font-size: .9375rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.25rem;
}
.webchat-new-chat-btn {
    padding: .6rem 1.5rem;
    background: white;
    color: var(--acc);
    border: none;
    border-radius: 10px;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    box-shadow: var(--shd2);
    font-family: 'Inter', sans-serif;
}
.webchat-new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shd3);
}

/* === Chat Interface === */
.webchat-chat-interface-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.webchat-chat-header {
    background: linear-gradient(135deg, var(--pri) 0%, var(--sec) 100%);
    color: white;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.webchat-agent-info {
    display: flex;
    align-items: center;
    gap: .625rem;
}
.webchat-agent-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
}
.webchat-agent-details {
    display: flex;
    flex-direction: column;
}
.webchat-agent-name {
    font-size: .8125rem;
    font-weight: 600;
}
.webchat-agent-status {
    font-size: .6875rem;
    opacity: .9;
    display: flex;
    align-items: center;
    gap: 4px;
}
.webchat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--acc);
    position: relative;
}
.webchat-status-dot::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: var(--acc);
    opacity: .5;
    animation: wcBubblePulse 2s infinite;
}
@keyframes wcBubblePulse {
    0% { transform: scale(1); opacity: .5; }
    50% { transform: scale(2.5); opacity: 0; }
    100% { transform: scale(1); opacity: .5; }
}
.webchat-toggle.agent-online::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--acc);
    border: 2px solid var(--bg);
    z-index: 3;
}
.webchat-toggle.agent-online {
    position: relative;
}
.webchat-header-buttons {
    display: flex;
    align-items: center;
}
.webchat-chat-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    font-size: .875rem;
    position: relative;
    z-index: 20;
}
.webchat-chat-close:hover {
    background: rgba(255,255,255,0.25);
}

/* === Chat Messages === */
.webchat-chat-messages {
    flex: 1;
    padding: .75rem;
    overflow-y: auto;
    background: var(--bg2);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.webchat-chat-messages::-webkit-scrollbar { width: 4px; }
.webchat-chat-messages::-webkit-scrollbar-track { background: transparent; }
.webchat-chat-messages::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 2px; }

.webchat-message {
    display: flex;
    gap: 6px;
    max-width: 80%;
    transition: opacity .3s ease;
}
.webchat-message.visitor {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.webchat-message.admin {
    align-self: flex-start;
}
.webchat-message.system {
    align-self: center;
    max-width: 90%;
}
.webchat-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pri), var(--sec));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: .6875rem;
    flex-shrink: 0;
}
.webchat-message-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.webchat-message-bubble {
    padding: .5rem .75rem;
    border-radius: var(--r);
    font-size: .8125rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.webchat-message.visitor .webchat-message-bubble {
    background: linear-gradient(135deg, var(--pri), var(--sec));
    color: white;
    border-bottom-right-radius: 4px;
}
.webchat-message.admin .webchat-message-bubble {
    background: var(--bg);
    color: var(--txt);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--bdr);
}
.webchat-message.system .webchat-message-bubble {
    background: var(--bg);
    color: var(--txt3);
    border-radius: 8px;
    font-size: .75rem;
    font-style: italic;
    text-align: center;
    border: 1px solid var(--bdr);
}

/* Message Time */
.webchat-message-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .625rem;
    color: var(--txt3);
    padding: 0 6px;
    line-height: 1;
    white-space: nowrap;
}
.webchat-message.visitor .webchat-message-time {
    justify-content: flex-end;
}

/* Read Receipt */
.webchat-read-status {
    display: inline-flex;
    align-items: center;
    font-size: .625rem;
    line-height: 1;
    letter-spacing: -.5px;
    flex-shrink: 0;
}
.webchat-read-status.check-sent {
    color: rgba(255,255,255,0.5);
}
.webchat-read-status.check-read {
    color: rgba(255,255,255,0.85);
}

/* === Chat Form === */
.webchat-chat-form {
    padding: .75rem;
    background: var(--bg);
    border-top: 1px solid var(--bdr);
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-shrink: 0;
}
.webchat-input-wrapper {
    flex: 1;
    position: relative;
}
.webchat-chat-input {
    width: 100%;
    padding: .5rem .75rem;
    border: 1.5px solid var(--bdr);
    border-radius: 10px;
    font-size: .8125rem;
    background: var(--bg2);
    transition: all .15s;
    outline: none;
    font-family: 'Inter', sans-serif;
    color: var(--txt);
}
.webchat-chat-input::placeholder {
    color: var(--txt3);
}
.webchat-chat-input:focus {
    border-color: var(--pri);
    background: var(--bg);
    box-shadow: 0 0 0 3px rgba(108,60,225,0.08);
}
.webchat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--pri);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    flex-shrink: 0;
    font-size: .8125rem;
}
.webchat-send-btn:hover {
    background: var(--pri-d);
    box-shadow: 0 4px 14px rgba(108,60,225,0.3);
    transform: translateY(-1px);
}
.webchat-send-btn:active {
    transform: translateY(0);
}

/* === Rating Section (inside ended form) === */
.webchat-rating-section {
    width: 100%;
    text-align: center;
    margin: .75rem 0;
}
.webchat-rating-section .webchat-rating-prompt {
    font-size: .8125rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: .5rem;
    font-weight: 600;
}
.webchat-rating-stars-row {
    display: flex;
    justify-content: center;
    gap: .3rem;
    margin-bottom: .375rem;
}
.webchat-rating-stars-row .webchat-rating-star {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: color .15s, transform .15s;
    -webkit-tap-highlight-color: transparent;
}
.webchat-rating-stars-row .webchat-rating-star:hover {
    transform: scale(1.15);
}
.webchat-rating-stars-row .webchat-rating-star.hovered {
    color: var(--warn);
}
.webchat-rating-stars-row .webchat-rating-star.active {
    color: var(--warn);
}
.webchat-rating-label {
    font-size: .75rem;
    color: rgba(255,255,255,0.7);
    min-height: 1.1em;
    margin-bottom: .5rem;
    transition: opacity .2s;
}
.webchat-rating-feedback {
    width: 100%;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    padding: .5rem .625rem;
    font-size: .8125rem;
    resize: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    max-width: 100%;
    background: rgba(255,255,255,0.1);
    color: white;
}
.webchat-rating-feedback::placeholder {
    color: rgba(255,255,255,0.5);
}
.webchat-rating-feedback:focus {
    border-color: var(--warn);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.webchat-submit-rating-btn {
    margin-top: .5rem;
    padding: .45rem 1.25rem;
    background: var(--warn);
    color: var(--txt);
    border: none;
    border-radius: 10px;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-family: 'Inter', sans-serif;
}
.webchat-submit-rating-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245,158,11,0.35);
}
.webchat-submit-rating-btn:active {
    transform: translateY(0);
}
.webchat-rating-thankyou {
    text-align: center;
    padding: .5rem 0;
}
.webchat-rating-thankyou i {
    color: white;
    font-size: 1.25rem;
    margin-bottom: .25rem;
    display: block;
}
.webchat-rating-thankyou p {
    font-size: .8125rem;
    color: rgba(255,255,255,0.9);
    margin: 0;
    font-weight: 600;
}

/* === Confirm Dialog (FIXED: class names match HTML) === */
.webchat-confirm-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--r-xl);
}
.webchat-confirm-overlay.show {
    display: flex;
}
.webchat-confirm-box {
    background: var(--bg);
    border-radius: var(--r-xl);
    padding: 1.5rem;
    max-width: 300px;
    width: 90%;
    box-shadow: var(--shd3);
    text-align: center;
    animation: wcSlideUp .25s ease-out;
    border: 1px solid var(--bdr);
}
.webchat-confirm-box h3 {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--txt);
    margin: 0 0 .5rem;
}
.webchat-confirm-box p {
    font-size: .8125rem;
    color: var(--txt2);
    margin: 0 0 1rem;
    line-height: 1.5;
}
.webchat-confirm-buttons {
    display: flex;
    gap: .5rem;
    justify-content: center;
}
.webchat-confirm-btn {
    padding: .5rem 1.25rem;
    border-radius: 10px;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    border: none;
    font-family: 'Inter', sans-serif;
}
.webchat-confirm-yes {
    background: var(--pri);
    color: white;
}
.webchat-confirm-yes:hover {
    background: var(--pri-d);
    box-shadow: 0 4px 14px rgba(108,60,225,0.3);
}
.webchat-confirm-no {
    background: var(--bg2);
    color: var(--txt);
    border: 1px solid var(--bdr);
}
.webchat-confirm-no:hover {
    background: var(--bdr);
}

/* === Notifications === */
.webchat-notification {
    visibility: hidden;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: .5rem 1rem;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    font-size: .8125rem;
    z-index: 1000;
    width: calc(100% - 1.5rem);
    max-width: 280px;
    animation: wcSlideDown .3s ease;
}
.webchat-success { background: var(--acc); }
.webchat-error { background: var(--danger); }
@keyframes wcSlideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Error message */
.webchat-message-bubble.error-message {
    background: rgba(239,68,68,0.06);
    color: var(--danger);
    border-left: 3px solid var(--danger);
}
.webchat-message.system .webchat-message-avatar i {
    color: white;
}

/* === Offline Message === */
.webchat-offline-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--bg2);
    position: absolute;
    top: 12px; left: 12px; right: 12px; bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--bdr);
    border-radius: var(--r-lg);
    z-index: 1;
}
.webchat-offline-icon {
    font-size: 2.5rem;
    color: var(--txt3);
    margin-bottom: 1rem;
}
.webchat-offline-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .5rem;
    color: var(--txt);
}
.webchat-offline-text {
    font-size: .8125rem;
    color: var(--txt2);
    margin-bottom: 1rem;
    line-height: 1.6;
    max-width: 240px;
}
.webchat-back-time {
    background: var(--bg);
    padding: .625rem 1rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--bdr);
    font-size: .8125rem;
    color: var(--txt2);
    font-weight: 500;
}
.webchat-back-time i {
    color: var(--warn);
    font-size: .875rem;
}

/* === Toggle State Styles === */
.webchat-toggle.is-open .webchat-toggle-text { display: none; }
.webchat-toggle.is-open .fa-comments { display: none; }
.webchat-toggle.is-open .fa-times { display: inline-block; }
.webchat-toggle .webchat-close-text { display: none; }
.webchat-toggle.is-open .webchat-close-text { display: inline-block; margin-left: 4px; }
.webchat-toggle .fa-times { display: none; }

/* Time text */
.webchat-time-text {
    font-size: .625rem;
    color: var(--txt3);
}

/* ============================================================
   RESPONSIVE — TABLET (481px to 768px)
   ============================================================ */
@media (min-width: 481px) and (max-width: 768px) {
    .webchat-widget {
        bottom: 16px;
        right: 16px;
    }
    .webchat-box {
        width: 340px;
        height: 500px;
    }
}

/* ============================================================
   RESPONSIVE — MOBILE FULL SCREEN (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    .webchat-widget {
        bottom: 12px;
        right: 12px;
    }
    .webchat-toggle {
        min-width: auto;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
    }
    .webchat-toggle-text,
    .webchat-close-text {
        display: none !important;
    }
    .webchat-toggle.is-open {
        opacity: 0;
        pointer-events: none;
        transform: scale(.8);
        transition: all .2s ease;
    }
    .webchat-box {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
        border: none;
        animation: wcMobileSlide .3s ease;
        box-shadow: none;
    }
    @keyframes wcMobileSlide {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .webchat-mobile-close {
        display: flex;
    }
    .webchat-chat-header {
        padding: .625rem .75rem;
        padding-top: calc(.625rem + env(safe-area-inset-top, 0px));
    }
    .webchat-chat-header .webchat-mobile-close {
        position: static;
        width: 30px;
        height: 30px;
        font-size: .75rem;
        order: 1;
    }
    .webchat-agent-info {
        flex: 1;
        min-width: 0;
        gap: .5rem;
    }
    .webchat-agent-avatar {
        width: 30px;
        height: 30px;
        font-size: .75rem;
    }
    .webchat-agent-name {
        font-size: .75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .webchat-agent-status { font-size: .625rem; }
    .webchat-chat-close {
        width: 30px;
        height: 30px;
        font-size: .75rem;
        background: rgba(239,68,68,0.2);
        border: 1px solid rgba(239,68,68,0.3);
    }
    .webchat-welcome-section {
        padding: 3rem 1.5rem 1.25rem;
        border-radius: 0 0 20px 20px;
    }
    .webchat-welcome-icon {
        width: 48px;
        height: 48px;
        font-size: 1.125rem;
    }
    .webchat-welcome-title { font-size: 1rem; }
    .webchat-form-container {
        padding: 1.25rem 1rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
        max-height: 60vh;
    }
    .webchat-input-group input {
        padding: .6rem .75rem .6rem 2rem;
        font-size: 16px;
    }
    .webchat-chat-messages { padding: .625rem; }
    .webchat-message { max-width: 85%; }
    .webchat-message-avatar {
        width: 24px;
        height: 24px;
        font-size: .625rem;
    }
    .webchat-message-bubble {
        padding: .5rem .625rem;
        font-size: .8125rem;
    }
    .webchat-chat-form {
        padding: .625rem;
        padding-bottom: calc(.625rem + env(safe-area-inset-bottom, 0px));
    }
    .webchat-chat-input {
        padding: .5rem .75rem;
        font-size: 16px;
    }
    .webchat-send-btn { width: 34px; height: 34px; }
    .webchat-waiting-content,
    .webchat-ended-content {
        padding: 3rem 1.5rem 2rem;
    }
    .webchat-ended-content { overflow-y: auto; }
    .webchat-offline-message {
        top: 0; left: 0; right: 0; bottom: 0;
        border-radius: 0;
        padding: 3rem 1.5rem 2rem;
    }
    .webchat-notification {
        top: calc(12px + env(safe-area-inset-top, 0px));
    }
    .webchat-confirm-overlay {
        border-radius: 0;
    }
    .webchat-confirm-box {
        padding: 1.25rem 1rem;
        border-radius: var(--r-lg);
    }
    .webchat-box[style*="height"] {
        height: 100dvh !important;
    }
}

/* ============================================================
   RESPONSIVE — LANDSCAPE MOBILE
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .webchat-welcome-section {
        padding: .75rem 1.25rem .5rem;
        border-radius: 0 0 16px 16px;
    }
    .webchat-welcome-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-bottom: .375rem;
    }
    .webchat-welcome-title { font-size: .9375rem; }
    .webchat-welcome-subtitle { font-size: .75rem; }
    .webchat-form-container { max-height: 70vh; }
    .webchat-chat-header { padding: .5rem .75rem; }
    .webchat-chat-form { padding: .5rem .75rem; }
}

/* ============================================================
   RESPONSIVE — LARGE DESKTOP (≥ 1920px)
   ============================================================ */
@media (min-width: 1920px) {
    .webchat-widget {
        bottom: 32px;
        right: 40px;
    }
    .webchat-box {
        width: 380px;
        height: 540px;
    }
}