/* =========================================================
   ADMITH LEGACY — SMART SUPPORT WIDGET
   File: css/components/support.css

   PURPOSE:
   - Floating support button
   - Multi-view support panel
   - AI assistant
   - Human support
   - WhatsApp handoff
   - Leave a Message form
   - Responsive behavior
   - Accessibility
   - Reduced motion

   IMPORTANT:
   This stylesheet is fully scoped to .support-widget.
========================================================= */


/* =========================================================
   01. ROOT WIDGET
========================================================= */

.support-widget {

    --support-green: #5bb780;
    --support-green-dark: #3f9566;
    --support-green-soft: rgba(91, 183, 128, 0.10);

    --support-black: #111111;
    --support-text: #383838;
    --support-muted: #707070;

    --support-border: rgba(17, 17, 17, 0.10);

    --support-shadow:
        0 24px 70px rgba(0, 0, 0, 0.18);

    position: fixed;

    right: 28px;
    bottom: 28px;

    width: auto;
    max-width: calc(100vw - 32px);

    z-index: 9999;

    font-family:
        "Manrope",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

}


/* =========================================================
   02. FLOATING SUPPORT BUTTON
========================================================= */

.support-widget-toggle {

    position: relative;

    width: 62px;
    height: 62px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    border-radius: 50%;

    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            var(--support-green),
            var(--support-green-dark)
        );

    box-shadow:
        0 12px 35px
        rgba(63, 149, 102, 0.35);

    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;

    transition:
        transform 300ms ease,
        box-shadow 300ms ease;

}


.support-widget-toggle:hover {

    transform:
        translateY(-4px)
        scale(1.04);

    box-shadow:
        0 18px 45px
        rgba(63, 149, 102, 0.45);

}


.support-widget-toggle:active {

    transform:
        translateY(-1px)
        scale(0.98);

}


.support-widget-toggle:focus-visible {

    outline:
        3px solid
        rgba(91, 183, 128, 0.35);

    outline-offset: 5px;

}


/* =========================================================
   03. TOGGLE ICONS
========================================================= */

.support-widget-icon {

    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    pointer-events: none;

    transition:
        opacity 250ms ease,
        transform 250ms ease;

}


.support-widget-icon-chat {

    opacity: 1;

    transform:
        rotate(0deg)
        scale(1);

}


.support-widget-icon-chat svg {

    width: 27px;
    height: 27px;

    display: block;

}


.support-widget-icon-close {

    color: #ffffff;

    font-size: 34px;
    font-weight: 300;

    line-height: 1;

    opacity: 0;

    transform:
        rotate(-45deg)
        scale(0.6);

}


/* =========================================================
   04. OPEN TOGGLE STATE
========================================================= */

.support-widget.is-open
.support-widget-icon-chat {

    opacity: 0;

    transform:
        rotate(45deg)
        scale(0.6);

}


.support-widget.is-open
.support-widget-icon-close {

    opacity: 1;

    transform:
        rotate(0deg)
        scale(1);

}


/* =========================================================
   05. STATUS DOT
========================================================= */

.support-widget-status-dot {

    position: absolute;

    top: 3px;
    right: 3px;

    width: 12px;
    height: 12px;

    border:
        3px solid
        #ffffff;

    border-radius: 50%;

    background:
        var(--support-green);

    box-sizing: border-box;

}


/* =========================================================
   06. SUPPORT PANEL
========================================================= */

.support-widget-panel {

    position: absolute;

    right: 0;

    bottom: 78px;

    width: 390px;

    max-width:
        calc(100vw - 40px);

    /*
       IMPORTANT:
       The panel now has a controlled maximum height
       instead of forcing every view to occupy a fixed
       680px canvas.
    */

    height:
        min(
            620px,
            calc(100vh - 120px)
        );

    min-height: 0;

    display: flex;

    flex-direction: column;

    overflow: hidden;

    border:
        1px solid
        rgba(255, 255, 255, 0.7);

    border-radius: 24px;

    background:
        #ffffff;

    box-shadow:
        var(--support-shadow);

    opacity: 0;

    visibility: hidden;

    transform:
        translateY(18px)
        scale(0.96);

    transform-origin:
        bottom right;

    pointer-events: none;

    transition:
        opacity 250ms ease,
        visibility 250ms ease,
        transform 300ms cubic-bezier(
            0.16,
            1,
            0.3,
            1
        );

}


/* =========================================================
   07. OPEN PANEL
========================================================= */

.support-widget.is-open
.support-widget-panel {

    opacity: 1;

    visibility: visible;

    transform:
        translateY(0)
        scale(1);

    pointer-events: auto;

}


/* =========================================================
   08. PANEL HEADER
========================================================= */

.support-widget-header {

    position: relative;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 16px;

    flex:
        0 0
        auto;

    padding:
        18px
        20px;

    color:
        #ffffff;

    background:
        linear-gradient(
            135deg,
            #111111,
            #252525
        );

}


/* =========================================================
   09. HEADER BRAND
========================================================= */

.support-widget-header-brand {

    display: flex;

    align-items: center;

    gap: 12px;

    min-width: 0;

}


/* =========================================================
   10. SUPPORT AVATAR
========================================================= */

.support-widget-avatar {

    width: 42px;
    height: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 14px;

    color:
        #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--support-green),
            var(--support-green-dark)
        );

    font-size:
        0.75rem;

    font-weight:
        800;

}


/* =========================================================
   11. HEADER TEXT
========================================================= */

.support-widget-header-text {

    display: flex;

    flex-direction: column;

    gap: 5px;

    min-width: 0;

}


.support-widget-header-text strong {

    color:
        #ffffff;

    font-size:
        0.9rem;

    font-weight:
        700;

    line-height:
        1.2;

}


/* =========================================================
   12. AVAILABILITY
========================================================= */

.support-widget-availability {

    display: flex;

    align-items: center;

    gap: 7px;

    color:
        rgba(255, 255, 255, 0.65);

    font-size:
        0.7rem;

    line-height:
        1.3;

}


.support-status-indicator {

    width: 7px;
    height: 7px;

    flex-shrink: 0;

    border-radius: 50%;

    background:
        var(--support-green);

    box-shadow:
        0 0 0 4px
        rgba(91, 183, 128, 0.12);

}


/* =========================================================
   13. CLOSE BUTTON
========================================================= */

.support-widget-close {

    width: 34px;
    height: 34px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    padding: 0;

    border: none;

    border-radius: 50%;

    color:
        rgba(255, 255, 255, 0.75);

    background:
        rgba(255, 255, 255, 0.08);

    font-size:
        24px;

    line-height:
        1;

    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;

    transition:
        background 200ms ease,
        color 200ms ease,
        transform 200ms ease;

}


.support-widget-close:hover {

    color:
        #ffffff;

    background:
        rgba(255, 255, 255, 0.16);

    transform:
        rotate(90deg);

}


/* =========================================================
   14. PANEL BODY
========================================================= */

.support-widget-body {

    position: relative;

    width: 100%;

    flex:
        1 1 auto;

    min-height: 0;

    overflow: hidden;

    background:
        #ffffff;

}


/* =========================================================
   15. ALL SUPPORT VIEWS
=========================================================

   IMPORTANT FIX

   Views are no longer absolutely positioned.

   This prevents:
   - Blank white canvases
   - Height conflicts
   - Message form disappearing
   - Human support content being pushed
   - Scroll area occupying incorrect dimensions

========================================================= */

.support-widget .support-view {

    position: relative;

    width: 100%;

    min-width: 0;

    min-height: 0;

    box-sizing: border-box;

    display: flex;

    flex-direction: column;

    padding:
        24px;

    background:
        #ffffff;

    color:
        var(--support-text);

    overflow-x: hidden;

    overflow-y: auto;

    scrollbar-width: thin;

    scrollbar-color:
        rgba(17, 17, 17, 0.18)
        transparent;

}


/* =========================================================
   16. HIDDEN VIEWS
========================================================= */

.support-widget .support-view[hidden] {

    display:
        none !important;

}


/* =========================================================
   17. ACTIVE VIEW
========================================================= */

.support-widget
.support-view:not([hidden]) {

    height:
        100%;

}


/* =========================================================
   18. SCROLLBAR
========================================================= */

.support-widget .support-view::-webkit-scrollbar {

    width:
        5px;

}


.support-widget .support-view::-webkit-scrollbar-track {

    background:
        transparent;

}


.support-widget .support-view::-webkit-scrollbar-thumb {

    background:
        rgba(17, 17, 17, 0.18);

    border-radius:
        999px;

}


/* =========================================================
   19. MAIN VIEW
========================================================= */

.support-widget
.support-view[data-support-view="main"] {

    overflow-y:
        auto;

}


/* =========================================================
   20. WELCOME
========================================================= */

.support-widget-welcome {

    flex-shrink:
        0;

    margin-bottom:
        20px;

}


.support-widget-eyebrow {

    display:
        block;

    margin-bottom:
        7px;

    color:
        var(--support-green-dark);

    font-size:
        0.68rem;

    font-weight:
        800;

    letter-spacing:
        0.08em;

    line-height:
        1.3;

    text-transform:
        uppercase;

}


.support-widget-welcome h3 {

    margin:
        0 0 8px;

    color:
        var(--support-black);

    font-size:
        1.2rem;

    font-weight:
        800;

    line-height:
        1.25;

    letter-spacing:
        -0.03em;

}


.support-widget-welcome p {

    margin:
        0;

    color:
        var(--support-muted);

    font-size:
        0.78rem;

    line-height:
        1.55;

}


/* =========================================================
   21. SUPPORT OPTIONS
========================================================= */

.support-widget-options {

    display:
        flex;

    flex-direction:
        column;

    gap:
        9px;

    flex-shrink:
        0;

}


.support-option {

    width:
        100%;

    display:
        flex;

    align-items:
        center;

    gap:
        12px;

    box-sizing:
        border-box;

    padding:
        13px;

    border:
        1px solid
        var(--support-border);

    border-radius:
        15px;

    color:
        var(--support-text);

    background:
        #ffffff;

    text-align:
        left;

    text-decoration:
        none;

    cursor:
        pointer;

    appearance:
        none;

    -webkit-appearance:
        none;

    transition:
        transform 250ms ease,
        border-color 250ms ease,
        background 250ms ease,
        box-shadow 250ms ease;

}


.support-option:hover {

    transform:
        translateY(-2px);

    border-color:
        rgba(91, 183, 128, 0.35);

    background:
        rgba(91, 183, 128, 0.04);

    box-shadow:
        0 10px 25px
        rgba(0, 0, 0, 0.06);

}


/* =========================================================
   22. OPTION ICON
========================================================= */

.support-option-icon {

    width:
        38px;

    height:
        38px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    flex-shrink:
        0;

    border-radius:
        11px;

    color:
        var(--support-green-dark);

    background:
        rgba(91, 183, 128, 0.10);

}


.support-option-icon svg {

    width:
        19px;

    height:
        19px;

    display:
        block;

}


/* =========================================================
   23. OPTION CONTENT
========================================================= */

.support-option-content {

    min-width:
        0;

    flex:
        1;

    display:
        flex;

    flex-direction:
        column;

    gap:
        3px;

}


.support-option-content strong {

    display:
        block;

    color:
        var(--support-black);

    font-size:
        0.78rem;

    font-weight:
        800;

    line-height:
        1.3;

}


.support-option-content small {

    display:
        block;

    color:
        var(--support-muted);

    font-size:
        0.65rem;

    line-height:
        1.4;

}


/* =========================================================
   24. OPTION ARROW
========================================================= */

.support-option-arrow {

    flex-shrink:
        0;

    color:
        var(--support-muted);

    font-size:
        1rem;

    transition:
        transform 250ms ease,
        color 250ms ease;

}


.support-option:hover
.support-option-arrow {

    color:
        var(--support-green-dark);

    transform:
        translateX(3px);

}


/* =========================================================
   25. WHATSAPP
========================================================= */

.support-option-whatsapp
.support-option-icon {

    color:
        #2e9e62;

    background:
        rgba(46, 158, 98, 0.10);

}


/* =========================================================
   26. SUPPORT NOTE
========================================================= */

.support-widget-note {

    display:
        flex;

    align-items:
        flex-start;

    gap:
        8px;

    margin-top:
        16px;

    padding-top:
        14px;

    border-top:
        1px solid
        rgba(17, 17, 17, 0.07);

    color:
        #8a8a8a;

    font-size:
        0.6rem;

    line-height:
        1.5;

}


/* =========================================================
   27. SUBVIEW HEADER
========================================================= */

.support-subview-header {

    display:
        flex;

    align-items:
        center;

    gap:
        12px;

    flex-shrink:
        0;

    margin-bottom:
        16px;

}


.support-subview-header h3 {

    margin:
        0;

    color:
        var(--support-black);

    font-size:
        1.15rem;

    font-weight:
        800;

    line-height:
        1.25;

}


.support-subview-header
.support-widget-eyebrow {

    margin-bottom:
        3px;

}


/* =========================================================
   28. BACK BUTTON
========================================================= */

.support-back-button {

    width:
        36px;

    height:
        36px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    flex-shrink:
        0;

    padding:
        0;

    border:
        1px solid
        var(--support-border);

    border-radius:
        11px;

    color:
        var(--support-text);

    background:
        #ffffff;

    font-size:
        1rem;

    cursor:
        pointer;

    transition:
        background 200ms ease,
        border-color 200ms ease,
        transform 200ms ease;

}


.support-back-button:hover {

    background:
        var(--support-green-soft);

    border-color:
        rgba(91, 183, 128, 0.35);

    transform:
        translateX(-2px);

}


/* =========================================================
   29. AI VIEW
========================================================= */

.support-widget
.support-view[data-support-view="ai"] {

    overflow:
        hidden;

}


.support-widget .ai-messages {

    flex:
        1 1 auto;

    min-height:
        0;

    display:
        flex;

    flex-direction:
        column;

    gap:
        12px;

    padding:
        4px
        2px
        14px;

    overflow-y:
        auto;

}


.support-widget .ai-message {

    max-width:
        88%;

    padding:
        12px
        14px;

    border-radius:
        14px;

    font-size:
        0.74rem;

    line-height:
        1.5;

}


.support-widget .ai-message-assistant {

    align-self:
        flex-start;

    color:
        var(--support-text);

    background:
        rgba(91, 183, 128, 0.10);

    border-bottom-left-radius:
        5px;

}


.support-widget .ai-message-user {

    align-self:
        flex-end;

    color:
        #ffffff;

    background:
        var(--support-green-dark);

    border-bottom-right-radius:
        5px;

}


/* =========================================================
   30. AI FORM
========================================================= */

.support-widget .ai-form {

    display:
        flex;

    align-items:
        center;

    gap:
        8px;

    flex-shrink:
        0;

    padding-top:
        12px;

    border-top:
        1px solid
        rgba(17, 17, 17, 0.07);

}


.support-widget .ai-form input {

    min-width:
        0;

    flex:
        1;

    height:
        44px;

    box-sizing:
        border-box;

    padding:
        0
        14px;

    border:
        1px solid
        var(--support-border);

    border-radius:
        12px;

    color:
        var(--support-text);

    background:
        #ffffff;

    font-family:
        inherit;

    font-size:
        0.75rem;

    outline:
        none;

}


.support-widget .ai-form button {

    width:
        44px;

    height:
        44px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    flex-shrink:
        0;

    padding:
        0;

    border:
        none;

    border-radius:
        12px;

    color:
        #ffffff;

    background:
        var(--support-green-dark);

    font-size:
        1.1rem;

    cursor:
        pointer;

}


/* =========================================================
   31. AI DISCLAIMER
========================================================= */

.support-widget .support-ai-disclaimer {

    flex-shrink:
        0;

    margin:
        10px
        0
        0;

    color:
        #8a8a8a;

    font-size:
        0.6rem;

    line-height:
        1.45;

    text-align:
        center;

}


/* =========================================================
   32. HUMAN SUPPORT VIEW
========================================================= */

.support-widget
.support-view[data-support-view="human"] {

    overflow-y:
        auto;

}


.support-widget .support-human-status {

    display:
        flex;

    align-items:
        flex-start;

    gap:
        12px;

    padding:
        16px;

    border:
        1px solid
        rgba(91, 183, 128, 0.18);

    border-radius:
        16px;

    background:
        rgba(91, 183, 128, 0.06);

}


.support-widget .support-human-status-icon {

    width:
        38px;

    height:
        38px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    flex-shrink:
        0;

    border-radius:
        12px;

    color:
        var(--support-green-dark);

    background:
        rgba(91, 183, 128, 0.12);

}


.support-widget .support-human-status strong {

    display:
        block;

    margin-bottom:
        6px;

    color:
        var(--support-black);

    font-size:
        0.8rem;

    font-weight:
        800;

}


.support-widget .support-human-status p {

    margin:
        0;

    color:
        var(--support-muted);

    font-size:
        0.7rem;

    line-height:
        1.55;

}


/* =========================================================
   33. HUMAN ACTIONS
========================================================= */

.support-widget .support-human-actions {

    display:
        flex;

    flex-direction:
        column;

    gap:
        10px;

    margin-top:
        18px;

}


.support-widget .support-primary-action,
.support-widget .support-secondary-action {

    width:
        100%;

    min-height:
        46px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    box-sizing:
        border-box;

    padding:
        12px
        16px;

    border-radius:
        12px;

    font-family:
        inherit;

    font-size:
        0.75rem;

    font-weight:
        700;

    cursor:
        pointer;

}


.support-widget .support-primary-action {

    border:
        1px solid
        var(--support-green-dark);

    color:
        #ffffff;

    background:
        var(--support-green-dark);

}


.support-widget .support-secondary-action {

    border:
        1px solid
        var(--support-border);

    color:
        var(--support-text);

    background:
        #ffffff;

}


.support-widget .support-working-hours {

    margin:
        18px
        0
        0;

    color:
        #8a8a8a;

    font-size:
        0.62rem;

    line-height:
        1.5;

    text-align:
        center;

}


/* =========================================================
   34. LEAVE A MESSAGE VIEW
========================================================= */

.support-widget
.support-view[data-support-view="message"] {

    overflow-y:
        auto;

}


/* =========================================================
   35. MESSAGE INTRO
========================================================= */

.support-widget .support-message-intro {

    flex-shrink:
        0;

    margin:
        0
        0
        16px;

    color:
        var(--support-muted);

    font-size:
        0.72rem;

    line-height:
        1.55;

}


/* =========================================================
   36. MESSAGE FORM
========================================================= */

.support-widget .support-message-form {

    width:
        100%;

    display:
        flex;

    flex-direction:
        column;

    gap:
        12px;

    margin:
        0;

    padding:
        0
        0
        4px;

}


/* =========================================================
   37. FORM FIELD
========================================================= */

.support-widget .support-form-field {

    width:
        100%;

    display:
        flex;

    flex-direction:
        column;

    gap:
        5px;

}


.support-widget .support-form-field label {

    display:
        flex;

    align-items:
        center;

    gap:
        5px;

    color:
        var(--support-text);

    font-size:
        0.68rem;

    font-weight:
        700;

    line-height:
        1.3;

}


.support-widget .support-form-field label span {

    color:
        #999999;

    font-size:
        0.58rem;

    font-weight:
        500;

}


/* =========================================================
   38. FORM INPUTS
========================================================= */

.support-widget .support-form-field input,
.support-widget .support-form-field textarea {

    width:
        100%;

    box-sizing:
        border-box;

    border:
        1px solid
        var(--support-border);

    border-radius:
        11px;

    color:
        var(--support-text);

    background:
        #ffffff;

    font-family:
        inherit;

    font-size:
        0.72rem;

    outline:
        none;

}


.support-widget .support-form-field input {

    height:
        42px;

    padding:
        0
        12px;

}


.support-widget .support-form-field textarea {

    min-height:
        90px;

    padding:
        11px
        12px;

    resize:
        vertical;

    line-height:
        1.5;

}


.support-widget .support-form-field input:focus,
.support-widget .support-form-field textarea:focus {

    border-color:
        var(--support-green);

    box-shadow:
        0 0 0 3px
        rgba(91, 183, 128, 0.12);

}


/* =========================================================
   39. MESSAGE SUBMIT
========================================================= */

.support-widget
.support-message-form
.support-primary-action {

    margin-top:
        2px;

}


/* =========================================================
   40. FORM SUCCESS
========================================================= */

.support-widget .support-form-success {

    width:
        100%;

    box-sizing:
        border-box;

    padding:
        14px;

    border:
        1px solid
        rgba(91, 183, 128, 0.20);

    border-radius:
        12px;

    color:
        var(--support-green-dark);

    background:
        rgba(91, 183, 128, 0.08);

    font-size:
        0.7rem;

    line-height:
        1.5;

}

.support-widget .support-form-status {

    min-height: 1.4em;
    margin: 10px 0 0;
    color: var(--support-muted);
    font-size: 0.68rem;
    line-height: 1.45;

}

.support-widget .support-form-status.is-error {

    color: #a61b1b;

}

.support-widget .support-form-status.is-success {

    color: var(--support-green-dark);

}


/* =========================================================
   41. ACCESSIBILITY
========================================================= */

.support-widget button:focus-visible,
.support-widget input:focus-visible,
.support-widget textarea:focus-visible {

    outline:
        2px solid
        rgba(91, 183, 128, 0.45);

    outline-offset:
        2px;

}


/* =========================================================
   42. MOBILE
========================================================= */

.support-widget [hidden] {

    display: none !important;

}

@media (max-width: 600px) {

    .support-widget {

        right:
            18px;

        bottom:
            18px;

        max-width:
            calc(100vw - 36px);

    }


    .support-widget-toggle {

        width:
            58px;

        height:
            58px;

    }


    .support-widget-panel {

        right:
            0;

        bottom:
            72px;

        width:
            calc(100vw - 36px);

        max-width:
            390px;

        height:
            min(
                620px,
                calc(100vh - 100px)
            );

        border-radius:
            20px;

    }


    .support-widget-header {

        padding:
            16px
            18px;

    }


    .support-widget .support-view {

        padding:
            20px;

    }

}


/* =========================================================
   43. SMALL MOBILE
========================================================= */

@media (max-width: 380px) {

    .support-widget {

        right:
            14px;

        bottom:
            14px;

        max-width:
            calc(100vw - 28px);

    }


    .support-widget-panel {

        bottom:
            70px;

        width:
            calc(100vw - 28px);

        max-width:
            none;

        height:
            calc(100vh - 90px);

        border-radius:
            18px;

    }


    .support-widget .support-view {

        padding:
            18px;

    }


    .support-widget-header {

        padding:
            15px
            16px;

    }


    .support-widget-avatar {

        width:
            38px;

        height:
            38px;

        border-radius:
            12px;

    }

}


/* =========================================================
   44. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .support-widget *,
    .support-widget *::before,
    .support-widget *::after {

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;

        transition-duration:
            0.01ms !important;

        scroll-behavior:
            auto !important;

    }

}

