/**
 * AI Chat Widget - Premium Styling
 * 
 * Modern, attractive chat widget with smooth animations
 * Compatible with Bootstrap 5 and MiraLife branding
 * 
 * COLOR SCHEME (MiraLife Premium):
 * - Primary: #1F3D3A (Deep Forest Green)
 * - Accent: #4A9B7C (Fresh Mint Green)
 * - Secondary: #E8F4F8 (Light Blue)
 * - Gradient: Forest Green → Teal
 * - Text: #FFFFFF (White)
 * 
 * @author MiraLife Design Team
 * @version 2.0.0
 */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

.miralife-chat-widget,
.miralife-chat-widget * {
    margin: 0;
    padding: 0;
    border: none;
    box-sizing: border-box;
}

.miralife-chat-widget {
    --primary-color: #1F3D3A;
    --primary-gradient: linear-gradient(135deg, #1F3D3A 0%, #2D5A54 50%, #4A9B7C 100%);
    --primary-dark: #153A38;
    --accent-color: #4A9B7C;
    --secondary-accent: #5DADE2;
    --primary-light: #E8F4F8;
    --text-color: #FFFFFF;
    --text-dark: #333333;
    --error-color: #FF6B6B;
    --success-color: #4CAF50;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 40px rgba(31, 61, 58, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: "Source Sans 3", "Segoe UI", "Inter", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   WIDGET POSITIONING
   ======================================== */

.miralife-chat-widget {
    position: fixed;
    z-index: 9999;
    font-size: 14px;
}

.miralife-chat-bottom-right {
    bottom: 24px;
    right: 24px;
}

.miralife-chat-bottom-left {
    bottom: 24px;
    left: 24px;
}

.miralife-chat-top-right {
    top: 24px;
    right: 24px;
}

.miralife-chat-top-left {
    top: 24px;
    left: 24px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .miralife-chat-widget {
        bottom: 16px !important;
        right: 16px !important;
        left: auto !important;
        top: auto !important;
    }
}

/* ========================================
   TOGGLE BUTTON (Floating Button)
   ======================================== */

.miralife-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    position: relative;
    border: none;
    font-size: 24px;
    line-height: 1;
    font-weight: 600;
    overflow: hidden;
}

.miralife-chat-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transition: var(--transition);
}

.miralife-chat-toggle:hover {
    transform: scale(1.12) rotate(5deg);
    box-shadow: 0 16px 48px rgba(31, 61, 58, 0.25);
    background: linear-gradient(135deg, #2D5A54 0%, #4A9B7C 50%, #5DADE2 100%);
}

.miralife-chat-toggle:hover::before {
    left: 100%;
}

.miralife-chat-toggle:active {
    transform: scale(0.95);
}

.miralife-chat-toggle.active {
    background: linear-gradient(135deg, #4A9B7C 0%, #5DADE2 100%);
    animation: pulse-glow 2s infinite;
}

.miralife-chat-toggle svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
    z-index: 1;
}

/* Badge for unread messages */
.miralife-chat-toggle .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 3px solid white;
    visibility: hidden;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.miralife-chat-toggle:hover .badge {
    visibility: visible;
    animation: bounce-in 0.4s ease;
}

@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 12px 40px rgba(31, 61, 58, 0.15); }
    50% { box-shadow: 0 12px 50px rgba(74, 155, 124, 0.3); }
}

/* ========================================
   CHAT CONTAINER
   ======================================== */

.miralife-chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    max-height: min(650px, calc(100vh - 120px));
    background: #FFFFFF;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(31, 61, 58, 0.08);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Positions for different placements */
.miralife-chat-bottom-left .miralife-chat-container {
    right: auto;
    left: 0;
}

.miralife-chat-top-right .miralife-chat-container {
    bottom: auto;
    top: 80px;
    animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.miralife-chat-top-left .miralife-chat-container {
    bottom: auto;
    top: 80px;
    right: auto;
    left: 0;
    animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .miralife-chat-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        bottom: 70px;
        right: 10px;
        left: auto;
        z-index: 10000;
        border-radius: var(--border-radius);
    }
    
    .miralife-chat-bottom-left .miralife-chat-container {
        left: 10px;
    }
}

/* ========================================
   HEADER
   ======================================== */

.miralife-chat-header {
    background: var(--primary-gradient);
    color: var(--text-color);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

.miralife-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.miralife-chat-header h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
	color: #FFF;
}

.miralife-chat-header h3::before {
    content: '🤖';
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.miralife-chat-header-actions {
    display: flex;
    gap: 8px;
}

.miralife-chat-minimize,
.miralife-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.miralife-chat-minimize:hover,
.miralife-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* ========================================
   MESSAGES AREA
   ======================================== */

.miralife-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FBFC 100%);
}

/* Smooth scrolling */
.miralife-chat-messages {
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.miralife-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.miralife-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.miralife-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(31, 61, 58, 0.2);
    border-radius: 3px;
}

.miralife-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(31, 61, 58, 0.4);
}

/* ========================================
   MESSAGE STYLES
   ======================================== */

.miralife-chat-message {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.miralife-chat-message.user {
    justify-content: flex-end;
}

.miralife-chat-message.assistant {
    justify-content: flex-start;
}

.miralife-chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: var(--shadow-sm);
}

.miralife-chat-message.user .miralife-chat-bubble {
    background: var(--primary-gradient);
    color: var(--text-color);
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.miralife-chat-message.assistant .miralife-chat-bubble {
    background: #F0F4F8;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    border-left: 3px solid var(--accent-color);
    font-weight: 500;
}

.miralife-chat-message.assistant.error .miralife-chat-bubble {
    background: #FFF5F5;
    color: #C53030;
    border-left: 3px solid var(--error-color);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.15);
}

/* ========================================
   WELCOME MESSAGE
   ======================================== */

.miralife-chat-welcome {
    background: linear-gradient(135deg, #E8F4F8 0%, rgba(74, 155, 124, 0.05) 100%);
    padding: 18px;
    border-radius: var(--border-radius);
    color: var(--text-dark);
    border: 1px solid rgba(74, 155, 124, 0.15);
}

.miralife-chat-welcome h4 {
    font-size: 16px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.miralife-chat-welcome p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    color: #222;
    font-weight: 500;
}

.miralife-chat-welcome .disclaimer {
    background: linear-gradient(135deg, #FFF8DC 0%, #FFEDD5 100%);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid #FF9800;
    font-size: 12px;
    margin-bottom: 12px;
    color: #8B6F47;
    line-height: 1.5;
}

.miralife-chat-welcome .disclaimer strong {
    display: block;
    margin-bottom: 4px;
    color: #FF6B00;
}

/* Quick action buttons */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action {
    background: var(--primary-gradient);
    color: var(--text-color);
    border: none;
    padding: 11px 14px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-action::before {
    content: '→';
    font-size: 16px;
    opacity: 0.7;
    transition: var(--transition);
}

.quick-action:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.quick-action:hover::before {
    transform: translateX(2px);
    opacity: 1;
}

/* ========================================
   TYPING INDICATOR
   ======================================== */

.miralife-chat-typing {
    display: flex;
    justify-content: flex-start;
    padding: 10px 16px;
    gap: 4px;
    align-items: center;
}

.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1F3D3A 0%, #4A9B7C 100%);
    animation: typing 1.4s infinite;
    box-shadow: 0 2px 4px rgba(31, 61, 58, 0.1);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* ========================================
   INPUT AREA
   ======================================== */

.miralife-chat-input-area {
    padding: 14px;
    border-top: 1px solid rgba(31, 61, 58, 0.08);
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FBFC 100%);
    flex-shrink: 0;
}

.miralife-chat-form {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.miralife-chat-input {
    flex: 1;
    border: 1.5px solid #E0E7F0;
    border-radius: 24px;
    padding: 11px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    background: #FFFFFF;
    color: #1a1a1a;
    font-weight: 500;
}

.miralife-chat-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 155, 124, 0.1);
    background: #FAFBFC;
}

.miralife-chat-input::placeholder {
    color: #A0AEC0;
}

.miralife-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: var(--text-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.miralife-chat-send:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg);
}

.miralife-chat-send:active {
    transform: scale(0.94);
}

.miralife-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.miralife-chat-send svg {
    width: 18px;
    height: 18px;
}

.miralife-chat-footer-text {
    font-size: 11px;
    color: #999;
    margin: 0;
    text-align: center;
    padding-top: 6px;
}

.miralife-chat-footer-text a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.miralife-chat-footer-text a:hover {
    text-decoration: underline;
}

/* ========================================
   ACCESSIBILITY & FOCUS STATES
   ======================================== */

.miralife-chat-widget button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.miralife-chat-container.miralife-chat-focused {
    box-shadow: 0 16px 48px rgba(31, 61, 58, 0.2);
}

/* ========================================
   ANIMATIONS & EFFECTS
   ======================================== */

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .miralife-chat-widget {
        display: none;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

@media (prefers-color-scheme: dark) {
    .miralife-chat-container {
        background-color: #1a1a1a;
        border-color: #333;
    }
    
    .miralife-chat-messages {
        background: linear-gradient(180deg, #1a1a1a 0%, #222 100%);
    }
    
    .miralife-chat-message.assistant .miralife-chat-bubble {
        background-color: #2a2a2a;
        color: #f0f0f0;
        border-left: 3px solid #4A9B7C;
        font-weight: 500;
    }
    
    .miralife-chat-input {
        background-color: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .miralife-chat-input:focus {
        background-color: #333;
        border-color: #4A9B7C;
    }
    
    .miralife-chat-welcome {
        background: linear-gradient(135deg, rgba(74, 155, 124, 0.1) 0%, rgba(74, 155, 124, 0.05) 100%);
        color: #e0e0e0;
        border-color: rgba(74, 155, 124, 0.2);
    }
    
    .miralife-chat-input-area {
        background: linear-gradient(180deg, #1a1a1a 0%, #222 100%);
    }
}

/* ========================================
   WIDGET POSITIONING
   ======================================== */

.miralife-chat-widget {
    position: fixed;
    z-index: 9999;
    font-size: 14px;
}

.miralife-chat-bottom-right {
    bottom: 20px;
    right: 20px;
}

.miralife-chat-bottom-left {
    bottom: 20px;
    left: 20px;
}

.miralife-chat-top-right {
    top: 20px;
    right: 20px;
}

.miralife-chat-top-left {
    top: 20px;
    left: 20px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .miralife-chat-widget {
        bottom: 10px !important;
        right: 10px !important;
        left: auto !important;
        top: auto !important;
    }
}

/* ========================================
   TOGGLE BUTTON (Floating Button)
   ======================================== */

.miralife-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    border: none;
    font-size: 24px;
    line-height: 1;
}

.miralife-chat-toggle:hover {
    background-color: var(--primary-dark);
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.miralife-chat-toggle:active {
    transform: scale(0.95);
}

.miralife-chat-toggle.active {
    background-color: var(--primary-color);
}

.miralife-chat-toggle svg {
    width: 28px;
    height: 28px;
}

/* Badge for unread messages */
.miralife-chat-toggle .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    visibility: hidden;
}

.miralife-chat-toggle:hover .badge {
    visibility: visible;
}

/* ========================================
   CHAT CONTAINER
   ======================================== */

.miralife-chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    max-height: min(600px, calc(100vh - 120px));
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Positions for different placements */
.miralife-chat-bottom-left .miralife-chat-container {
    right: auto;
    left: 0;
}

.miralife-chat-top-right .miralife-chat-container {
    bottom: auto;
    top: 80px;
    animation: slideDown 0.3s ease;
}

.miralife-chat-top-left .miralife-chat-container {
    bottom: auto;
    top: 80px;
    right: auto;
    left: 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .miralife-chat-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        bottom: 70px;
        right: 10px;
        left: auto;
        z-index: 10000;
    }
    
    .miralife-chat-bottom-left .miralife-chat-container {
        left: 10px;
    }
}

/* ========================================
   HEADER
   ======================================== */

.miralife-chat-header {
    background-color: var(--primary-color);
    color: var(--text-color);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 2px solid var(--primary-dark);
}

.miralife-chat-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.miralife-chat-header h3::before {
    content: '🤖';
    font-size: 18px;
}

.miralife-chat-header-actions {
    display: flex;
    gap: 8px;
}

.miralife-chat-minimize,
.miralife-chat-close {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.miralife-chat-minimize:hover,
.miralife-chat-close:hover {
    background-color: var(--primary-dark);
}

/* ========================================
   MESSAGES AREA
   ======================================== */

.miralife-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f9f9f9;
}

/* Smooth scrolling */
.miralife-chat-messages {
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.miralife-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.miralife-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.miralife-chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.miralife-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   MESSAGE STYLES
   ======================================== */

.miralife-chat-message {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.miralife-chat-message.user {
    justify-content: flex-end;
}

.miralife-chat-message.assistant {
    justify-content: flex-start;
}

.miralife-chat-bubble {
    max-width: 100%;
    padding: 12px 14px;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.miralife-chat-message.user .miralife-chat-bubble {
    background-color: var(--primary-color);
    color: var(--text-color);
    border-bottom-right-radius: 4px;
}

.miralife-chat-message.assistant .miralife-chat-bubble {
    background-color: #e9ecef;
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.miralife-chat-message.assistant.error .miralife-chat-bubble {
    background-color: #ffe9e9;
    color: #c00;
    border-left: 3px solid var(--accent-color);
}

/* ========================================
   WELCOME MESSAGE
   ======================================== */

.miralife-chat-welcome {
    background: linear-gradient(135deg, var(--primary-light) 0%, #f0f8fb 100%);
    padding: 10px;
    border-radius: var(--border-radius);
    color: var(--text-dark);
}

.miralife-chat-welcome h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.miralife-chat-welcome p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    color: #555;
}

.miralife-chat-welcome .disclaimer {
    background-color: #fff3cd;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #ff9800;
    font-size: 12px;
    margin-bottom: 12px;
    color: #856404;
}

.miralife-chat-welcome .disclaimer strong {
    display: block;
    margin-bottom: 4px;
}

/* Quick action buttons */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: none;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    transition: var(--transition);
}

.quick-action:hover {
    background-color: var(--primary-dark);
    transform: translateX(2px);
}

/* ========================================
   TYPING INDICATOR
   ======================================== */

.miralife-chat-typing {
    display: flex;
    justify-content: flex-start;
    padding: 8px 16px;
    gap: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #888;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.7;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* ========================================
   INPUT AREA
   ======================================== */

.miralife-chat-input-area {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    background-color: white;
    flex-shrink: 0;
}

.miralife-chat-form {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.miralife-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.miralife-chat-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 61, 58, 0.1);
}

.miralife-chat-input::placeholder {
    color: #999;
}

.miralife-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--text-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.miralife-chat-send:hover {
    background-color: var(--primary-dark);
    transform: scale(1.05);
}

.miralife-chat-send:active {
    transform: scale(0.95);
}

.miralife-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.miralife-chat-footer-text {
    font-size: 11px;
    color: #999;
    margin: 0;
    text-align: center;
}

.miralife-chat-footer-text a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.miralife-chat-footer-text a:hover {
    text-decoration: underline;
}

/* ========================================
   ACCESSIBILITY & FOCUS STATES
   ======================================== */

.miralife-chat-widget button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.miralife-chat-container.miralife-chat-focused {
    box-shadow: 0 15px 40px rgba(31, 61, 58, 0.2);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.miralife-chat-toggle.active {
    animation: pulse 2s infinite;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .miralife-chat-widget {
        display: none;
    }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .miralife-chat-container {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    .miralife-chat-messages {
        background-color: #2a2a2a;
    }
    
    .miralife-chat-message.assistant .miralife-chat-bubble {
        background-color: #333;
        color: #e0e0e0;
    }
    
    .miralife-chat-input {
        background-color: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .miralife-chat-welcome {
        background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
        color: #e0e0e0;
    }
}

/* ========================================
   THEME OVERRIDES (Light / Dark)
   ======================================== */

/* Force light theme regardless of OS */
.miralife-chat-widget[data-theme="light"] .miralife-chat-container {
    background-color: #FFFFFF;
    border-color: rgba(31, 61, 58, 0.08);
}

.miralife-chat-widget[data-theme="light"] .miralife-chat-messages {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FBFC 100%);
}

.miralife-chat-widget[data-theme="light"] .miralife-chat-message.assistant .miralife-chat-bubble {
    background-color: #F0F4F8;
    color: #1a1a1a;
}

.miralife-chat-widget[data-theme="light"] .miralife-chat-input {
    background-color: #FFFFFF;
    color: #1a1a1a;
    border-color: #E0E7F0;
}

.miralife-chat-widget[data-theme="light"] .miralife-chat-welcome {
    background: linear-gradient(135deg, #E8F4F8 0%, #F8FBFC 100%);
    color: #1a1a1a;
    border-color: rgba(31, 61, 58, 0.08);
}

.miralife-chat-widget[data-theme="light"] .miralife-chat-input-area {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FBFC 100%);
}

/* Force dark theme regardless of OS */
.miralife-chat-widget[data-theme="dark"] .miralife-chat-container {
    background-color: #1a1a1a;
    border-color: #333;
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-messages {
    background: linear-gradient(180deg, #1a1a1a 0%, #222 100%);
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-message.assistant .miralife-chat-bubble {
    background-color: #2a2a2a;
    color: #f0f0f0;
    border-left: 3px solid #4A9B7C;
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-input {
    background-color: #2a2a2a;
    color: #f0f0f0;
    border-color: #444;
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-input:focus {
    background-color: #333;
    border-color: #4A9B7C;
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-welcome {
    background: linear-gradient(135deg, rgba(74, 155, 124, 0.1) 0%, rgba(74, 155, 124, 0.05) 100%);
    color: #f0f0f0;
    border-color: rgba(74, 155, 124, 0.2);
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-input-area {
    background: linear-gradient(180deg, #1a1a1a 0%, #222 100%);
}

/* OS preference fallback (applies only if light is not forced) */
@media (prefers-color-scheme: dark) {
    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-container {
        background-color: #1a1a1a;
        border-color: #333;
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-messages {
        background: linear-gradient(180deg, #1a1a1a 0%, #222 100%);
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-messages .miralife-chat-welcome h4{
		  background: transparent;
		  -webkit-text-fill-color: #FF6B00;
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-messages .miralife-chat-welcome p {
        color: #FF6B00;
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-message.assistant .miralife-chat-bubble {
        background-color: #2a2a2a;
        color: #f0f0f0;
        border-left: 3px solid #4A9B7C;
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-input {
        background-color: #2a2a2a;
        color: #f0f0f0;
        border-color: #444;
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-input:focus {
        background-color: #333;
        border-color: #4A9B7C;
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-welcome {
        background: linear-gradient(135deg, rgba(74, 155, 124, 0.1) 0%, rgba(74, 155, 124, 0.05) 100%);
        color: #f0f0f0;
        border-color: rgba(74, 155, 124, 0.2);
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-input-area {
        background: linear-gradient(180deg, #1a1a1a 0%, #222 100%);
    }
}

/* ========================================
   ROBUST VISUAL SYSTEM
   ======================================== */

.miralife-chat-widget {
    --surface-1: #FFFFFF;
    --surface-2: #F6FAFB;
    --surface-3: #EEF5F6;
    --stroke-color: rgba(31, 61, 58, 0.12);
    --shadow-card: 0 12px 30px rgba(31, 61, 58, 0.12);
    --shadow-float: 0 16px 50px rgba(31, 61, 58, 0.2);
    --glow-ring: 0 0 0 6px rgba(74, 155, 124, 0.15);
}

.miralife-chat-container {
    background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-2) 100%);
    border: 1px solid var(--stroke-color);
    box-shadow: var(--shadow-card);
}

.miralife-chat-header {
    background: linear-gradient(135deg, #1F3D3A 0%, #2D5A54 45%, #4A9B7C 100%);
    position: relative;
}

.miralife-chat-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18) 0%, transparent 45%);
    pointer-events: none;
}

.miralife-chat-messages {
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(246, 250, 251, 0.9) 100%),
        repeating-linear-gradient(135deg, rgba(31, 61, 58, 0.04) 0 10px, transparent 10px 20px);
}

.miralife-chat-bubble {
    border: 1px solid rgba(31, 61, 58, 0.08);
    box-shadow: 0 6px 16px rgba(31, 61, 58, 0.08);
}

.miralife-chat-message.user .miralife-chat-bubble {
    background: linear-gradient(135deg, #1F3D3A 0%, #2D5A54 50%, #4A9B7C 100%);
    box-shadow: 0 10px 20px rgba(31, 61, 58, 0.2);
}

.miralife-chat-message.assistant .miralife-chat-bubble {
    background: linear-gradient(180deg, #FFFFFF 0%, #F1F6F7 100%);
    border-left: 4px solid var(--accent-color);
}

.miralife-chat-welcome {
    background: linear-gradient(135deg, #FFFFFF 0%, #F2F7F8 60%, #EAF4F2 100%);
    border: 1px solid rgba(74, 155, 124, 0.18);
    box-shadow: 0 8px 20px rgba(31, 61, 58, 0.08);
}

.miralife-chat-input-area {
    background: linear-gradient(180deg, #FFFFFF 0%, #F6FAFB 100%);
    border-top: 1px solid var(--stroke-color);
}

.miralife-chat-form {
    background: transparent;
    padding: 6px;
    border-radius: 999px;
    border: 1px solid rgba(31, 61, 58, 0.12);
}

.miralife-chat-input {
    background: transparent;
    border: none;
    padding: 10px 14px;
}

.miralife-chat-send {
    box-shadow: 0 8px 16px rgba(31, 61, 58, 0.18);
}

.miralife-chat-toggle {
    box-shadow: var(--shadow-float);
}

.miralife-chat-toggle::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(74, 155, 124, 0.35);
    opacity: 0;
    transition: var(--transition);
}

.miralife-chat-toggle:hover::after {
    opacity: 1;
    box-shadow: var(--glow-ring);
}

/* Robust dark theme variables */
.miralife-chat-widget[data-theme="dark"] {
    --surface-1: #1A1C1D;
    --surface-2: #1F2223;
    --surface-3: #242829;
    --stroke-color: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 12px 30px rgba(0, 0, 0, 0.35);
    --shadow-float: 0 18px 60px rgba(0, 0, 0, 0.45);
    --glow-ring: 0 0 0 6px rgba(74, 155, 124, 0.2);
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-messages {
    background-image:
        linear-gradient(180deg, rgba(26, 28, 29, 0.98) 0%, rgba(31, 34, 35, 0.98) 100%),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 10px, transparent 10px 20px);
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-message.assistant .miralife-chat-bubble {
    background: linear-gradient(180deg, #222526 0%, #2A2E2F 100%);
    border-left: 4px solid #4A9B7C;
}

.miralife-chat-widget[data-theme="dark"] .miralife-chat-welcome {
    background: linear-gradient(135deg, #1D2021 0%, #242829 60%, #1B2422 100%);
    border: 1px solid rgba(74, 155, 124, 0.2);
}

@media (prefers-color-scheme: dark) {
    .miralife-chat-widget:not([data-theme="light"]) {
        --surface-1: #1A1C1D;
        --surface-2: #1F2223;
        --surface-3: #242829;
        --stroke-color: rgba(255, 255, 255, 0.08);
        --shadow-card: 0 12px 30px rgba(0, 0, 0, 0.35);
        --shadow-float: 0 18px 60px rgba(0, 0, 0, 0.45);
        --glow-ring: 0 0 0 6px rgba(74, 155, 124, 0.2);
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-messages {
        background-image:
            linear-gradient(180deg, rgba(26, 28, 29, 0.98) 0%, rgba(31, 34, 35, 0.98) 100%),
            repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 10px, transparent 10px 20px);
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-message.assistant .miralife-chat-bubble {
        background: linear-gradient(180deg, #222526 0%, #2A2E2F 100%);
        border-left: 4px solid #4A9B7C;
    }

    .miralife-chat-widget:not([data-theme="light"]) .miralife-chat-welcome {
        background: linear-gradient(135deg, #1D2021 0%, #242829 60%, #1B2422 100%);
        border: 1px solid rgba(74, 155, 124, 0.2);
    }
}
