/* Professional Corporate Chatbot Design */
:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 32px rgba(30, 64, 175, 0.15);
}

/* Main Chatbot Container */
.corporate-chatbot {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* Floating Chat Bubble Button */
.chat-bubble-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 10000;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
}

.chat-bubble-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 16px 40px rgba(30, 64, 175, 0.25);
}

.chat-bubble-btn:active {
    transform: scale(0.95);
}

.chat-bubble-btn .bubble-icon {
    font-size: 24px;
}

.chat-bubble-btn .bubble-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: var(--shadow-md);
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 120px;
    right: 20px;
    width: 420px;
    height: 500px;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    z-index: 9998;
    min-height: 400px;
}

.chat-window.collapsed {
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    border-bottom: 1px solid rgba(30, 64, 175, 0.1);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.online-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--success-color);
    border: 3px solid white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

.chat-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.chat-status {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

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

.chat-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Chat Body Container */
.chat-body-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    min-height: 200px;
    max-height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-light);
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Welcome Container */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.welcome-icon {
    font-size: 48px;
    color: var(--primary-light);
    margin-bottom: 16px;
    opacity: 0.8;
}

.welcome-container h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 600;
}

.welcome-container p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    order: 2;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
}

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

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

.message-text.bot {
    background: white;
    color: var(--text-dark);
    border-left: 4px solid var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.message-text.user {
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-left: 4px solid var(--primary-light);
    border-radius: 12px;
    width: fit-content;
    box-shadow: var(--shadow-sm);
}

.typing-indicator.hidden {
    display: none;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
}

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

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

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

/* History Panel */
.chat-history-panel {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: white;
    padding: 20px;
    overflow-y: auto;
    animation: slideInLeft 0.3s ease;
}

.chat-history-panel.hidden {
    display: none;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.history-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.history-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
}

.history-close:hover {
    color: var(--text-dark);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-dark);
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.history-item:hover {
    background: var(--border-color);
    border-left-color: var(--primary-light);
}

/* Search Panel */
.chat-search-panel {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: white;
    padding: 16px;
    overflow-y: auto;
    animation: slideInLeft 0.3s ease;
}

.chat-search-panel.hidden {
    display: none;
}

.search-header {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.search-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
    padding: 6px;
}

.search-close:hover {
    color: var(--text-dark);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result-item {
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-dark);
    transition: all 0.2s;
}

.search-result-item:hover {
    background: var(--border-color);
}

/* User Profile Panel */
.user-profile-panel {
    width: 180px;
    background: white;
    border-left: 1px solid var(--border-color);
    padding: 16px;
    display: none;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.user-profile-panel.visible {
    display: flex;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.profile-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.profile-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.profile-close:hover {
    color: var(--text-dark);
}

.user-info {
    text-align: center;
    padding: 12px 0;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 12px;
    background: var(--bg-light);
    border: 2px solid var(--primary-light);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    margin: 8px 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-role {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-light);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* Quick Replies */
.quick-replies {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding: 3px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.quick-reply-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 8px;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-reply-btn i {
    font-size: 10px;
}

/* Chat Footer */
.chat-footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-toolbar {
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    background: var(--bg-light);
    border: none;
    color: var(--primary-light);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.toolbar-btn:hover {
    background: var(--primary-light);
    color: white;
    transform: scale(1.05);
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    resize: none;
    max-height: 100px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

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

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 10001;
}

.emoji-picker.hidden {
    display: none;
}

.emoji-item {
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    text-align: center;
    transition: all 0.2s;
}

.emoji-item:hover {
    background: var(--bg-light);
    transform: scale(1.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .chat-window {
        width: 380px;
        height: 480px;
        bottom: 115px;
        z-index: 9998;
    }

    .chat-window.collapsed {
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        bottom: 115px;
    }

    .chat-bubble-btn {
        z-index: 10000;
    }
}

@media (max-width: 992px) {
    .chat-window {
        width: 360px;
        height: 480px;
        bottom: 105px;
        z-index: 9998;
    }

    .chat-window.collapsed {
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        bottom: 105px;
    }

    .chat-bubble-btn {
        bottom: 70px;
        z-index: 10000;
    }
}

@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 65vh;
        max-height: 65vh;
        bottom: auto;
        top: 140px;
        right: 20px;
        left: 20px;
        border-radius: 16px;
        z-index: 9997;
    }

    .chat-window.collapsed {
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        top: auto;
        bottom: auto;
        z-index: 9997;
    }

    .chat-bubble-btn {
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 60px;
        height: 60px;
        z-index: 10000;
    }

    .quick-replies {
        grid-template-columns: repeat(2, 1fr);
        gap: 1px;
        padding: 2px;
    }

    .user-profile-panel {
        width: 140px;
        padding: 12px;
    }

    .quick-reply-btn {
        font-size: 11px;
        padding: 8px 10px;
    }

    .quick-reply-btn i {
        font-size: 14px;
    }

    .chat-footer {
        padding: 10px 12px;
        gap: 4px;
    }

    .input-toolbar {
        gap: 6px;
    }

    .toolbar-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .input-wrapper {
        gap: 6px;
    }
}

@media (max-width: 576px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: 70vh;
        max-height: calc(100vh - 160px);
        bottom: auto;
        top: 100px;
        right: 10px;
        left: 10px;
        z-index: 9997;
    }

    .chat-window.collapsed {
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: 9997;
    }

    .chat-bubble-btn {
        bottom: 75px;
        right: 10px;
        width: 55px;
        height: 55px;
        z-index: 10000;
    }

    .chat-body-container {
        flex-direction: column;
    }

    .user-profile-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        height: auto;
        max-height: 150px;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-title {
        font-size: 14px;
    }

    .chat-status {
        font-size: 11px;
    }

    .chat-action-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .chat-messages {
        padding: 16px;
        gap: 12px;
    }
}

    .welcome-container {
        padding: 20px 12px;
    }

    .welcome-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }

    .welcome-container h3 {
        font-size: 14px;
        margin: 0 0 4px 0;
    }

    .welcome-container p {
        font-size: 11px;
    }

    .chat-footer {
        padding: 8px 10px;
        gap: 4px;
    }

    .input-toolbar {
        display: none;
    }

    .input-wrapper {
        gap: 4px;
    }

    .chat-input {
        padding: 8px 12px;
        font-size: 13px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .quick-replies {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 8px;
    }

    .quick-reply-btn {
        font-size: 9px;
        padding: 3px 4px;
        gap: 1px;
    }

    .quick-reply-btn i {
        font-size: 10px;
    }
}
