@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ==========================================================
   GMS AI Chat Widget - Premium Healthcare UI
   ========================================================== */

:root {
    --primary-bg: linear-gradient(135deg, #002147, #0056b3);
    --primary-solid: #002147;
    --primary-light: rgba(0, 86, 179, 0.1);
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 255, 255, 0.5);
    --shadow-soft: 0 8px 32px rgba(0, 33, 71, 0.15);
}

#gms-chat-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tooltip for Chat Bubble */
#gms-chat-bubble::after {
    content: "Chat with GMS AI";
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #0f172a;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#gms-chat-bubble:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* Chat Toggle Bubble */
#gms-chat-bubble {
    width: 60px;
    height: 60px;
    background: var(--primary-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 33, 71, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 2;
    border: none;
}

#gms-chat-bubble:hover {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 15px 35px rgba(0, 33, 71, 0.4),
        inset 0 2px 6px rgba(255, 255, 255, 0.4);
}

#gms-chat-bubble svg {
    fill: #ffffff;
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

#gms-chat-bubble:hover svg {
    transform: rotate(-10deg);
}

.pulse-animation {
    animation: premium-pulse 2.5s infinite;
}

@keyframes premium-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 86, 179, 0.6), 0 10px 25px rgba(0, 33, 71, 0.3);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(0, 86, 179, 0), 0 10px 25px rgba(0, 33, 71, 0.3);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 86, 179, 0), 0 10px 25px rgba(0, 33, 71, 0.3);
    }
}

/* Chat Window Panel */
#gms-chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: min(380px, calc(100vw - 60px));
    height: 640px;
    max-height: calc(100vh - 120px);
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    box-shadow: var(--shadow-soft),
        0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
    transform-origin: bottom right;
    visibility: visible;
}

#gms-chat-window.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    visibility: hidden;
}

/* Header Area */
.chat-header {
    padding: 15px 18px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-avatar {
    width: 60px;
    height: 52px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-title-group {
    display: flex;
    flex-direction: column;
}

.chat-title {
    font-weight: 600;
    font-size: 18px;
    color: #002147;
    letter-spacing: -0.2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Chat Messages Area */
#gms-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: transparent;
    scroll-behavior: smooth;
}

#gms-chat-messages::-webkit-scrollbar {
    width: 5px;
}

#gms-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#gms-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: content-box;
    transition: background 0.3s ease;
}

/* Message Bubbles */
.message {
    padding: 14px 18px;
    border-radius: 20px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.6;
    animation: messageReveal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    word-wrap: break-word;
}

@keyframes messageReveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.assistant-message {
    background: #ffffff;
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.user-message {
    background: var(--primary-bg);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 33, 71, 0.2);
}

/* Quick Actions Area */
#gms-quick-actions {
    padding: 12px 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: transparent;
}

.quick-action-btn {
    background: white;
    border: 1px solid #e2e8f0;
    color: #002147;
    padding: 8px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.quick-action-btn:hover {
    background: var(--primary-bg);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 33, 71, 0.2);
}

/* Input Area */
.chat-input-area {
    padding: 16px 20px 20px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    gap: 12px;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
}

#gms-chat-input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 14px 18px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #ffffff;
    color: var(--text-dark);
}

#gms-chat-input:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

#gms-chat-send {
    background: var(--primary-bg);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 33, 71, 0.2);
}

#gms-chat-send svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
}

#gms-chat-send:hover:not(:disabled) {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 33, 71, 0.3);
}

/* Typing Indicator */
.typing-indicator {
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    animation: messageReveal 0.3s ease forwards;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.typing-dot {
    width: 5px;
    height: 5px;
    background: #0056b3;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.2); }
}

/* Media Queries */
@media (max-width: 480px) {
    #gms-chat-wrapper { bottom: 0; right: 0; width: 100%; }
    #gms-chat-bubble { bottom: 20px; right: 20px; position: fixed; }
    #gms-chat-window { width: 100%; height: 100%; max-height: 100vh; bottom: 0; right: 0; border-radius: 0; }
    .chat-input-area { border-radius: 0; padding-bottom: 30px; }
}

/* ==========================================================
   Admin Settings Enhancements
   ========================================================== */
.gms-admin-wrap {
    max-width: 800px;
    background: #ffffff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
    margin-top: 40px;
}

.gms-admin-wrap h1 {
    color: #002147;
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.gms-admin-wrap .button-primary {
    background: #002147 !important;
    border: none !important;
    padding: 12px 32px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(0, 33, 71, 0.2) !important;
}

.gms-admin-wrap .button-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 28px rgba(0, 33, 71, 0.3) !important;
}