/**
 * Simple Chat Widget Styles
 * Clean, modern design focused on usability
 */

/* Chat Bar Container - Full Width Bottom Bar */
.chat-bar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(59, 130, 246, 0.2);
    z-index: 1000;
}

/* Removed collapsed state - bar is always visible */
.chat-bar-container.collapsed {
    bottom: 0;
}

/* Removed slide-up animation - bar is always visible */

/* Chat Bar - Main Interface - Much taller height */
.chat-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    cursor: pointer;
}

/* Removed hover effect to prevent any visual changes */

/* Chat Bar Content */
.chat-bar-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-bar-icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-bar-icon svg {
    width: 14px;
    height: 14px;
    color: white;
}

.chat-bar-text {
    flex: 1;
    color: white;
}

.chat-bar-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-bar-subtitle {
    font-size: 10px;
    opacity: 0.9;
    display: block; /* Show subtitle */
}

.chat-bar-status {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 9px;
    background: rgba(255, 255, 255, 0.2);
    padding: 1px 4px;
    border-radius: 6px;
}

.status-dot {
    width: 4px;
    height: 4px;
    background: #10b981;
    border-radius: 50%;
}

/* Chat Bar Actions Container */
.chat-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Chat Bar Action Button - Compact */
.chat-bar-action {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-bar-action:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.chat-bar-action.primary {
    background: rgba(255, 255, 255, 0.9);
    color: #3b82f6;
    border-color: rgba(255, 255, 255, 1);
}

.chat-bar-action.primary:hover {
    background: rgba(255, 255, 255, 1);
    color: #1d4ed8;
}

.chat-bar-action.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-bar-action.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-bar-action svg {
    width: 14px;
    height: 14px;
}

/* Minimize button completely removed */

/* Removed floating label - not needed */
.chat-bar-float-label {
    display: none !important;
}

/* Removed bounce animation to prevent weird movement */

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Animations */
@keyframes initial-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    }
    25%, 75% { 
        transform: scale(1.1);
        box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 10px 30px rgba(59, 130, 246, 0.8);
    }
}

@keyframes slide-in-help {
    0%, 85% {
        opacity: 0;
        visibility: hidden;
        transform: translateX(10px);
    }
    90%, 95% {
        opacity: 1;
        visibility: visible;
        transform: translateX(-5px);
    }
    100% {
        opacity: 0;
        visibility: hidden;
        transform: translateX(-5px);
    }
}

/* Chat Badge removed */

/* Chat Window - Fixed in bottom right corner */
.chat-window {
    position: fixed !important;
    bottom: 50px !important;
    right: 20px !important;
    left: auto !important;
    top: auto !important;
    transform: scale(0);
    transform-origin: bottom right;
    width: 320px !important;
    max-width: calc(100% - 40px);
    height: 480px !important;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    overflow: hidden;
}

.chat-window.open {
    transform: scale(1) !important;
    opacity: 1 !important;
    visibility: visible !important;
    bottom: 50px !important;
    right: 20px !important;
    left: auto !important;
    top: auto !important;
}

/* Removed minimize functionality */

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-minimize-window,
.chat-minimize,
.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chat-minimize-window:hover,
.chat-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-close:hover {
    background: rgba(239, 68, 68, 0.8) !important;
    transform: scale(1.05);
}

.chat-minimize {
    font-size: 22px;
    line-height: 1;
    font-family: system-ui, -apple-system, sans-serif !important;
    font-weight: bold !important;
}

.chat-close {
    font-size: 18px;
    line-height: 1;
    font-family: system-ui, -apple-system, sans-serif !important;
    font-weight: bold !important;
    background: #ef4444 !important;
    border-radius: 6px !important;
    margin-left: 5px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* Contact Form */
.chat-contact-form {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

.form-intro {
    text-align: center;
    margin-bottom: 20px;
}

.form-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.form-intro h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #1f2937;
}

.form-intro p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.required {
    color: #ef4444;
}

.optional {
    color: #9ca3af;
    font-weight: normal;
    font-size: 12px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.start-chat-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.start-chat-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
}

.start-chat-btn:active {
    transform: translateY(0);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.user-message {
    align-self: flex-end;
}

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

.message-content {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.user-message .message-content {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    gap: 8px;
}

#chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #3b82f6;
}

#chat-send {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

#chat-send:hover:not(:disabled) {
    background: #2563eb;
}

#chat-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Typing Indicator */
.chat-typing {
    padding: 0 16px 8px;
    background: #f9fafb;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px 18px 18px 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing-dot 1.4s infinite ease-in-out;
}

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

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

@keyframes typing-dot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Removed minimize indicator */

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chat-bar-container {
        width: 100%;
        border-radius: 0;
    }

    .chat-bar {
        padding: 16px 12px;
        min-height: 60px;
    }

    .chat-bar-text {
        font-size: 14px;
    }

    .chat-bar-title {
        font-size: 13px;
        font-weight: 600;
        margin-bottom: 2px;
    }

    .chat-bar-subtitle {
        font-size: 11px;
        display: block;
    }

    .chat-bar-status {
        font-size: 10px;
        padding: 2px 6px;
    }

    .chat-bar-action {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
        border-radius: 18px;
    }

    .chat-bar-actions {
        gap: 8px;
        flex-shrink: 0;
    }

    .chat-bar-icon {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }

    .chat-bar-icon svg {
        width: 16px;
        height: 16px;
    }
}

    .chat-window {
        bottom: 40px;
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        max-width: 100%;
        height: calc(100vh - 100px);
        max-height: 85vh;
        border-radius: 16px;
        transform: scale(0);
        transform-origin: bottom right;
    }

    .chat-window.open {
        transform: scale(1);
    }

    /* Removed mobile minimize styles */

    .chat-header {
        border-radius: 0;
        padding-top: calc(16px + env(safe-area-inset-top));
    }
}

/* iPhone and small mobile devices */
@media (max-width: 480px) {
    .chat-bar {
        padding: 14px 10px;
    }

    .chat-bar-title {
        font-size: 12px;
    }

    .chat-bar-subtitle {
        font-size: 10px;
    }

    .chat-bar-action {
        padding: 6px 8px;
        font-size: 11px;
        min-height: 32px;
        white-space: nowrap;
    }

    .chat-bar-actions {
        gap: 6px;
    }

    .chat-bar-icon {
        width: 24px;
        height: 24px;
    }

    .chat-bar-icon svg {
        width: 14px;
        height: 14px;
    }

    .chat-bar-status {
        font-size: 9px;
        padding: 1px 4px;
    }

    /* Make sure buttons fit on very small screens */
    .chat-bar-action svg {
        width: 12px;
        height: 12px;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Inline Close Button in Chat Messages */
.chat-close-container {
    display: flex;
    justify-content: center;
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.chat-close-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: system-ui, -apple-system, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-close-inline:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.chat-close-inline svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}