/* Alex Chat Widget CSS Variables and Common Styles */
:root {
    --alex-primary: #cc111e;
    --alex-z-index: 9999;
    --alex-offset: 20px;
    --alex-radius: 50%;
    --alex-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --alex-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Dynamic CSS Variables (will be updated by JavaScript) */
.alex-widget-dynamic {
    --alex-primary: var(--alex-primary);
    --alex-z-index: var(--alex-z-index);
}

/* Animations */
@keyframes alex-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes alex-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes alex-wave {
    0%, 60%, 100% {
        transform: rotate(0deg);
    }
    10%, 30% {
        transform: rotate(14deg);
    }
    20% {
        transform: rotate(-8deg);
    }
    40% {
        transform: rotate(-4deg);
    }
    50% {
        transform: rotate(10deg);
    }
}

@keyframes alex-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    50% {
        transform: scale(1.05) translateY(-5px);
    }
    70% {
        transform: scale(0.9) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Loading spinner animation for human support */
@keyframes alex-spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Widget Container */
#alex-widget {
    position: fixed;
    z-index: var(--alex-z-index);
    font-family: var(--alex-font);
}

/* Widget positioning for all states */
#alex-widget .alex-preview {
    position: absolute;
    z-index: var(--alex-z-index);
    font-family: var(--alex-font);
    display: none;
}

#alex-widget .alex-preview[data-state="hidden"] {
    display: none !important;
}

#alex-widget .alex-preview[data-state="welcome"] {
    display: block;
    bottom: 75px;
    right: 0px;
}

#alex-widget .alex-preview[data-state="chat-preview"] {
    display: block;
    bottom: 65px;
    right: 0;
}

#alex-widget .alex-preview[data-state="chat"] {
    display: block;
    bottom: 65px;
    right: 0;
}

/* Position adjustments for left-positioned widgets */
#alex-widget[class*="left"] .alex-preview[data-state="welcome"] {
    left: 20px;
    right: auto;
}

#alex-widget[class*="left"] .alex-preview[data-state="chat-preview"] {
    left: 0;
    right: auto;
}

#alex-widget[class*="top"] .alex-preview[data-state="welcome"] {
    top: 75px;
    bottom: auto;
}

#alex-widget[class*="top"] .alex-preview[data-state="chat-preview"] {
    top: 65px;
    bottom: auto;
}

#alex-widget[class*="bottom"] {
    bottom: var(--alex-offset);
}

#alex-widget[class*="top"] {
    top: var(--alex-offset);
}

#alex-widget[class*="right"] {
    right: var(--alex-offset);
}

#alex-widget[class*="left"] {
    left: var(--alex-offset);
}

/* Main Button */
#alex-button {
    background: var(--alex-primary);
    border: none;
    border-radius: var(--alex-radius);
    width: 60px;
    height: 60px;
    color: white;
    cursor: pointer;
    box-shadow: var(--alex-shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: alex-bounce-in 0.6s ease;
}

#alex-button.expanded {
    border-radius: 50px;
    padding: 14px 24px;
    width: auto;
    gap: 10px;
}

#alex-button .alex-bot-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#alex-button.waving .alex-bot-icon {
    animation: alex-wave 1s ease-in-out;
}

#alex-button .alex-button-text {
    display: none;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

#alex-button.expanded .alex-button-text {
    display: block;
}

#alex-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
    filter: brightness(1.05);
}

#alex-button:active {
    transform: translateY(0);
}

#alex-button svg {
    width: 24px;
    height: 24px;
}

/* Unified Preview Container */
.alex-preview {
    position: absolute;
    z-index: var(--alex-z-index);
    font-family: var(--alex-font);
    display: none;
}

.alex-preview[data-state="hidden"] {
    display: none !important;
}

.alex-preview[data-state="welcome"] {
    display: block;
    bottom: 75px;
    right: 0px;
}

.alex-preview[data-state="chat-preview"] {
    display: block;
    bottom: 65px;
    right: 0;
}

/* Content States */
.alex-preview-content {
    display: none;
}

/* Welcome State Styles */
.alex-state-welcome {
    width: 175px;
    background: white;
    color: #333;
    padding: 16px 32px 16px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 280px;
    animation: alex-bounce-in 0.5s ease;
    font-size: 15px;
    line-height: 1.4;
    border: 1px solid #e0e0e0;
    position: relative;
}

.alex-state-welcome::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.05);
}

/* Position-specific welcome styles */
#alex-widget[class*="left"] .alex-state-welcome {
    left: 20px;
    right: auto;
}

#alex-widget[class*="left"] .alex-state-welcome::after {
    left: 24px;
    right: auto;
}

.alex-state-welcome .alex-close-bubble {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: var(--alex-radius);
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.alex-state-welcome .alex-close-bubble:hover {
    background: #e0e0e0;
}

.alex-welcome-text {
    cursor: pointer;
    font-size: 14px;
}

/* Chat Preview State Styles */
.alex-state-chat-preview {
    width: 100%;
    max-width: 415px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: alex-bounce-in 0.5s ease;
    display: flex;
    flex-direction: column;
}

.alex-preview-header {
    background: var(--alex-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alex-preview-header .alex-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.alex-preview-header .alex-bot-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.alex-preview-header .alex-bot-avatar svg {
    width: 24px;
    height: 24px;
    color: white;
}

.alex-preview-header .alex-bot-info {
    flex: 1;
}

.alex-preview-header .alex-bot-name {
    font-weight: 600;
    font-size: 16px;
}

.alex-preview-header .alex-bot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alex-preview-header .alex-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
}

.alex-preview-header .alex-close-preview {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.alex-preview-header .alex-close-preview:hover {
    background: rgba(255, 255, 255, 0.3);
}

.alex-preview-body {
    background: #f8f9fa;
    flex: 1;
}

.alex-preview-time {
    text-align: center;
    color: #666;
    font-size: 12px;
    margin-bottom: 16px;
}

.alex-preview-message {
    padding: 20px;
    display: flex;
    gap: 12px;
}

.alex-preview-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--alex-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.alex-preview-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.alex-preview-avatar svg {
    width: 20px;
    height: 20px;
}

.alex-preview-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.alex-preview-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.alex-preview-option {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
}

.alex-preview-option:hover {
    background: var(--alex-primary);
    color: white;
    border-color: var(--alex-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alex-preview-footer {
    padding: 12px;
    background: white;
    text-align: center;
    font-size: 11px;
    color: #999;
    border-top: 1px solid #f0f0f0;
}

.alex-user-message {
    justify-content: flex-end;
    margin-bottom: 16px;
}

.alex-user-response {
    background: var(--alex-primary);
    color: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 80%;
}

.alex-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px;
    background: white;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
}

.alex-preview-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 8px 12px;
    background: transparent;
}

.alex-preview-input::placeholder {
    color: #999;
}

.alex-preview-send-btn {
    background: var(--alex-primary);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s ease;
}

.alex-preview-send-btn:hover {
    filter: brightness(1.1);
}

/* Notification Badge */
.alex-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: alex-pulse 2s infinite;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
}

/* Loading */
#alex-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
}

.alex-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--alex-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #alex-button {
        width: 56px;
        height: 56px;
    }

    #alex-button .alex-bot-icon {
        width: 28px;
        height: 28px;
    }

    #alex-widget .alex-preview[data-state="welcome"] {
        bottom: 75px;
    }

    /*.alex-state-welcome {*/
    /*    max-width: calc(100vw - 100px);*/
    /*}*/

    #alex-widget[class*="left"] .alex-preview[data-state="welcome"] {
        left: 20px;
        right: auto;
    }

    #alex-widget .alex-preview[data-state="chat-preview"] {
        bottom: 65px;
    }

    .alex-state-chat-preview {
        width: 360px;
        max-width: calc(100vw - 40px);
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .alex-state-chat-preview {
        width: calc(100vw - 40px);
        max-width: 360px;
    }
}

/* Chat Interface Styles */
.alex-chat-interface {
    font-family: var(--alex-font);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 415px;
    height: 620px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.alex-chat-header {
    background: var(--alex-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alex-chat-header .alex-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.alex-chat-header .alex-bot-avatar svg {
    color: white;
}

.alex-chat-header .alex-bot-info {
    flex: 1;
}

.alex-chat-header .alex-bot-name {
    font-weight: 600;
    font-size: 16px;
}

.alex-chat-header .alex-bot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alex-chat-header .alex-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
}

.alex-chat-header .alex-status-dot.alex-status-online {
    background: #4ade80;
}

.alex-chat-header .alex-status-dot.alex-status-connecting {
    background: #facc15;
}

.alex-chat-header .alex-status-dot.alex-status-error {
    background: #ef4444;
}

.alex-header-actions {
    display: flex;
    gap: 8px;
}

.alex-header-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}

.alex-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.alex-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8f9fa;
    min-height: 0;
}

/* Session choice view */
.alex-session-choice {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.alex-chat-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

/* User Info Form */
.alex-user-form {
    padding: 20px;
}

.alex-user-form h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.alex-form-group {
    margin-bottom: 16px;
}

.alex-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.alex-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.alex-form-group input:focus {
    border-color: var(--alex-primary);
    box-shadow: 0 0 0 3px rgba(204, 17, 30, 0.1);
}

.alex-form-group input::placeholder {
    color: #9ca3af;
}

.alex-form-group input.alex-input-error {
    border-color: #ef4444;
}

.alex-error-text {
    display: block;
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

.alex-form-title {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.alex-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.alex-form-actions button {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.alex-btn-primary {
    background: var(--alex-primary);
    color: white;
    border: none;
}

.alex-btn-primary:hover {
    filter: brightness(1.1);
}

.alex-btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.alex-btn-secondary:hover {
    background: #f3f4f6;
}

/* Chat Input */
.alex-chat-input,
.alex-chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
}

.alex-chat-input input,
.alex-chat-input-container input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    padding: 8px 0;
}

.alex-chat-input input::placeholder,
.alex-chat-input-container input::placeholder {
    color: #9ca3af;
}

.alex-send-btn {
    background: var(--alex-primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.alex-send-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

.alex-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Help Menu */
.alex-help-menu {
    padding: 20px;
}

.alex-help-menu h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.alex-help-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alex-help-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 14px;
    color: #333;
}

.alex-help-option:hover {
    background: var(--alex-primary);
    color: white;
    border-color: var(--alex-primary);
}

.alex-help-back {
    margin-top: 16px;
    padding: 10px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
}

.alex-help-back:hover {
    color: #374151;
}

/* Interactive Message Options */
.alex-message-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.alex-option-button {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--alex-primary);
    border-radius: 8px;
    color: var(--alex-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.alex-option-button:hover {
    background: var(--alex-primary);
    color: white;
}

.alex-option-button:active {
    transform: scale(0.98);
}

.alex-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.alex-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.alex-chat-messages::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 3px;
}

/* Message List */
.alex-message-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Styles */
.alex-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.alex-message:last-child {
    margin-bottom: 0;
}

.alex-message-user {
    align-self: flex-end;
    align-items: flex-end;
}

.alex-message-bot {
    align-self: flex-start;
    align-items: flex-start;
}

.alex-message-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.alex-message-user .alex-message-content {
    background: var(--alex-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.alex-message-bot .alex-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Agent messages - human support agent (same style as bot) */
.alex-message-agent {
    align-self: flex-start;
    align-items: flex-start;
}

.alex-message-agent .alex-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Sender name for agent messages */
.alex-message-sender {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 4px;
}

/* System messages */
.alex-message-system {
    align-self: center;
    text-align: center;
}

.alex-message-system .alex-message-content {
    background: #f3f4f6;
    color: #6b7280;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 12px;
}

/* Image message */
.alex-message-image img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    cursor: pointer;
}

/* File message */
.alex-file-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.alex-file-link:hover {
    opacity: 0.8;
}

.alex-file-icon {
    flex-shrink: 0;
}

.alex-file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.alex-file-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alex-file-size {
    font-size: 11px;
    opacity: 0.7;
}

.alex-message-time {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Typing Indicator */
.alex-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.alex-typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: alex-typing-pulse 1.4s infinite ease-in-out;
}

.alex-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.alex-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.alex-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Input focus styles */
#alex-chat-input:focus {
    border-color: var(--alex-primary);
    box-shadow: 0 0 0 3px rgba(204, 17, 30, 0.1);
}

/* Send button hover */
#alex-chat-send:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

#alex-chat-send:active {
    transform: scale(0.95);
}

/* Human support button styles */
.alex-human-support-offer button:hover {
    filter: brightness(1.1) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Additional pulse animation for typing dots */
@keyframes alex-typing-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* System message styles */
.alex-message-system {
    text-align: center;
}

.alex-message-system > div {
    display: inline-block;
}

/* Body styling for iframe */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: var(--alex-font);
    overflow: hidden;
}

#root {
    width: 100%;
    height: 100%;
}

/* Disable animations when .no-animation class is present */
#alex-widget.no-animation #alex-button,
#alex-widget.no-animation .alex-state-welcome,
#alex-widget.no-animation .alex-state-chat-preview,
#alex-widget.no-animation .alex-chat-interface {
    animation: none !important;
}

/* Embedded panel - raw content for iframe (no decoration, fills 100%) */
.alex-panel-embedded {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

.alex-panel-embedded .alex-preview {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

.alex-panel-embedded .alex-state-chat-preview,
.alex-panel-embedded .alex-chat-interface {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    animation: none;
    display: flex;
    flex-direction: column;
}

.alex-panel-embedded .alex-preview-body,
.alex-panel-embedded .alex-chat-body {
    flex: 1;
    overflow-y: auto;
}

.alex-panel-embedded .alex-preview-footer {
    flex-shrink: 0;
}

/* Standalone panel - positioned with decoration */
.alex-panel-standalone {
    position: absolute;
    bottom: 65px;
    right: 0;
}

.alex-panel-standalone .alex-preview {
    position: static;
    display: block;
}

.alex-panel-standalone .alex-state-chat-preview,
.alex-panel-standalone .alex-chat-interface {
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: alex-bounce-in 0.5s ease;
}

/* ========================================
   Install Page Styles
   ======================================== */
.alex-install-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--alex-primary) 0%, #8b0d16 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.alex-install-page .alex-preview {
    position: static;
    display: block;
}

.alex-install-page .alex-preview[data-state="install"] {
    display: block;
}

.alex-install-container {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: none;
    animation: alex-bounce-in 0.5s ease;
}

.alex-install-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

.alex-install-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.alex-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.alex-install-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.alex-install-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--alex-primary);
    background: rgba(204, 17, 30, 0.1);
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alex-install-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
}

.alex-install-subtitle {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.alex-install-body .alex-form-group {
    width: 100%;
    text-align: left;
}

.alex-install-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.alex-install-qr-label {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

.alex-install-qr-code {
    padding: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alex-install-qr-code img {
    display: block;
    border-radius: 8px;
}

.alex-install-actions {
    width: 100%;
    margin-top: 8px;
}

.alex-btn-full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.alex-btn-full svg {
    flex-shrink: 0;
}

.alex-install-note {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.6;
    padding: 0 8px;
}

.alex-install-note p {
    margin: 0;
}

.alex-install-note strong {
    color: #374151;
}

.alex-install-footer {
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
}

.alex-install-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #9ca3af;
}

/* Mobile responsive for install page */
@media (max-width: 480px) {
    .alex-install-page {
        padding: 16px;
    }

    .alex-install-container {
        max-width: 100%;
    }

    .alex-install-body {
        padding: 20px 16px;
    }

    .alex-install-qr-code img {
        width: 160px;
        height: 160px;
    }
}