/* SAM · Samsonice companion widget — a dark console that floats over the
   warm-paper site. Deliberately still dark: SAM is the machine, and a dark
   panel over paper reads as an instrument rather than another page section.
   What changed is the hues — it used to be warm orange × mint, which clashed
   with the editorial palette badly enough to look like a third-party embed.
   These now come from the site's own dark theme, so the widget and the site
   read as one company.

   Selectors are kept in lockstep with sam-widget.js (sam- / samAi* / --sam-*). */
:root {
    --sam-ink: #0B1220;
    --sam-surface: #141E2F;
    --sam-surface-2: #1B2942;
    --sam-border: rgba(233, 240, 251, 0.14);
    --sam-text: #EAF0FB;
    --sam-muted: #A7B6D2;
    /* Primary is blue-500 for FILLS ONLY. Any text or icon placed on it must
       use --sam-ink, never white: near-white on blue-500 is ~2.9:1. */
    --sam-primary: #3B82F6;
    --sam-primary-deep: #1D4ED8;
    --sam-accent: #60A5FA;
}

.sam-nudge,
.sam-fab,
.sam-panel {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-sizing: border-box;
}

.sam-nudge *,
.sam-fab *,
.sam-panel * {
    box-sizing: border-box;
}

/* --- SAM orb: breathing warm→mint sphere, the living avatar --- */
.sam-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex: 0 0 auto;
    color: #fff;
    font-weight: 900;
    background: linear-gradient(135deg, var(--sam-primary), var(--sam-accent));
}

.sam-orb {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 32% 28%,
            #ffe0bd 0%,
            var(--sam-primary) 34%,
            var(--sam-primary-deep) 64%,
            #5f2a26 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.10),
        0 0 14px rgba(255, 122, 74, 0.55),
        0 0 5px rgba(55, 224, 184, 0.5);
    animation: sam-breathe 3.4s ease-in-out infinite;
}

.sam-orb::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 72% 78%, rgba(55, 224, 184, 0.6), transparent 48%);
    mix-blend-mode: screen;
}

@keyframes sam-breathe {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.10),
            0 0 12px rgba(255, 122, 74, 0.5),
            0 0 4px rgba(55, 224, 184, 0.45);
    }
    50% {
        transform: scale(1.06);
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.14),
            0 0 22px rgba(255, 122, 74, 0.72),
            0 0 9px rgba(55, 224, 184, 0.62);
    }
}

/* --- Nudge --- */
.sam-nudge {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9998;
    width: min(380px, calc(100vw - 32px));
    padding: 18px;
    border: 1px solid var(--sam-border);
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(27, 32, 48, 0.96), rgba(11, 13, 18, 0.96));
    color: var(--sam-text);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 154, 98, 0.08);
    backdrop-filter: blur(18px);
    transform: translateY(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.sam-nudge.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.sam-nudge-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--sam-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.sam-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sam-accent);
    box-shadow: 0 0 0 0 rgba(55, 224, 184, 0.5);
    animation: sam-pulse 2.2s ease-out infinite;
}

@keyframes sam-pulse {
    0% { box-shadow: 0 0 0 0 rgba(55, 224, 184, 0.45); }
    70% { box-shadow: 0 0 0 9px rgba(55, 224, 184, 0); }
    100% { box-shadow: 0 0 0 0 rgba(55, 224, 184, 0); }
}

.sam-nudge h3 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.sam-nudge p {
    margin: 0;
    color: var(--sam-muted);
    font-size: 14px;
    line-height: 1.55;
}

.sam-nudge-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.sam-button {
    border: 0;
    border-radius: 11px;
    padding: 10px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    color: #1a0f0a;
    background: linear-gradient(135deg, var(--sam-primary), var(--sam-primary-deep));
    box-shadow: 0 8px 24px rgba(255, 107, 74, 0.28);
}

.sam-button.secondary {
    background: transparent;
    border: 1px solid var(--sam-border);
    color: var(--sam-muted);
    box-shadow: none;
}

/* --- FAB --- */
.sam-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9997;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 11px 18px 11px 11px;
    border: 1px solid rgba(255, 154, 98, 0.38);
    border-radius: 999px;
    background: linear-gradient(150deg, rgba(27, 32, 48, 0.94), rgba(11, 13, 18, 0.94));
    color: var(--sam-text);
    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.42),
        0 0 0 4px rgba(255, 154, 98, 0.08),
        0 0 22px rgba(55, 224, 184, 0.10);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sam-fab:hover {
    transform: translateY(-1px);
    box-shadow:
        0 22px 60px rgba(0, 0, 0, 0.5),
        0 0 0 4px rgba(255, 154, 98, 0.14),
        0 0 30px rgba(55, 224, 184, 0.16);
}

.sam-fab span:last-child {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* --- Panel --- */
.sam-panel {
    position: fixed;
    right: 22px;
    bottom: 82px;
    z-index: 9999;
    display: none;
    flex-direction: column;
    width: min(430px, calc(100vw - 32px));
    height: min(680px, calc(100vh - 108px));
    border: 1px solid var(--sam-border);
    border-radius: 18px;
    background: var(--sam-ink);
    color: var(--sam-text);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.sam-panel.open {
    display: flex;
}

.sam-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--sam-border);
    background: linear-gradient(180deg, var(--sam-surface-2), var(--sam-surface));
}

.sam-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sam-title {
    font-size: 14px;
    font-weight: 850;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.sam-subtitle {
    margin-top: 2px;
    color: var(--sam-muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sam-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.sam-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    background: transparent;
    color: var(--sam-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sam-icon-button:hover {
    color: var(--sam-text);
    border-color: rgba(244, 241, 236, 0.24);
}

.sam-live-button {
    width: 52px;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.04em;
    color: var(--sam-accent);
    border-color: rgba(55, 224, 184, 0.35);
}

.sam-icon-button.active {
    color: var(--sam-ink);
    border-color: transparent;
    background: var(--sam-accent);
    box-shadow: 0 0 18px rgba(55, 224, 184, 0.45);
}

/* --- Messages --- */
.sam-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background:
        radial-gradient(circle at top right, rgba(255, 154, 98, 0.10), transparent 36%),
        radial-gradient(circle at bottom left, rgba(55, 224, 184, 0.07), transparent 42%),
        var(--sam-ink);
}

.sam-message {
    max-width: 88%;
    margin-bottom: 10px;
    padding: 11px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.sam-message.assistant {
    background: var(--sam-surface-2);
    color: var(--sam-text);
    border: 1px solid var(--sam-border);
    border-bottom-left-radius: 4px;
}

.sam-message.user {
    margin-left: auto;
    color: #1a0f0a;
    background: linear-gradient(135deg, var(--sam-primary), var(--sam-primary-deep));
    border-bottom-right-radius: 4px;
    font-weight: 600;
}

.sam-message.meta {
    max-width: 100%;
    padding: 0;
    color: var(--sam-muted);
    background: transparent;
    font-size: 11px;
    text-align: center;
}

/* --- Chips --- */
.sam-chips {
    display: flex;
    gap: 8px;
    padding: 10px 14px 0;
    overflow-x: auto;
    background: var(--sam-ink);
    scrollbar-width: none;
}

.sam-chips::-webkit-scrollbar {
    display: none;
}

.sam-chip {
    flex: 0 0 auto;
    border: 1px solid var(--sam-border);
    border-radius: 999px;
    padding: 7px 12px;
    color: var(--sam-text);
    background: rgba(255, 255, 255, 0.03);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.sam-chip:hover {
    border-color: rgba(255, 154, 98, 0.5);
    background: rgba(255, 154, 98, 0.10);
}

/* --- Form --- */
.sam-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--sam-border);
    background: linear-gradient(180deg, var(--sam-surface), var(--sam-surface-2));
}

.sam-input {
    flex: 1;
    min-height: 42px;
    max-height: 110px;
    resize: none;
    border: 1px solid var(--sam-border);
    border-radius: 12px;
    padding: 11px 12px;
    color: var(--sam-text);
    background: rgba(255, 255, 255, 0.04);
    font: inherit;
    font-size: 13px;
    line-height: 1.35;
    outline: none;
}

.sam-input::placeholder {
    color: var(--sam-muted);
}

.sam-input:focus {
    border-color: rgba(255, 154, 98, 0.6);
    box-shadow: 0 0 0 3px rgba(255, 154, 98, 0.12);
}

.sam-send {
    min-width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    color: #1a0f0a;
    background: linear-gradient(135deg, var(--sam-primary), var(--sam-primary-deep));
    font-weight: 900;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 107, 74, 0.28);
}

.sam-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.sam-footnote {
    padding: 0 14px 12px;
    color: var(--sam-muted);
    background: var(--sam-surface-2);
    font-size: 10px;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .sam-nudge,
    .sam-fab {
        right: 14px;
        bottom: 14px;
    }

    .sam-panel {
        right: 10px;
        bottom: 70px;
        width: calc(100vw - 20px);
        height: min(640px, calc(100vh - 90px));
    }

    .sam-title {
        white-space: normal;
        line-height: 1.15;
    }

    .sam-subtitle {
        max-width: 210px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sam-orb,
    .sam-dot {
        animation: none;
    }
}

@media print {
    #samAiRoot {
        display: none !important;
    }
}
