/**
 * Shois Chat Button — T09 Paper Fold Template
 *
 * Origami paper aesthetic with folded corners via clip-path,
 * crosshatch grid lines, crease dividers, and serif italic headers.
 * Warm amber accent only.
 * Type: Bubble Popup
 *
 * @package ShoisChatButton
 */

/* ─── Design Tokens ─────────────────────────────────── */
.shcb-template-fold {
    --scb-primary: #D97706;
    --scb-secondary: #B45309;
    --scb-bg: #FAF8F3;
    --shcb-header-bg: #FAF8F3;
    --shcb-header-text: #1C1917;
    --scb-text: #1C1917;
    --scb-text-light: rgba(28, 25, 23, 0.38);
    --shcb-cta-bg: #D97706;
    --shcb-cta-text: #ffffff;
    --scb-shadow: 4px 4px 0 #E8E3D8, 8px 8px 30px rgba(28,25,23,0.1);
    --scb-shadow-btn: 2px 2px 0 #E8E3D8, 4px 4px 12px rgba(28,25,23,0.08);
    --scb-radius-btn: 0px;
    --scb-radius-popup: 0px;
    --scb-font: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --_crease: #E8E3D8;
    --_dim: rgba(28,25,23,0.1);
    --_sub: rgba(28,25,23,0.38);
}


/* ─── Trigger Button — Folded Paper Corner ──────────── */
.shcb-template-fold .shcb-trigger-btn {
    background: white;
    border: 1.5px solid var(--_dim);
    border-radius: 0;
    box-shadow: 2px 2px 0 var(--_crease), 4px 4px 12px rgba(28,25,23,0.08);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

/* Paper lines inside button */
.shcb-template-fold .shcb-trigger-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(var(--_crease) 1px, transparent 1px);
    background-size: 100% 9px;
    opacity: 0.6;
    pointer-events: none;
}

/* Folded corner triangle */
.shcb-template-fold .shcb-trigger-btn::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 16px 16px 0;
    border-color: transparent var(--_crease) transparent transparent;
    pointer-events: none;
    z-index: 2;
    filter: drop-shadow(-1px 1px 1px rgba(28,25,23,0.1));
    transition: border-width 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

.shcb-template-fold .shcb-trigger-btn:hover {
    border-color: rgba(28,25,23,0.18);
    box-shadow: 3px 3px 0 var(--_crease), 6px 6px 18px rgba(28,25,23,0.12);
    transform: scale(1.06);
}

.shcb-template-fold .shcb-trigger-btn:hover::after {
    border-width: 0 20px 20px 0;
}

.shcb-template-fold .shcb-trigger-btn:active {
    transform: scale(0.95);
}

.shcb-template-fold .shcb-trigger-icon svg {
    fill: var(--scb-text);
    position: relative;
    z-index: 1;
}

/* Trigger label — paper tag with fold */
.shcb-template-fold .shcb-trigger-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--_sub);
    background: white;
    border: 1.5px solid var(--_dim);
    box-shadow: 2px 2px 0 var(--_crease);
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

/* Pulse ring — square */
.shcb-template-fold .shcb-pulse-ring {
    border-color: rgba(28,25,23,0.08);
    border-radius: 0;
}


/* ─── Popup — Unfolded Note ─────────────────────────── */
.shcb-template-fold .shcb-popup {
    background: white;
    border: 1.5px solid var(--_dim);
    border-radius: 0;
    box-shadow: 4px 4px 0 var(--_crease), 8px 8px 30px rgba(28,25,23,0.1);
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
}

/* Paper fold corner on popup */
.shcb-template-fold .shcb-popup::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 20px 20px 0;
    border-color: transparent var(--_crease) transparent transparent;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(-1px 1px 2px rgba(28,25,23,0.08));
}

/* Paper lines inside popup */
.shcb-template-fold .shcb-popup::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(var(--_crease) 1px, transparent 1px);
    background-size: 100% 28px;
    opacity: 0.3;
    z-index: 0;
}


/* ─── Header ────────────────────────────────────────── */
.shcb-template-fold .shcb-popup-header {
    background: transparent;
    border-bottom: 1.5px solid var(--_dim);
    position: relative;
    z-index: 1;
    padding: 20px 18px 18px;
}

.shcb-template-fold .shcb-header-title {
    font-family: 'Lora', 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    color: var(--scb-text);
    letter-spacing: 0.3px;
}

.shcb-template-fold .shcb-header-subtitle {
    font-size: 12px;
    color: var(--_sub);
    letter-spacing: 0.3px;
}

/* Eyebrow — warm accent */
.shcb-template-fold .shcb-header-subtitle::before {
    content: '— ';
    color: var(--scb-primary);
    font-weight: 700;
}

/* Close */
.shcb-template-fold .shcb-close-btn {
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--_sub);
    transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.shcb-template-fold .shcb-close-btn svg {
    stroke: var(--_sub);
}

.shcb-template-fold .shcb-close-btn:hover {
    transform: rotate(90deg);
}

.shcb-template-fold .shcb-close-btn:hover svg {
    stroke: var(--scb-text);
}


/* ─── Body ──────────────────────────────────────────── */
.shcb-template-fold .shcb-popup-body {
    position: relative;
    z-index: 1;
}

/* Welcome — amber left bar */
.shcb-template-fold .shcb-welcome-message {
    font-size: 12.5px;
    line-height: 1.75;
    padding: 11px 13px;
    background: var(--scb-bg);
    border: 1.5px solid var(--_dim);
    border-left: 3px solid var(--scb-primary);
    border-radius: 0;
}

.shcb-template-fold .shcb-welcome-message p {
    color: var(--_sub);
}


/* ─── Chips ─────────────────────────────────────────── */
.shcb-template-fold .shcb-chip {
    background: transparent;
    border: 1.5px solid var(--_dim);
    border-radius: 0;
    color: var(--_sub);
    transition: all 0.22s ease;
}

.shcb-template-fold .shcb-chip:hover {
    border-color: var(--scb-primary);
    color: var(--scb-primary);
}


/* ─── Agent Cards — Paper with fold corner ──────────── */
.shcb-template-fold .shcb-agent-card {
    background: var(--scb-bg);
    border: 1.5px solid var(--_dim);
    border-radius: 0;
    padding-right: 36px;
    position: relative;
    overflow: hidden;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
    transition: border-color 0.22s, background 0.22s, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

/* Ink underline reveal */
.shcb-template-fold .shcb-agent-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 100%;
    height: 2px;
    background: var(--scb-primary);
    transition: right 0.35s ease;
}

/* Arrow */
.shcb-template-fold .shcb-agent-card::before {
    content: '›';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: 300;
    color: var(--_sub);
    transition: color 0.2s, transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
    z-index: 2;
}

.shcb-template-fold .shcb-agent-card:hover {
    border-color: rgba(28,25,23,0.18);
    background: white;
    transform: translateX(-2px);
}

.shcb-template-fold .shcb-agent-card:hover::after {
    right: 0%;
}

.shcb-template-fold .shcb-agent-card:hover::before {
    color: var(--scb-primary);
    transform: translateY(-50%) translateX(4px);
}


/* ─── Avatar — Square ink block ─────────────────────── */
.shcb-template-fold .shcb-agent-avatar {
    border-radius: 0;
}

.shcb-template-fold .shcb-avatar-initials {
    background: var(--scb-text);
    color: white;
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 16px;
    border-radius: 0;
}

.shcb-template-fold .shcb-agent-card:hover .shcb-agent-avatar {
    transform: scale(1.06) rotate(-4deg);
}


/* ─── Agent Info ────────────────────────────────────── */
.shcb-template-fold .shcb-agent-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--scb-text);
    transition: color 0.2s;
}

.shcb-template-fold .shcb-agent-card:hover .shcb-agent-name {
    color: var(--scb-primary);
}

.shcb-template-fold .shcb-agent-status {
    font-size: 10.5px;
    color: var(--_sub);
    letter-spacing: 0.5px;
}

.shcb-template-fold .shcb-status-online {
    background: #16a34a;
    animation: shcb-fold-dot-blink 2s ease-in-out infinite;
}

@keyframes shcb-fold-dot-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.2; }
}

.shcb-template-fold .shcb-status-offline {
    background: rgba(28,25,23,0.2);
}


/* ─── Footer ────────────────────────────────────────── */
.shcb-template-fold .shcb-popup-footer {
    background: transparent;
    border-top: 1px solid var(--_dim);
    z-index: 1;
}

.shcb-template-fold .shcb-powered-by {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--_sub);
}


/* ─── Badge ─────────────────────────────────────────── */
.shcb-template-fold .shcb-badge {
    background: var(--scb-primary);
    color: #fff;
    font-weight: 800;
    border-radius: 0;
}


/* ─── Stagger Entry ─────────────────────────────────── */
.shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-welcome-message {
    animation: shcb-fold-in 0.4s ease 0.05s both;
}
.shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-chips {
    animation: shcb-fold-in 0.4s ease 0.1s both;
}
.shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-agent-card:nth-child(1) {
    animation: shcb-fold-in 0.4s ease 0.16s both;
}
.shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-agent-card:nth-child(2) {
    animation: shcb-fold-in 0.4s ease 0.24s both;
}
.shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-agent-card:nth-child(3) {
    animation: shcb-fold-in 0.4s ease 0.32s both;
}
.shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-popup-footer {
    animation: shcb-fold-in 0.4s ease 0.32s both;
}

@keyframes shcb-fold-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}


/* ─── Reduced Motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .shcb-template-fold .shcb-status-online {
        animation: none;
    }
    .shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-welcome-message,
    .shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-chips,
    .shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-agent-card,
    .shcb-template-fold .shcb-popup.shcb-popup-visible .shcb-popup-footer {
        animation: none;
    }
}
