﻿/*=========================================================
    SAM 3.0
    Stitch America Assistant
    Production Stylesheet
=========================================================*/

/*=========================================================
    ROOT VARIABLES
=========================================================*/

:root {
    --sam-primary: #1E73BE;
    --sam-primary-light: #2F86D6;
    --sam-primary-dark: #155A96;
    --sam-success: #2ECC71;
    --sam-bg: #FFFFFF;
    --sam-bg-light: #F7F9FB;
    --sam-text: #243746;
    --sam-text-light: #6B7280;
    --sam-border: #D9E2EC;
    --sam-radius: 18px;
    --sam-radius-small: 14px;
    --sam-radius-pill: 999px;
    --sam-shadow: 0 18px 48px rgba(0,0,0,.18);
    --sam-speed: .2s;
    --sam-transition: all .2s ease;
}

/*=========================================================
    GLOBAL
=========================================================*/

*,
*::before,
*::after {
    box-sizing: border-box;
}

.sam-window *,
.sam-launcher * {
    font-family: inherit;
}

/*=========================================================
    LAUNCHER
=========================================================*/

.sam-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2147483646;
}

.sam-launch-button {
    width: 240px;
    height: 88px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    border: none;
    border-radius: 44px;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(0,0,0,.16);
    transition: transform var(--sam-speed), box-shadow var(--sam-speed);
}

    .sam-launch-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 28px rgba(0,0,0,.18);
    }

.sam-launch-icon {
    width: 62px;
    height: 62px;
    min-width: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sam-launch-logo {
    width: 58px;
    height: 58px;
    display: block;
}

.sam-launch-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

    .sam-launch-text strong {
        margin: 0 0 4px;
        font-size: 18px;
        font-weight: 700;
        color: #0A2F5B;
    }

    .sam-launch-text span {
        font-size: 14px;
        color: #555;
    }

/*=========================================================
    WINDOW
=========================================================*/

.sam-window {
    position: fixed;
    right: 24px;
    bottom: 210px;
    width: 420px;
    height: 680px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--sam-bg);
    border: 1px solid #E5EAF1;
    border-radius: var(--sam-radius);
    box-shadow: var(--sam-shadow);
    isolation: isolate;
    z-index: 2147483647;
}

    .sam-window.open {
        display: flex;
    }

/*=========================================================
    HEADER
=========================================================*/

.sam-header {
    height: 92px;
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: var(--sam-primary);
    color: white;
}

.sam-header-left {
    display: flex;
    align-items: center;
}

.sam-header-logo {
    width: 56px;
    height: 56px;
    margin-right: 15px;
    object-fit: contain;
}

.sam-header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sam-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.sam-subtitle {
    margin-top: 4px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,.92);
}

.sam-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,.90);
}

.sam-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--sam-success);
    box-shadow: 0 0 8px rgba(46,204,113,.6);
    flex-shrink: 0;
}

.sam-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: white;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    transition: all var(--sam-speed);
}

    .sam-close:hover {
        background: rgba(255,255,255,.18);
        transform: rotate(90deg);
    }

/*=========================================================
    BODY
=========================================================*/

.sam-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/*=========================================================
    WELCOME
=========================================================*/

.sam-welcome {
    flex: 0 0 auto;
    padding: 14px 22px 10px;
    background: #fff;
}

.sam-welcome-content {
    padding: 0 12px;
}

.sam-section-title {
    margin: 18px 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--sam-primary);
}

.sam-welcome-text {
    margin: 0 0 8px;
    font-size: 17px;
    line-height: 1.6;
    color: #4A5568;
}

.sam-welcome-prompt {
    margin: 14px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--sam-primary);
}

/*=========================================================
    QUICK ACTIONS
=========================================================*/

.sam-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 32px 20px;
    background: #fff;
}

.sam-quick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 18px;
    border: 1px solid #C7DCF8;
    border-radius: var(--sam-radius-pill);
    background: #F3F8FE;
    color: var(--sam-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sam-speed);
}

    .sam-quick:hover {
        background: var(--sam-primary);
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(30,115,190,.25);
    }



/*=========================================================
    MESSAGES
=========================================================*/

.sam-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: var(--sam-bg-light);
}

    .sam-messages::-webkit-scrollbar {
        width: 8px;
    }

    .sam-messages::-webkit-scrollbar-thumb {
        background: #CCD7E4;
        border-radius: 999px;
    }

    .sam-messages::-webkit-scrollbar-track {
        background: transparent;
    }

/*=========================================================
    MESSAGE LAYOUT
=========================================================*/

.sam-message {
    display: flex;
    margin-bottom: 18px;
    animation: samMessageIn .20s ease;
}

    .sam-message.sam {
        justify-content: flex-start;
    }

    .sam-message.user {
        justify-content: flex-end;
    }

    .sam-message.agent {
        justify-content: flex-start;
    }

    .sam-message.system {
        justify-content: center;
    }

/*=========================================================
    BUBBLES
=========================================================*/

.sam-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.55;
    word-break: break-word;
}

    .sam-bubble pre {
        margin: 12px 0;
        padding: 14px;
        overflow-x: auto;
        border-radius: 10px;
        background: #1E293B;
        color: white;
        font-size: 13px;
    }

    .sam-bubble code {
        font-family: Consolas, monospace;
    }

    .sam-bubble a {
        color: var(--sam-primary);
        font-weight: 600;
        text-decoration: none;
    }

        .sam-bubble a:hover {
            text-decoration: underline;
        }

    .sam-bubble ul,
    .sam-bubble ol {
        margin: 10px 0 10px 22px;
    }

    .sam-bubble li {
        margin-bottom: 6px;
    }

    .sam-bubble img {
        max-width: 100%;
        border-radius: 12px;
    }

/*---------------------------------------------------------
    SAM
---------------------------------------------------------*/

.sam-message.sam .sam-bubble {
    background: #F3F5F8;
    color: var(--sam-text);
}

/*---------------------------------------------------------
    USER
---------------------------------------------------------*/

.sam-message.user .sam-bubble {
    background: var(--sam-primary);
    color: white;
}

/*---------------------------------------------------------
    AGENT
---------------------------------------------------------*/

.sam-message.agent .sam-bubble {
    background: #E8F7EE;
    border-left: 4px solid var(--sam-success);
    color: var(--sam-text);
}

/*---------------------------------------------------------
    SYSTEM
---------------------------------------------------------*/

.sam-message.system .sam-bubble {
    background: transparent;
    color: #7A8694;
    font-size: 13px;
    font-style: italic;
    text-align: center;
    box-shadow: none;
}

/*=========================================================
    MESSAGE ANIMATION
=========================================================*/

@keyframes samMessageIn {

    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/*=========================================================
    TYPING INDICATOR
=========================================================*/

.sam-typing {
    display: none;
    align-items: center;
    gap: 6px;
    margin: 0 0 16px 18px;
    padding: 12px 16px;
    background: #F3F5F8;
    border: 1px solid #E3E8EF;
    border-radius: 18px;
    width: fit-content;
}

    .sam-typing span:not(.sam-typing-text) {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #7A8A9A;
        animation: samTyping 1.4s infinite;
    }

    .sam-typing span:nth-child(2) {
        animation-delay: .2s;
    }

    .sam-typing span:nth-child(3) {
        animation-delay: .4s;
    }

.sam-typing-text {
    margin-left: 6px;
    font-size: 14px;
    color: #6B7280;
}

@keyframes samTyping {

    0%,80%,100% {
        transform: scale(.6);
        opacity: .5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/*=========================================================
    FOOTER
=========================================================*/

.sam-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: white;
    border-top: 1px solid #E6EBF2;
}

/*=========================================================
    ATTACH
=========================================================*/

.sam-attach {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #D7E1EC;
    border-radius: 8px;
    background: white;
    color: #8B98A7;
    cursor: not-allowed;
    transition: all var(--sam-speed);
}

    .sam-attach i {
        font-size: 17px;
    }

    .sam-attach:hover {
        background: #F8FAFC;
    }

/*=========================================================
    INPUT
=========================================================*/

.sam-input {
    flex: 1;
    min-width: 0;
    min-height: 54px;
    max-height: 120px;
    padding: 14px 16px;
    border: 1px solid #C8D4E5;
    border-radius: 14px;
    background: white;
    resize: none;
    overflow-y: auto;
    outline: none;
    font: inherit;
    line-height: 1.45;
    box-sizing: border-box;
    transition: border-color var(--sam-speed), box-shadow var(--sam-speed);
}

    .sam-input:focus {
        border-color: var(--sam-primary);
        box-shadow: 0 0 0 3px rgba(30,115,190,.15);
    }

/*=========================================================
    SEND
=========================================================*/

.sam-send {
    width: 88px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 14px;
    background: var(--sam-primary);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sam-speed);
}

    .sam-send:hover {
        background: var(--sam-primary-light);
        transform: translateY(-1px);
    }

.sam-hidden {
    max-height: 0 !important;
    opacity: 0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    transition: max-height .35s ease, opacity .25s ease, margin .25s ease, padding .25s ease;
}

/*=========================================================
    MOBILE
=========================================================*/

@media (max-width:768px) {

    .sam-window {
        inset: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .sam-launcher {
        right: 24px;
        bottom: 24px;
    }

    .sam-launch-button {
        width: 230px;
        height: 88px;
    }

    .sam-launch-icon {
        width: 56px;
        height: 56px;
        min-width: 56px;
    }

    .sam-launch-logo {
        width: 48px;
        height: 48px;
    }

    .sam-launch-text strong {
        font-size: 16px;
    }

    .sam-launch-text span {
        font-size: 14px;
    }

    .sam-input {
        font-size: 16px;
    }
}