/* Reset & Base Layout */
.support-widget {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 99999;
    width: min(360px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    font-family: 'Space Grotesk', 'Manrope', 'Inter', sans-serif;
    color: #eff8ff;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
}

.support-widget * {
    box-sizing: border-box;
}

/* Teaser (Welcome Notification Pop) */
.support-teaser {
    position: absolute;
    right: 0px;
    bottom: 84px;
    width: min(290px, calc(100vw - 40px));
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(217,163,79,0.22);
    background: linear-gradient(180deg, rgba(9,12,18,0.96), rgba(5,7,10,0.985));
    box-shadow: 0 16px 32px rgba(0,0,0,0.6), 0 0 20px rgba(217,163,79,0.08);
    backdrop-filter: blur(16px);
    opacity: 0;
    transform: translateY(10px) scale(.97);
    pointer-events: none;
    transition: opacity .24s ease, transform .24s ease;
}

.support-widget.teaser-visible .support-teaser {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.support-teaser::after {
    content: "";
    position: absolute;
    right: 34px;
    bottom: -7px;
    width: 12px;
    height: 12px;
    border-right: 1px solid rgba(217,163,79,0.22);
    border-bottom: 1px solid rgba(217,163,79,0.22);
    background: rgba(5,7,10,0.985);
    transform: rotate(45deg);
}

.support-teaser-orb {
    position: relative;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, rgba(217,163,79,0.9) 0 18%, rgba(83,34,14,0.28) 19% 52%, rgba(12,7,5,0.96) 53% 100%);
    border: 1px solid rgba(217,163,79,0.3);
    box-shadow: 0 0 0 4px rgba(5,7,10,0.34), 0 0 15px rgba(217,163,79,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f3c47a;
    font-weight: 900;
    font-size: 13px;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.support-teaser-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.support-teaser-copy strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #f3c47a;
}

.support-teaser-copy p {
    margin: 0;
    color: rgba(255,255,255,0.60);
    font-size: 11px;
    line-height: 1.45;
    font-weight: 600;
}

.support-teaser-close {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.04);
    font-size: 10px;
    transition: transform .2s ease, color .2s ease, background .2s ease;
}

.support-teaser-close:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
    transform: rotate(90deg);
}

/* Support Launcher Button (Mascot Button) */
.support-launcher {
    position: relative;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    width: 70px !important;
    height: 105px !important;
    min-width: 70px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    cursor: pointer;
    overflow: visible;
    isolation: isolate;
    color: #f3fbff;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: transform .24s ease, opacity .24s ease;
}

.support-launcher:hover {
    transform: scale(1.05);
}

.support-launcher-icon {
    position: relative;
    flex: 0 0 70px;
    width: 70px;
    height: 105px;
    border-radius: 0 !important;
    display: block;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: bottom center !important;
    transform: scaleX(-1) scale(1.15); /* Flips mascot horizontally to face left and applies scale */
    transition: transform 0.24s ease;
    animation: supportRgbGlow 8s infinite linear;
}

/* Hide default indicators/dots that cover the rabbit mascot */
.support-launcher-icon::before {
    display: none !important;
}

.support-launcher-icon::after {
    display: none !important;
}

.support-launcher-copy {
    display: none !important;
}

.support-launcher-badge {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ff4a4a;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    box-shadow: 0 3px 8px rgba(220,38,38,0.5);
    z-index: 20;
    animation: supportBounce 2s infinite;
}

.support-widget.has-unread .support-launcher-badge {
    display: inline-flex;
}

/* Support Panel Header & Shell */
.support-panel {
    position: absolute;
    right: 0;
    bottom: 84px;
    width: min(360px, calc(100vw - 28px));
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(217,163,79,0.18);
    background: linear-gradient(180deg, rgba(9,12,18,0.985), rgba(5,7,10,0.992));
    box-shadow: 0 15px 35px rgba(0,0,0,0.7), 0 0 20px rgba(217,163,79,0.06);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(12px) scale(.98);
    pointer-events: none;
    transition: opacity .26s ease, transform .26s ease;
}

.support-widget.open .support-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.support-panel-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(217,163,79,0.14);
}

.support-panel-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.support-panel-avatar {
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(217,163,79,0.3);
    box-shadow: 0 0 10px rgba(217,163,79,0.15);
}

/* Hide dot in avatar since we use custom mascot */
.support-panel-avatar::before {
    display: none !important;
}

.support-panel-heading {
    min-width: 0;
}

.support-panel-heading strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .01em;
    color: #ffffff;
}

.support-panel-heading p {
    margin: 0;
    color: #f3c47a;
    font-size: 10px;
    font-weight: 700;
}

.support-panel-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    background: transparent;
    font-size: 11px;
    transition: transform .2s ease, color .2s ease, background .2s ease;
}

.support-panel-close:hover {
    transform: rotate(90deg);
    color: #ffffff;
    background: rgba(255,255,255,0.04);
}

.support-panel-body {
    position: relative;
    padding: 12px;
}

.support-stage {
    display: none;
}

.support-stage.active {
    display: block;
}

/* Welcome Box & Form */
.support-welcome {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(22,19,13,0.82), rgba(12,10,7,0.84));
    border: 1px solid rgba(217,163,79,0.14);
}

.support-welcome strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 800;
    color: #f3c47a;
}

.support-welcome p {
    margin: 0;
    color: rgba(255,255,255,0.6);
    font-size: 11px;
    line-height: 1.45;
    font-weight: 600;
}

.support-form {
    display: grid;
    gap: 8px;
}

.support-input,
.support-composer textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    color: #fff4eb;
    background: rgba(10,12,18,0.9);
    border: 1px solid rgba(217,163,79,0.15);
    font: 700 11px 'Manrope', 'Space Grotesk', sans-serif;
    outline: none;
    transition: border-color .22s ease, box-shadow .22s ease;
}

.support-input::placeholder,
.support-composer textarea::placeholder {
    color: rgba(255,255,255,0.25);
}

.support-input:focus,
.support-composer textarea:focus {
    border-color: #d9a34f;
    box-shadow: 0 0 0 3px rgba(217,163,79,0.1);
}

/* Buttons & Interactions */
.support-submit,
.support-send {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: #000000;
    font: 800 11px 'Manrope', sans-serif;
    background: linear-gradient(180deg, #d9a34f, #b58238);
    border: 1px solid rgba(243,196,122,0.26);
    box-shadow: 0 8px 14px rgba(0,0,0,0.3), 0 0 10px rgba(217,163,79,0.1);
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.05em;
    transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}

.support-submit:hover,
.support-send:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow: 0 10px 16px rgba(0,0,0,0.35), 0 0 12px rgba(217,163,79,0.2);
}

.support-error {
    min-height: 14px;
    margin-top: 1px;
    color: #ffb8b8;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 700;
}

/* Chat Messages Thread */
.support-thread-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.support-thread-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(217,163,79,0.1);
    border: 1px solid rgba(217,163,79,0.2);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    color: #f3c47a;
    text-transform: uppercase;
}

.support-thread-chip::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #43f2a5;
    box-shadow: 0 0 6px #43f2a5;
}

.support-thread-sub {
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    font-weight: 700;
}

.support-thread {
    max-height: 280px;
    min-height: 180px;
    margin-bottom: 10px;
    padding-right: 3px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.support-thread::-webkit-scrollbar {
    width: 4px;
}

.support-thread::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(217,163,79,0.15);
}

.support-empty {
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(22,19,13,0.5), rgba(10,12,18,0.5));
    border: 1px solid rgba(217,163,79,0.1);
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

/* Bubble Styles */
.support-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
}

.support-message.admin {
    align-self: flex-start;
}

.support-message.visitor {
    align-self: flex-end;
}

.support-message-bubble {
    padding: 8px 11px;
    border-radius: 12px;
    font-size: 11.5px;
    line-height: 1.45;
    font-weight: 600;
    word-break: break-word;
}

.support-message.admin .support-message-bubble {
    border-radius: 12px 12px 12px 3px;
    background: linear-gradient(180deg, rgba(22,19,13,0.9), rgba(10,12,18,0.95));
    border: 1px solid rgba(217,163,79,0.15);
    color: #eaf8ff;
}

.support-message.visitor .support-message-bubble {
    border-radius: 12px 12px 3px 12px;
    background: linear-gradient(180deg, #d9a34f, #b58238);
    border: 1px solid rgba(243,196,122,0.2);
    color: #000000;
    font-weight: 700;
}

.support-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.3);
    font-size: 9px;
    font-weight: 700;
}

.support-message.visitor .support-meta {
    justify-content: flex-end;
}

/* Chat Input Composer */
.support-composer {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    align-items: center;
}

.support-composer textarea {
    min-height: 40px;
    max-height: 120px;
    resize: none;
    margin: 0;
}

.support-send {
    width: auto;
    min-width: 70px;
    min-height: 40px;
    padding: 0;
}

.support-chat-note {
    margin-top: 6px;
    color: rgba(255,255,255,0.3);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
}

.support-chat-note strong {
    color: #f3c47a;
}

.support-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9a34f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 32px !important;
    cursor: pointer;
}

.support-select option {
    background-color: #090c12 !important;
    color: #fff4eb !important;
    font-family: 'Space Grotesk', 'Manrope', sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 10px 12px !important;
}

/* Animations */
@keyframes supportBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes supportPulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@keyframes supportRgbGlow {
    0% {
        filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.75)) drop-shadow(0 0 10px rgba(255, 0, 0, 0.4));
    }
    17% {
        filter: drop-shadow(0 0 4px rgba(255, 127, 0, 0.75)) drop-shadow(0 0 10px rgba(255, 127, 0, 0.4));
    }
    33% {
        filter: drop-shadow(0 0 4px rgba(255, 255, 0, 0.75)) drop-shadow(0 0 10px rgba(255, 255, 0, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 4px rgba(0, 255, 0, 0.75)) drop-shadow(0 0 10px rgba(0, 255, 0, 0.4));
    }
    67% {
        filter: drop-shadow(0 0 4px rgba(0, 0, 255, 0.75)) drop-shadow(0 0 10px rgba(0, 0, 255, 0.4));
    }
    83% {
        filter: drop-shadow(0 0 4px rgba(139, 0, 255, 0.75)) drop-shadow(0 0 10px rgba(139, 0, 255, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.75)) drop-shadow(0 0 10px rgba(255, 0, 0, 0.4));
    }
}

/* Mobile Responsive */
@media(max-width: 720px) {
    .support-widget {
        right: 14px;
        bottom: 14px;
        width: min(340px, calc(100vw - 28px));
    }
    .support-teaser {
        right: 0;
        width: min(100%, calc(100vw - 24px));
        bottom: 76px;
    }
    .support-panel {
        width: min(100%, calc(100vw - 24px));
        bottom: 84px;
    }
}
