/* Safforix AI Chatbot - Ultra Premium "Text Support" Design */
:root {
    --chat-primary: #03a1d0;
    --chat-primary-light: #48cae4;
    --chat-user-msg: #072b5f;
    /* Vibrant Blue from reference */
    --chat-ai-bg: #ffffff;
    --chat-bg-soft: #f4f7f9;
    --chat-text: #1a1a1a;
    --chat-text-muted: #737373;
    --chat-border: rgba(0, 0, 0, 0.08);
    --chat-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
    --chat-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Floating Toggle Button */
.safforix-chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: none;
    z-index: 100001;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
}

/* Online Status Popup Message */
.chat-online-msg {
    position: fixed;
    bottom: 40px;
    right: 105px;
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    font-family: 'Sora', sans-serif;
    animation: slideLeft 0.5s ease-out;
}

.chat-online-msg::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-style: solid;
    border-color: transparent transparent transparent white;
}

.msg-title {
    display: block;
    font-weight: 700;
    color: #333;
    font-size: 14px;
    margin-bottom: 2px;
}

.msg-body {
    display: block;
    font-size: 13px;
    color: #666;
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.safforix-chat-toggle.active {
    background: #4a4a4a;
    transform: rotate(90deg) scale(0.9);
}

/* Chat Container */
.safforix-chat-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 410px;
    height: 700px;
    max-height: calc(100vh - 150px);
    background: #ffffff;
    border-radius: 28px;
    box-shadow: var(--chat-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    transform: translateY(30px) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.safforix-chat-container.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Premium Header Redesign */
.chat-header {
    background: #ffffff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    height: 70px;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.header-right {
    justify-content: flex-end;
}

.header-left i,
.header-right i {
    color: #444;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.header-left i:hover,
.header-right i:hover {
    color: var(--chat-primary);
    transform: scale(1.1);
}

.header-capsule {
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    /* Even wider for full logo */
}

.header-capsule img {
    width: 100%;
    height: auto;
    max-height: 48px;
    border-radius: 0;
    object-fit: contain;
}

/* Zoomed State */
.safforix-chat-container.zoomed {
    width: 600px;
    height: 800px;
    max-height: calc(100vh - 50px);
    bottom: 25px;
    border-radius: 32px;
}

@media (max-width: 768px) {
    .safforix-chat-container.zoomed {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}

/* Emoji Tray */
.emoji-tray {
    position: absolute;
    bottom: 90px;
    left: 20px;
    right: 20px;
    background: white;
    border: 1px solid #eee;
    border-radius: 15px;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 100;
}

.emoji-tray.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.emoji-item {
    font-size: 22px;
    cursor: pointer;
    transition: transform 0.2s;
}

.emoji-item:hover {
    transform: scale(1.2);
}

/* Multi-View Viewport */
.view-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

.view-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    transform: translateX(30px);
}

.view-container.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}

/* Home View Styles */
.home-header {
    padding: 40px 25px 30px;
    background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
}

.home-header h1 {
    font-size: 34px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
    letter-spacing: -0.5px;
}

.home-content {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.welcome-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
}

.card-top {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.avatar-stack {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: #f0f4f8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-stack img {
    width: 80%;
    height: auto;
    object-fit: contain;
}

.card-info {
    flex: 1;
}

.support-label {
    font-size: 13px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.card-info p {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    margin: 0;
}

.start-chat-btn {
    width: 100%;
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.start-chat-btn:hover {
    background: #333;
    transform: translateY(-2px);
}

.status-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: background 0.2s;
}

.status-card:hover {
    background: #fcfcfc;
}

.status-card span {
    font-size: 14px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-card i {
    color: #888;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.message-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    font-size: 14.5px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes messageFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.ai {
    background: #ffffff;
    color: #333;
    align-self: flex-start;
    border-radius: 4px 20px 20px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f1f1;
    margin-left: 35px;
}

.message.ai::before {
    content: '';
    position: absolute;
    left: -40px;
    top: 5px;
    width: 32px;
    height: 32px;
    background: url('../images/about/safforix.jpeg') center/contain no-repeat;
    border-radius: 4px;
    /* Square with slight rounding looks better for horizontal logo */
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.user {
    background: var(--chat-user-msg);
    color: white;
    align-self: flex-end;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

/* Input Bar Redesign */
.chat-input-wrapper {
    padding: 15px 20px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-group {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f4f7f9;
    border-radius: 30px;
    padding: 5px 15px;
    gap: 10px;
    border: 1px solid #eef2f5;
}

.input-group i {
    color: #8e8e93;
    font-size: 20px;
    cursor: pointer;
}

.input-group input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 5px;
    outline: none;
    font-size: 15px;
    color: #333;
}

.send-btn-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #eef2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.send-btn-circle i {
    color: #8e8e93;
    font-size: 18px;
    transform: rotate(-10deg);
}

.send-btn-circle.active {
    background: var(--chat-user-msg);
}

.send-btn-circle.active i {
    color: white;
}

/* Custom Multi-step Form / Lead form within chat */
.lead-form {
    background: #ffffff;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lead-form input,
.lead-form textarea {
    background: #f8f9fa;
    border: 1px solid #eee;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
}

.lead-form button {
    background: #ff4d4d;
    /* Red from reference */
    color: white;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.lead-form button:hover {
    opacity: 0.9;
}

/* Preference Options */
.preference-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.preference-btn {
    background: #f0f4f8;
    border: 1px solid #d1d9e0;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preference-btn:hover {
    background: var(--chat-primary);
    color: white;
    border-color: var(--chat-primary);
}

.preference-btn i {
    font-size: 14px;
}

.strong-message {
    color: #1a1a1a;
    font-weight: 700;
    border-left: 3px solid var(--chat-primary);
    padding-left: 10px;
    margin-bottom: 12px;
}

/* Mobile Responsive */
@media (max-width: 500px) {
    .safforix-chat-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .safforix-chat-toggle {
        bottom: 20px;
        right: 20px;
    }

    /* Hide Online Message Popup on Mobile */
    .chat-online-msg,
    .chat-online-msg::after {
        display: none !important;
    }
}