/* ===== Support Widget - Compact Design ===== */
.support-widget {
    position: fixed;
    bottom: 80px;
    right: 25px;
    z-index: 9999;
    font-family: inherit;
}

/* Main Toggle Button */
.support-widget__toggle {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.support-widget__toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.support-widget__toggle i {
    font-size: 22px;
    color: #fff;
    transition: transform 0.3s ease;
}

.support-widget.active .support-widget__toggle i {
    transform: rotate(45deg);
}

/* Pulse Animation */
.support-widget__toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: pulse-ring 1.5s ease-out infinite;
    z-index: -1;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.support-widget.active .support-widget__toggle::before {
    animation: none;
}

/* Contact Menu - Compact Horizontal */
.support-widget__menu {
    position: absolute;
    bottom: 65px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px) scale(0.9);
    transition: all 0.25s ease;
}

.support-widget.active .support-widget__menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.support-widget__item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    text-decoration: none;
    animation: fadeInUp 0.2s ease forwards;
    opacity: 0;
}

.support-widget.active .support-widget__item:nth-child(1) {
    animation-delay: 0.05s;
}

.support-widget.active .support-widget__item:nth-child(2) {
    animation-delay: 0.1s;
}

.support-widget.active .support-widget__item:nth-child(3) {
    animation-delay: 0.15s;
}

.support-widget.active .support-widget__item:nth-child(4) {
    animation-delay: 0.2s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Compact Icons */
.support-widget__icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.support-widget__icon:hover {
    transform: scale(1.12);
}

.support-widget__icon--phone {
    background: linear-gradient(135deg, #00c853, #00e676);
}

.support-widget__icon--facebook {
    background: linear-gradient(135deg, #1877f2, #42a5f5);
}

.support-widget__icon--zalo {
    background: linear-gradient(135deg, #0068ff, #00a3ff);
}

.support-widget__icon--chat {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* Tooltip Labels */
.support-widget__label {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(8px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.support-widget__item:hover .support-widget__label {
    opacity: 1;
    transform: translateX(0);
}

/* Chat Box - Compact */
.support-widget__chatbox {
    position: fixed;
    bottom: 150px;
    right: 25px;
    width: 340px;
    max-height: 450px;
    background: rgba(25, 25, 40, 0.97);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    animation: slideInUp 0.25s ease;
}

.support-widget__chatbox.active {
    display: flex;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header - Compact */
.chatbox__header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbox__header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbox__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.chatbox__name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.chatbox__status {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbox__status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #00e676;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    50%,
    100% {
        opacity: 1;
    }

    25%,
    75% {
        opacity: 0.4;
    }
}

.chatbox__close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s ease;
    padding: 5px;
}

.chatbox__close:hover {
    opacity: 1;
}

/* Chat Messages */
.chatbox__messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 250px;
}

.chatbox__messages::-webkit-scrollbar {
    width: 4px;
}

.chatbox__messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.chatbox__messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.chat-message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-message--user {
    align-self: flex-end;
}

.chat-message--ai {
    align-self: flex-start;
}

.chat-message__content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
}

.chat-message--user .chat-message__content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message--ai .chat-message__content {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.chat-message__time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
    padding: 0 4px;
}

.chat-message--user .chat-message__time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

/* Chat Input */
.chatbox__input-area {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbox__input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 10px 16px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.chatbox__input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chatbox__input:focus {
    border-color: rgba(102, 126, 234, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.chatbox__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbox__send:hover {
    transform: scale(1.08);
}

.chatbox__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 480px) {
    .support-widget {
        bottom: 85px;
        /* Increased to avoid bottom nav overlap */
        right: 15px;
    }

    .support-widget__chatbox {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 155px;
        /* Adjusted for new widget position */
        max-height: 60vh;
        /* Reduced from 65vh for better fit */
    }

    .support-widget__toggle {
        width: 50px;
        height: 50px;
    }

    .support-widget__icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .support-widget__label {
        display: none;
    }

    /* Make sure menu doesn't overflow */
    .support-widget__menu {
        bottom: 60px;
    }
}

/* ===== Live Support Chat - Admin/member queue addon ===== */
.support-widget__toggle {
    width: auto;
    min-width: 138px;
    height: 54px;
    border-radius: 999px;
    gap: 10px;
    padding: 0 18px;
    background: linear-gradient(135deg, #ff4b4b 0%, #ef4444 100%);
    box-shadow: 0 12px 30px rgba(239, 68, 68, .35);
}

.support-widget__toggle::before {
    background: linear-gradient(135deg, #ff4b4b 0%, #ef4444 100%);
}

.support-widget__toggle-text {
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
}

.support-widget__icon--live {
    background: linear-gradient(135deg, #ff4b4b 0%, #ef4444 100%);
}

.support-widget__chatbox--live {
    width: 390px;
    max-height: 640px;
    bottom: 145px;
    background: #ffffff;
    border: none;
    border-radius: 22px;
    color: #172033;
    box-shadow: 0 22px 60px rgba(15, 23, 42, .28);
}

.live-chat__header {
    background: #111827;
    padding: 16px 18px;
}

.live-chat__avatar {
    background: rgba(255, 255, 255, .14);
}

.live-chat__status::before {
    background: #facc15;
}

.live-chat__messages {
    min-height: 250px;
    max-height: 300px;
    background: #eef3ff;
    padding: 18px 16px;
}

.support-widget__chatbox--live .chat-message {
    max-width: 88%;
}

.support-widget__chatbox--live .chat-message__content {
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.chat-message--admin,
.chat-message--system {
    align-self: flex-start;
}

.support-widget__chatbox--live .chat-message--user .chat-message__content {
    background: linear-gradient(135deg, #3478f6 0%, #2563eb 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.support-widget__chatbox--live .chat-message--admin .chat-message__content {
    background: #fff;
    color: #172033;
    border-bottom-left-radius: 6px;
}

.support-widget__chatbox--live .chat-message--system {
    align-self: center;
    max-width: 94%;
}

.support-widget__chatbox--live .chat-message--system .chat-message__content {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    box-shadow: none;
    text-align: center;
}

.support-widget__chatbox--live .chat-message__time {
    color: #718096;
    font-weight: 700;
}

.live-chat__profile,
.live-chat__input-area {
    padding: 14px 16px 0;
    background: #fff;
}

.live-chat__profile label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
}

.live-chat__profile input,
.live-chat__input-area textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 14px;
    color: #172033;
    outline: none;
    font-size: 14px;
    font-weight: 700;
    transition: all .2s ease;
}

.live-chat__profile input {
    min-height: 42px;
    padding: 0 14px;
}

.live-chat__profile input[readonly] {
    background: #f8fafc;
    color: #64748b;
}

.live-chat__input-area textarea {
    min-height: 92px;
    resize: none;
    padding: 14px;
}

.live-chat__profile input:focus,
.live-chat__input-area textarea:focus {
    border-color: #3478f6;
    box-shadow: 0 0 0 3px rgba(52, 120, 246, .14);
}

.live-chat__input-area textarea::placeholder,
.live-chat__profile input::placeholder {
    color: #94a3b8;
}

.live-chat__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0 16px;
}

.live-chat__queue {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.live-chat__send {
    min-width: 120px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff4b4b 0%, #ef4444 100%);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(239, 68, 68, .26);
    transition: all .2s ease;
}

.live-chat__send:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(239, 68, 68, .34);
}

.live-chat__send:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 480px) {
    .support-widget__toggle {
        min-width: 136px;
        height: 52px;
        padding: 0 16px;
    }

    .support-widget__toggle i {
        font-size: 18px;
    }

    .support-widget__toggle-text {
        font-size: 13px;
    }

    .support-widget__chatbox--live {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 150px;
        max-height: 72vh;
        border-radius: 20px;
    }

    .live-chat__messages {
        min-height: 210px;
        max-height: 245px;
    }

    .live-chat__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .live-chat__send {
        width: 100%;
    }
}

/* ===== Live Support Chat v41 - image upload + clearer UI ===== */
.support-widget__chatbox--live {
    width: 410px;
    max-height: 680px;
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .34);
}

.live-chat__messages {
    min-height: 280px;
    max-height: 330px;
    background: linear-gradient(180deg, #eef4ff 0%, #e8efff 100%);
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.support-widget__chatbox--live .chat-message__content {
    color: #172033;
    line-height: 1.45;
    word-break: break-word;
}

.support-widget__chatbox--live .chat-message__text {
    white-space: pre-wrap;
}

.support-widget__chatbox--live .chat-message--user .chat-message__content {
    background: linear-gradient(135deg, #3478f6 0%, #2563eb 100%);
    color: #fff;
}

.support-widget__chatbox--live .chat-message--admin .chat-message__content {
    background: #fff;
    color: #172033;
    border: 1px solid #dbe3ef;
}

.chat-message__image-link {
    display: block;
    margin-top: 8px;
}

.chat-message__text + .chat-message__image-link {
    margin-top: 10px;
}

.chat-message__image {
    display: block;
    max-width: 220px;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid rgba(15, 23, 42, .1);
    background: #fff;
}

.chat-message--user .chat-message__image {
    border-color: rgba(255, 255, 255, .42);
}

.chat-message__file {
    display: inline-flex;
    margin-top: 8px;
    color: inherit;
    font-weight: 800;
    text-decoration: underline;
}

.live-chat__attach-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.live-chat__attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    margin: 0;
    transition: all .2s ease;
}

.live-chat__attach-btn:hover {
    background: #dbeafe;
    transform: translateY(-1px);
}

.live-chat__clear-image {
    height: 30px;
    border: none;
    border-radius: 999px;
    padding: 0 10px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.live-chat__image-name {
    min-width: 0;
    flex: 1;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .support-widget__chatbox--live {
        max-height: 78vh;
    }

    .live-chat__messages {
        min-height: 220px;
        max-height: 290px;
    }

    .chat-message__image {
        max-width: 190px;
        max-height: 160px;
    }
}

/* ===== Live Support Chat v42 - account required before direct support ===== */
.live-chat__login-required {
    min-height: 250px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 24px 18px;
    color: #172033;
}

.live-chat__login-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
    font-size: 24px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .18);
}

.live-chat__login-title {
    color: #0f172a;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.35;
}

.live-chat__login-desc {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    max-width: 310px;
}

.live-chat__login-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.live-chat__login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 40px;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    transition: all .2s ease;
}

.live-chat__login-btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.live-chat__login-btn--login {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .22);
}

.live-chat__login-btn--login:hover {
    color: #fff;
    box-shadow: 0 14px 28px rgba(37, 99, 235, .30);
}

.live-chat__login-btn--register {
    background: #fff;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.live-chat__login-btn--register:hover {
    color: #dc2626;
    background: #fff5f5;
}

.live-chat__guest-footer {
    background: #fff;
    padding: 14px 16px 16px;
    border-top: 1px solid #e2e8f0;
}

@media (max-width: 480px) {
    .live-chat__login-required {
        min-height: 220px;
        padding: 22px 14px;
    }

    .live-chat__login-actions {
        flex-direction: column;
    }

    .live-chat__login-btn {
        width: 100%;
    }
}

/* v45: keep the public support launcher in the same navy/blue palette as the
   storefront. Override both the button and pulse layer so two old gradients
   can no longer overlap into a red/blue pill. */
.support-widget .support-widget__toggle {
    background: linear-gradient(135deg, #0b2340 0%, #174f84 100%) !important;
    border: 2px solid #3b82f6 !important;
    color: #ffffff !important;
    box-shadow: 0 12px 28px rgba(2, 12, 28, .42), 0 0 0 3px rgba(59, 130, 246, .12) !important;
}

.support-widget .support-widget__toggle::before {
    background: linear-gradient(135deg, #0b2340 0%, #174f84 100%) !important;
}

.support-widget .support-widget__toggle i,
.support-widget .support-widget__toggle-text {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.support-widget .support-widget__toggle:hover {
    box-shadow: 0 15px 34px rgba(2, 12, 28, .52), 0 0 22px rgba(59, 130, 246, .28) !important;
}
