/* Storefront chat widget — fixed bottom-right on every page. */
[x-cloak] { display: none !important; }

.rt-chat-widget {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none; /* let children opt-in so back-to-top doesn't capture clicks when hidden */
}
.rt-chat-widget > * { pointer-events: auto; }

.rt-chat-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
    border: none;
    border-radius: 999px;
    box-shadow: 0 10px 25px -5px rgba(91, 33, 182, 0.5), 0 4px 6px -2px rgba(0,0,0,0.1);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rt-chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -5px rgba(91, 33, 182, 0.6), 0 6px 8px -2px rgba(0,0,0,0.12);
}
.rt-chat-launcher-text { white-space: nowrap; }

@media (max-width: 480px) {
    .rt-chat-launcher-text { display: none; }
    .rt-chat-launcher { padding: 0.85rem; }
}

.rt-chat-panel {
    width: 100%;
    max-width: 360px;
    max-height: 560px;
    /* Responsive fallback for small screens */
    box-sizing: border-box;
    @media (max-width: 400px) {
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 6rem);
    }
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
}

.rt-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1rem 0.75rem;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
}
.rt-chat-title { font-weight: 700; font-size: 1.05rem; }
.rt-chat-subtitle { font-size: 0.8rem; opacity: 0.9; margin-top: 2px; }
.rt-chat-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
}
.rt-chat-close:hover { background: rgba(255,255,255,0.15); }

.rt-chat-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}
.rt-chat-form { display: flex; flex-direction: column; gap: 0.75rem; }
.rt-chat-hint { font-size: 0.85rem; color: #4b5563; margin: 0 0 0.25rem; }

.rt-chat-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: #374151; }
.rt-chat-field input,
.rt-chat-field textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: #111827;
    background: #fff;
}
.rt-chat-field input:focus,
.rt-chat-field textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}
.rt-chat-optional { color: #9ca3af; font-weight: 400; }

.rt-chat-error {
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fecaca;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    margin: 0;
}

.rt-chat-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.65rem 1rem;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease;
}
.rt-chat-submit:hover:not(:disabled) { background: #6d28d9; }
.rt-chat-submit:disabled { background: #a78bfa; cursor: not-allowed; }

.rt-chat-foot {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0.25rem 0 0;
}
.rt-chat-foot a { color: #7c3aed; font-weight: 600; text-decoration: none; }
.rt-chat-foot a:hover { text-decoration: underline; }

.rt-chat-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
}
.rt-chat-success h3 { font-size: 1.05rem; font-weight: 700; color: #065f46; margin: 0.25rem 0 0; }
.rt-chat-success p { font-size: 0.85rem; color: #4b5563; margin: 0; }
.rt-chat-secondary {
    margin-top: 0.5rem;
    padding: 0.45rem 1rem;
    background: #fff;
    color: #7c3aed;
    border: 1px solid #c4b5fd;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.rt-chat-secondary:hover { background: #f5f3ff; }

.rt-back-to-top {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: rgba(17, 24, 39, 0.7);
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 10px -2px rgba(0,0,0,0.25);
}
.rt-back-to-top:hover { background: rgba(17, 24, 39, 0.9); }
.rt-back-to-top:not(.hidden) { display: inline-flex; }
