/* ====================================================
   NexGen Chatbot - Enterprise Styles v3.2
   Clean, Professional Design with Flexible Colors
   ==================================================== */

:root {
    --primary-color: #007cba;
    --secondary-color: #00ba7c;
    --background-color: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #626970;
    --border-light: #e2e8f0;
    --bg-light: #f7fafc;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.15);
    --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}



.nexgen-chatbot {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.nexgen-chatbot.nexgen-bottom-right {
    bottom: 20px;
    right: 20px;
}

.nexgen-chatbot.nexgen-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* ====== CHAT TOGGLE BUTTON ====== */
.nexgen-chatbot-toggle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-smooth);
    color: white;
    position: relative;
    overflow: visible;
    padding: 0;
    min-width: 64px;
    min-height: 64px;
}

.nexgen-chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.nexgen-chatbot-toggle:active {
    transform: translateY(0);
}

.nexgen-chatbot-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform var(--transition-base);
}

.nexgen-chatbot-toggle .close-icon {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====== NOTIFICATION BADGE ====== */
.nexgen-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.3px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    animation: pulse-soft 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexgen-notification-badge.nexgen-notification-entering {
    opacity: 0;
    transform: scale(0.8);
}

@keyframes pulse-soft {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.9; }
}

/* ====== CHAT WINDOW ====== */
.nexgen-chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    height: 550px;
    background: var(--background-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexgen-chatbot-window.nexgen-enter {
    animation: slideUpIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nexgen-chatbot-window.nexgen-exit {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    animation: slideDownOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideDownOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }
}

.nexgen-bottom-left .nexgen-chatbot-window {
    right: auto;
    left: 0;
}

@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ====== HEADER ====== */
.nexgen-chatbot-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.nexgen-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.nexgen-chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

/* ====== STATUS INDICATOR ====== */
.nexgen-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.95;
}

.nexgen-status-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ====== CLOSE BUTTON ====== */
.nexgen-chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.nexgen-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.nexgen-chatbot-close:active {
    transform: scale(0.95);
}

/* ====== MESSAGE AREA ====== */
.nexgen-chatbot-messages {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nexgen-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.nexgen-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.nexgen-chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
    transition: background var(--transition-base);
}

.nexgen-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #cbd5e0;
}

/* Firefox scrollbar */
.nexgen-chatbot-messages {
    scrollbar-color: #cbd5e0 transparent;
    scrollbar-width: thin;
}

/* ====== MESSAGES ====== */
.nexgen-message {
    margin-bottom: 2px;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nexgen-message.nexgen-message-entering {
    opacity: 0;
    transform: translateY(8px);
}

.nexgen-message-content {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* ====== USER MESSAGE ====== */
.nexgen-user-message {
    align-self: flex-end;
}

.nexgen-user-message .nexgen-message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: var(--shadow-sm);
}

/* ====== BOT MESSAGE ====== */
.nexgen-bot-message {
    align-self: flex-start;
}

.nexgen-bot-message .nexgen-message-content {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 18px 18px 18px 4px;
    box-shadow: var(--shadow-sm);
}

/* ====== MESSAGE TIME ====== */
.nexgen-message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    align-self: flex-end;
    font-weight: 400;
    opacity: 0.8;
}

.nexgen-bot-message .nexgen-message-time {
    align-self: flex-start;
}

/* ====== SYSTEM MESSAGE ====== */
.nexgen-system-message {
    text-align: center;
    margin: 8px 0;
    align-self: center;
}

.nexgen-system-message .nexgen-message-content {
    background: #eff6ff;
    color: #0c6bb6;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid #bfe3ff;
    box-shadow: none;
    max-width: 85%;
}

/* ====== INPUT AREA ====== */
.nexgen-chatbot-input-area {
    padding: 16px;
    background: var(--background-color);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.nexgen-chatbot-input-area input {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    background: white;
    outline: none;
    transition: all var(--transition-base);
    resize: none;
    max-height: 100px;
    min-height: 44px;
}

.nexgen-chatbot-input-area input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.08);
}

.nexgen-chatbot-input-area input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ====== SEND BUTTON ====== */
.nexgen-chatbot-input-area button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
    font-size: 20px;
    box-shadow: var(--shadow-sm);
    min-width: 48px;
    min-height: 48px;
}

.nexgen-chatbot-input-area button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nexgen-chatbot-input-area button:active:not(:disabled) {
    transform: translateY(0) scale(0.95);
}

.nexgen-chatbot-input-area button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ====== TYPING INDICATOR ====== */
.nexgen-chatbot-typing {
    padding: 12px 16px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexgen-chatbot-typing.nexgen-typing-entering {
    opacity: 0;
    transform: translateY(-8px);
}

.nexgen-chatbot-typing.nexgen-typing-exiting {
    opacity: 0;
    transform: translateY(-8px);
}

.nexgen-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nexgen-typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
    opacity: 0.6;
}

.nexgen-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.nexgen-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.nexgen-typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ====== NAME OVERLAY ====== */
.nexgen-name-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10;
    backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexgen-name-overlay.nexgen-overlay-entering {
    opacity: 0;
}

.nexgen-name-overlay.nexgen-overlay-exiting {
    opacity: 0;
}

.nexgen-name-card {
    background: var(--background-color);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    width: 90%;
    max-width: 360px;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.nexgen-name-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.nexgen-name-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 10px;
    font-weight: 400;
}

.nexgen-name-input {
    width: 100%;
    margin: 0 0 16px 0;
    padding: 11px 13px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    background: white;
    outline: none;
    transition: all var(--transition-base);
}

.nexgen-name-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.08);
}

.nexgen-name-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.nexgen-name-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 11px 16px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.nexgen-name-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.nexgen-name-button:active:not(:disabled) {
    transform: translateY(0);
}

.nexgen-name-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nexgen-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
}

/* ====== LINKS IN MESSAGES ====== */
.nexgen-message-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: opacity var(--transition-base);
}

.nexgen-message-content a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.nexgen-user-message .nexgen-message-content a {
    color: rgba(255, 255, 255, 0.95);
}

/* ====== RESPONSIVE DESIGN ====== */
@media (max-width: 768px) {
    .nexgen-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        max-width: 380px;
        max-height: 600px;
    }

    .nexgen-chatbot.nexgen-bottom-right {
        right: 10px;
        bottom: 80px;
    }

    .nexgen-chatbot.nexgen-bottom-left {
        left: 10px;
        bottom: 80px;
    }

    .nexgen-chatbot-toggle {
        width: 64px;
        height: 64px;
        bottom: 10px;
    }

    .nexgen-message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .nexgen-chatbot {
        bottom: 10px;
        right: 10px;
    }

    .nexgen-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        position: fixed;
        bottom: 80px;
        left: 10px;
        right: 10px;
        border-radius: var(--radius-lg);
    }

    .nexgen-bottom-left .nexgen-chatbot-window {
        left: 10px;
        right: 10px;
    }

    .nexgen-chatbot-toggle {
        width: 64px;
        height: 64px;
        bottom: 10px;
    }

    .nexgen-chatbot-messages {
        padding: 16px 12px;
    }

    .nexgen-chatbot-input-area {
        padding: 14px;
        gap: 10px;
    }

    .nexgen-chatbot-input-area input {
        min-height: 44px;
        padding: 12px 14px;
        font-size: 16px;
    }

    .nexgen-chatbot-input-area button {
        min-width: 48px;
        min-height: 48px;
    }

    .nexgen-message-content {
        max-width: 88%;
        padding: 10px 12px;
        font-size: 14px;
    }

    .nexgen-name-card {
        padding: 24px 20px;
    }

    .nexgen-name-input {
        min-height: 44px;
        padding: 12px 14px;
        font-size: 16px;
    }

    .nexgen-name-button {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 16px;
    }
}