/**
 * Tissia Demo Chat Styles - Premium Edition
 * @version 3.2.0
 */

/* ==========================================================================
   DEMO PAGE SECTION
   ========================================================================== */

.ts-demo-section {
    min-height: calc(100vh - 200px);
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ==========================================================================
   CHAT WRAPPER - Teal glow effect
   ========================================================================== */

.ts-demo-chat-wrapper {
    position: relative;
}

.ts-demo-chat-wrapper::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: linear-gradient(135deg, var(--ts-primary-200) 0%, var(--ts-primary-100) 100%);
    border-radius: calc(var(--ts-radius-2xl) + 20px);
    z-index: -1;
    opacity: 0.5;
}

/* ==========================================================================
   CHAT CONTAINER
   ========================================================================== */

.ts-demo-chat-container {
    position: relative;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 520px;
    max-height: 620px;
    border-radius: var(--ts-radius-2xl) !important;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
    padding: 1.5rem !important;
    border: none !important;
    overflow: hidden;
}

@media (max-width: 575.98px) {
    .ts-demo-chat-wrapper::before {
        top: -12px;
        left: -12px;
        right: -12px;
        bottom: -12px;
    }
    
    .ts-demo-chat-container {
        min-height: 450px;
        padding: 1rem !important;
        border-radius: var(--ts-radius-xl) !important;
    }
}

/* ==========================================================================
   CHAT HEADER
   ========================================================================== */

.ts-demo-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 79, 89, 0.15);
    flex-shrink: 0;
}

.ts-demo-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--bs-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-demo-avatar-text {
    color: #fff;
    font-weight: 600;
    font-size: 1.25rem;
}

.ts-demo-header-info {
    flex: 1;
}

.ts-demo-header-info h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0;
    color: #212529;
}

.ts-demo-header-status {
    font-size: 0.8rem;
    color: #198754;
}

.ts-demo-header-status i {
    font-size: 8px;
}

.ts-demo-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-demo-header-btn {
    background: transparent;
    border: none;
    color: #6c757d;
    padding: 0.375rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-demo-header-btn:hover {
    color: var(--bs-primary);
    background: rgba(0, 79, 89, 0.08);
}

.ts-demo-header-btn.active {
    color: var(--bs-primary);
}

/* ==========================================================================
   MESSAGES AREA
   ========================================================================== */

.ts-demo-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
}

.ts-demo-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.ts-demo-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ts-demo-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 79, 89, 0.2);
    border-radius: 2px;
}

/* ==========================================================================
   MESSAGE BUBBLES
   ========================================================================== */

.ts-demo-message {
    margin-bottom: 0.75rem;
    animation: ts-demo-fadeIn 0.25s ease-out;
}

@keyframes ts-demo-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* USER MESSAGE - flat bottom-RIGHT, timestamp RIGHT-aligned */
.ts-demo-message-user {
    display: flex;
    justify-content: flex-end;
}

.ts-demo-message-user .ts-demo-msg-bubble {
    background: var(--bs-primary);
    color: #fff;
    border-radius: 1rem 1rem 0 1rem;
    padding: 0.5rem 0.75rem;
    max-width: 85%;
}

/* AGENT MESSAGE - flat bottom-LEFT, timestamp LEFT-aligned */
.ts-demo-message-agent,
.ts-demo-message-assistant {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.ts-demo-message-agent .ts-demo-msg-bubble,
.ts-demo-message-assistant .ts-demo-msg-bubble {
    background: #fff;
    color: #212529;
    border-radius: 1rem 1rem 1rem 0;
    padding: 0.5rem 0.75rem;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   MESSAGE TEXT
   ========================================================================== */

.ts-demo-msg-text {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
}

.ts-demo-msg-text p {
    margin-bottom: 0.5rem;
}

.ts-demo-msg-text p:last-child {
    margin-bottom: 0;
}

.ts-demo-msg-text ul,
.ts-demo-msg-text ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.ts-demo-msg-text li {
    margin-bottom: 0.25rem;
}

.ts-demo-msg-text strong {
    font-weight: 600;
}

.ts-demo-msg-text a {
    color: var(--bs-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ts-demo-message-user .ts-demo-msg-text a {
    color: #fff;
}

/* ==========================================================================
   TIMESTAMPS INSIDE BUBBLES
   ========================================================================== */

.ts-demo-msg-time {
    font-size: 0.65rem;
    margin-top: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0.7;
}

/* USER: timestamp RIGHT-aligned inside bubble */
.ts-demo-msg-time-user {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.8);
}

/* AGENT: timestamp LEFT-aligned inside bubble */
.ts-demo-msg-time-agent {
    justify-content: flex-start;
    color: #6c757d;
}

/* Read receipts */
.ts-demo-read-receipt {
    display: inline-flex;
    align-items: center;
}

.ts-demo-read-receipt.seen {
    color: rgba(255, 255, 255, 0.9);
}

/* Hide old-style meta (outside bubble) */
.ts-demo-msg-meta {
    display: none;
}

/* ==========================================================================
   MESSAGE REACTIONS
   ========================================================================== */

.ts-demo-msg-reactions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.375rem;
    padding-left: 0.25rem;
}

.ts-demo-reaction-btn {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 1rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ts-demo-reaction-btn:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.ts-demo-reaction-btn.active {
    background: rgba(0, 79, 89, 0.1);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.ts-demo-reaction-btn .emoji {
    font-size: 0.875rem;
}

/* ==========================================================================
   TYPING INDICATOR
   ========================================================================== */

.ts-demo-typing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

.ts-demo-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.ts-demo-typing-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--bs-primary);
    border-radius: 50%;
    animation: ts-demo-bounce 1.4s infinite ease-in-out both;
}

.ts-demo-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ts-demo-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.ts-demo-typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes ts-demo-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   QUICK ACTIONS
   ========================================================================== */

.ts-demo-quick-actions {
    padding-top: 0.75rem;
    margin-top: auto;
    border-top: 1px solid rgba(0, 79, 89, 0.1);
    flex-shrink: 0;
}

.ts-demo-quick-actions-label {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.ts-demo-quick-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 1rem;
    transition: all 0.15s ease;
}

.ts-demo-quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   INPUT AREA
   ========================================================================== */

.ts-demo-chat-input {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(0, 79, 89, 0.1);
    flex-shrink: 0;
}

.ts-demo-chat-input textarea {
    resize: none;
    max-height: 80px;
    font-size: 0.875rem;
    border: 1px solid #dee2e6;
    border-radius: 1.25rem;
    padding: 0.5rem 1rem;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ts-demo-chat-input textarea:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.15rem rgba(0, 79, 89, 0.1);
}

.ts-demo-chat-input textarea::placeholder {
    color: #adb5bd;
}

.ts-demo-send-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-demo-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.ts-demo-send-btn:disabled {
    opacity: 0.5;
}

.ts-demo-keyboard-hint {
    font-size: 0.7rem;
    color: #6c757d;
    text-align: center;
    margin-top: 0.5rem;
}

/* ==========================================================================
   SESSION TIMEOUT TOAST
   ========================================================================== */

.ts-demo-timeout-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #212529;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ts-demo-timeout-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.ts-demo-timeout-toast i {
    color: #ffc107;
}

.ts-demo-timeout-close {
    background: transparent;
    border: none;
    color: #fff;
    opacity: 0.7;
    padding: 0;
    margin-left: 0.5rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.ts-demo-timeout-close:hover {
    opacity: 1;
}

/* ==========================================================================
   FEEDBACK MODAL
   ========================================================================== */

.ts-demo-feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ts-demo-feedback-overlay.show {
    opacity: 1;
    visibility: visible;
}

.ts-demo-feedback-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ts-demo-feedback-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.ts-demo-feedback-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.ts-demo-feedback-icon {
    width: 48px;
    height: 48px;
    background: rgba(0, 79, 89, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.ts-demo-feedback-icon i {
    font-size: 1.25rem;
    color: var(--bs-primary);
}

.ts-demo-feedback-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.ts-demo-feedback-subtitle {
    font-size: 0.875rem;
    color: #6c757d;
}

.ts-demo-feedback-stars {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ts-demo-feedback-star {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #dee2e6;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0.25rem;
}

.ts-demo-feedback-star:hover,
.ts-demo-feedback-star.active {
    color: #ffc107;
    transform: scale(1.1);
}

.ts-demo-feedback-textarea {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    resize: none;
    margin-bottom: 1rem;
    transition: border-color 0.15s ease;
}

.ts-demo-feedback-textarea:focus {
    outline: none;
    border-color: var(--bs-primary);
}

.ts-demo-feedback-actions {
    display: flex;
    gap: 0.75rem;
}

.ts-demo-feedback-actions button {
    flex: 1;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ts-demo-feedback-skip {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
}

.ts-demo-feedback-skip:hover {
    background: #e9ecef;
}

.ts-demo-feedback-submit {
    background: var(--bs-primary);
    border: none;
    color: #fff;
}

.ts-demo-feedback-submit:hover {
    background: #003d45;
}

.ts-demo-feedback-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ts-demo-feedback-success {
    text-align: center;
    padding: 1rem 0;
}

.ts-demo-feedback-success i {
    font-size: 3rem;
    color: #198754;
    margin-bottom: 0.75rem;
}

/* ==========================================================================
   COMING SOON STATE
   ========================================================================== */

.ts-demo-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    text-align: center;
    padding: 2rem 1rem;
}

.ts-demo-coming-soon-icon {
    width: 72px;
    height: 72px;
    background: rgba(0, 79, 89, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.ts-demo-coming-soon-icon i {
    font-size: 2rem;
    color: var(--bs-primary);
    animation: ts-demo-hourglass 3s ease-in-out infinite;
}

@keyframes ts-demo-hourglass {
    0%, 100% { transform: rotate(0deg); }
    25%, 50% { transform: rotate(180deg); }
    75% { transform: rotate(360deg); }
}

/* ==========================================================================
   CTA SECTION
   ========================================================================== */

.ts-demo-cta {
    background: rgba(0, 79, 89, 0.05);
    border-radius: 1rem;
}
