:root {
    --chatrix-primary: #25D366;
    --chatrix-primary-dark: #075E54;
    --chatrix-primary-light: #128C7E;
    --chatrix-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

#chatrix-chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: 'Inter', sans-serif;
}

#chatrix-floating-btn {
    width: 60px;
    height: 60px;
    background: var(--chatrix-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chatrix-floating-btn:hover {
    transform: scale(1.1) rotate(5deg);
}

#chatrix-floating-btn img {
    width: 32px;
    height: 32px;
}

.pulse {
    animation: chatrix-pulse 2s infinite;
}

@keyframes chatrix-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0px var(--chatrix-primary);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(0, 0, 0, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0px rgba(0, 0, 0, 0);
    }
}

#chatrix-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    min-width: 270px;
    border-radius: 24px;
    box-shadow: var(--chatrix-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
    background: #fff;
}

#chatrix-chat-window.hidden {
    opacity: 0;
    transform: translateY(30px) scale(0.8) rotate(2deg);
    pointer-events: none;
}

.chatrix-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    background: #ffffff;
}

.chatrix-screen.hidden {
    transform: translateX(100%);
    pointer-events: none;
    opacity: 0;
}

/* Home Screen */
#chatrix-screen-home {
    color: white;
    padding: 30px 20px;
    box-sizing: border-box;
}

.chatrix-home-logo-wrap {
    margin-bottom: 20px;
}

.chatrix-home-logo-wrap img {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 5px;
}

.chatrix-home-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chatrix-home-card h2 {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.chatrix-home-card p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0 0 20px 0;
}

.chatrix-avatar-row {
    display: flex;
    margin-left: 10px;
}

.chatrix-avatar-row img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--chatrix-primary-dark);
    margin-left: -10px;
    background: #fff;
}

.chatrix-home-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatrix-action-card {
    background: white;
    color: #111;
    border-radius: 16px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.chatrix-action-card:hover {
    transform: translateY(-2px);
}

.chatrix-action-icon {
    font-size: 24px;
}

.chatrix-action-text {
    display: flex;
    flex-direction: column;
}

.chatrix-action-text strong {
    font-size: 15px;
    font-weight: 600;
}

.chatrix-action-text span {
    font-size: 12px;
    color: #666;
}

/* Alt Header Screens */
.chatrix-screen-alt-bg {
    background: #f8f9fa !important;
}

.chatrix-chat-header-alt {
    background: linear-gradient(135deg, var(--chatrix-primary) 0%, var(--chatrix-primary-dark) 100%);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    border-radius: 0 0 20px 20px;
}

.chatrix-back-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
}

.chatrix-alt-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    padding: 4px;
}

.chatrix-alt-titles h3 {
    margin: 0;
    font-size: 16px;
}

.chatrix-alt-titles span {
    font-size: 11px;
    opacity: 0.8;
}

/* Form Screen */
.chatrix-form-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.chatrix-form-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.chatrix-form-desc {
    font-size: 14px;
    color: #444;
    text-align: center;
    margin-bottom: 20px;
}

.chatrix-input-group {
    margin-bottom: 15px;
}

.chatrix-input-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

.chatrix-input-group input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
}

.chatrix-btn-outline {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--chatrix-primary);
    background: transparent !important;
    color: var(--chatrix-primary) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s;
}

.chatrix-btn-outline:hover {
    background: var(--chatrix-primary) !important;
    color: white !important;
}

/* Chat Room */
.chatrix-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8f9fa;
}

#chatrix-chat-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatrix-message {
    padding: 10px 14px;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 18px;
    word-wrap: break-word;
    animation: chatrix-slide-in 0.3s ease-out;
}

.chatrix-bot {
    background: var(--chatrix-primary);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chatrix-user {
    background: white;
    color: #111;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Chat Footer Box */
.chatrix-chat-footer {
    background: white;
    padding: 10px 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.chatrix-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f2f5;
    border-radius: 24px;
    padding: 6px 15px;
}

.chatrix-attach-btn {
    cursor: pointer;
    font-size: 18px;
    opacity: 0.6;
}

.chatrix-mic-btn {
    background: transparent;
    border: none;
    font-size: 18px !important;
    cursor: pointer !important;
    opacity: 0.6;
    padding: 3px 6px !important;
}

.chatrix-mic-btn.recording {
    color: red;
    opacity: 1;
    animation: chatrix-pulse-mic 1s infinite;
}

@keyframes chatrix-pulse-mic {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

#chatrix-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    outline: none;
    font-size: 14px;
}

#chatrix-send {
    background: var(--chatrix-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: unset !important;
}

#chatrix-send svg {
    width: 18px;
    height: 18px;
    fill: white;
    margin-left: 2px;
}

/* Media handling */
.chatrix-message img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
}

.chatrix-message audio {
    width: 250px;
    max-width: 100%;
    height: 40px;
    outline: none;
}

@keyframes chatrix-slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Information Card */
.chatrix-info-card {
    background: white;
    padding: 20px 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #444;
    border: 1px solid #eee;
    text-align: center;
    width: 100%;
    align-self: center;
    box-sizing: border-box;
}

.chatrix-info-badge {
    background: #f4a261;
    padding: 6px 16px;
    border-radius: 8px;
    color: white;
    font-size: 13px;
}

.chatrix-info-body {
    margin-top: 12px;
}

.chatrix-info-label {
    margin-bottom: 5px;
    color: #888;
}

.chatrix-info-value {
    font-weight: 600;
    color: #111;
    margin-bottom: 12px;
    font-size: 15px;
}

/* First child full width */
#chatrix-chat-content>*:first-child {
    max-width: 100% !important;
    width: 100% !important;
}

#chatrix-chat-content>*:first-child .chatrix-user {
    width: 100% !important;
}

/* Image Lightbox */
#chatrix-image-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#chatrix-image-overlay.active {
    display: flex;
    opacity: 1;
}

#chatrix-image-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
}

@media screen and (max-width: 480px) {
    #chatrix-chat-container {
        bottom: 20px;
        right: 20px;
    }
    #chatrix-chat-window {
        width: calc(100vw - 40px);
        min-width: 270px;
        bottom: 70px;
    }
}