:root {
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --bg-glass: rgba(255, 255, 255, 0.85);
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --white: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.4);
    --bot-bubble: #f3f4f6;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: #f8fafc; /* Keep simple to test widget contrast */
    min-height: 100vh;
}

/* Animations */
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bounceDot {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}

@keyframes floatIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Floating Toggle Button */
#chatbot-toggle-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999;
}

.tooltip {
    background: white;
    color: var(--text-dark);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

#chatbot-toggle-container:hover .tooltip {
    opacity: 1;
    transform: translateX(0);
}

.pulse-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toggle-icon {
    font-size: 24px;
}

.pulse-toggle:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Chat Widget Container */
#chatbot-container {
    position: fixed;
    bottom: 100px;
    left: 24px;
    width: 360px;
    max-height: 540px;
    height: calc(100vh - 120px);
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.chatbot-closed {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

/* Header */
#chatbot-header {
    background: var(--primary-gradient);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
}

.status-dot {
    position: absolute;
    bottom: 0px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid #8B5CF6;
}

.status-dot.pulse {
    animation: pulseGlow 2s infinite;
}

.header-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.header-info p {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.header-controls {
    display: flex;
    gap: 4px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Screens Wrapper */
#chat-window {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: transparent;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    animation: slideUpFade 0.4s ease-out;
}

.screen.active {
    display: flex;
}

/* Onboarding Screen */
.onboarding-header {
    text-align: center;
    margin-bottom: 24px;
}

.wave-icon {
    font-size: 40px;
    margin-bottom: 12px;
    animation: bounceDot 2s infinite ease-in-out;
}

.onboarding-header h4 {
    font-size: 20px;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.onboarding-header p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 14px;
    transition: color 0.3s;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 14px;
    color: var(--text-dark);
    transition: all 0.3s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-wrapper input:focus + .input-icon {
    color: var(--primary);
}

/* Shared Buttons */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.glow-effect:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* Options Screen */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.option-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 16px;
    border-radius: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 15px;
    color: var(--text-dark);
}

.option-icon {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 10px;
    border-radius: 10px;
}

.arrow-icon {
    color: #cbd5e1;
    transition: transform 0.2s;
}

.option-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.option-btn:hover .arrow-icon {
    color: var(--primary);
    transform: translateX(4px);
}

/* Forms Subscreens */
.form-screen h4 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    align-self: flex-start;
}

.back-btn:hover {
    color: var(--primary);
}

.form-scroll {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    overflow-y: auto;
    padding-right: 4px;
}

.modern-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modern-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.custom-select-wrapper {
    position: relative;
}

.modern-textarea {
    resize: none;
    height: 100px;
}

.select-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.file-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hidden-file { display: none; }

.file-label {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 14px;
    border-radius: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.file-label:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary);
    color: var(--primary);
}

.file-name-display {
    font-size: 12px;
    color: var(--primary);
    text-align: center;
}

/* Chat Area */
#chat-area-screen {
    padding: 0;
    flex-direction: column;
    height: 100%;
    background: #f8fafc;
}

#messages-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: floatIn 0.3s ease-out forwards;
}

.user-message {
    align-self: flex-end;
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.admin-message {
    align-self: flex-start;
    background: white;
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.02);
}

/* Typing Indicator */
.typing-bubble {
    display: inline-block;
    padding: 12px 16px !important;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #a1a1aa;
    border-radius: 50%;
    animation: bounceDot 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.hidden { display: none !important; }

/* Input Area */
#input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

#chat-input {
    width: 100%;
    border: none;
    background: #f8fafc;
    border-radius: 20px;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    outline: none;
    transition: box-shadow 0.2s;
}

#chat-input:focus {
    box-shadow: 0 0 0 2px var(--primary-glass);
}

.emoji-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.action-btn:hover { color: var(--text-dark); }

.btn-send {
    background: var(--primary-gradient);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn-send:hover {
    transform: scale(1.05);
}

/* Deactivated UI Overlay */
#deactivated-screen {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
}

#deactivated-screen.active {
    display: flex;
}

.inactive-icon {
    width: 64px;
    height: 64px;
    background: #fee2e2;
    color: var(--danger);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

#deactivated-screen h4 {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

#deactivated-screen p {
    font-size: 14px;
    line-height: 1.5;
}

/* Centered Screen for System Status */
.centered-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 32px;
}

.centered-screen.active {
    display: flex;
}

.unavailable-icon-wrapper {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.unavailable-icon-wrapper i {
    font-size: 28px;
    color: var(--danger);
}

.centered-screen h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.centered-screen p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #chatbot-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    #chatbot-toggle-container {
        display: none;
    }
}

