/* Chat Widget Styles */

/* Floating Chat Button - Hidden (using integrated contact buttons instead) */
.chat-widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f472b6, #a78bfa);
    border: none;
    box-shadow: 0 8px 24px rgba(244, 114, 182, 0.4);
    cursor: pointer;
    display: none !important; /* Hidden - using integrated contact buttons */
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 9998;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(244, 114, 182, 0.5);
}

.chat-widget-button:active {
    transform: scale(0.95);
}

.chat-widget-button svg {
    width: 28px;
    height: 28px;
}

/* Unread Badge */
.chat-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid white;
}

/* Widget Modal */
.chat-widget-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}

.chat-widget-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent layout shift when modal opens */
body.widget-modal-open {
    overflow: hidden;
}

/* Widget Container */
.chat-widget-container {
    width: 100%;
    max-width: 400px;
    height: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.chat-widget-modal.active .chat-widget-container {
    transform: scale(1) translateY(0);
}

/* Widget Screens */
.widget-screen {
    display: none;
    flex-direction: column;
    height: 100%;
}

.widget-screen.active {
    display: flex;
}

/* Widget Header */
.widget-header {
    background: linear-gradient(135deg, #f472b6, #a78bfa);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.widget-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.widget-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.widget-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s ease-in-out infinite;
}

.widget-status.offline .status-dot {
    background: #6b7280;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.widget-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    color: white;
}

.widget-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Widget Body (Login Screen) */
.widget-body {
    padding: 32px 24px;
    flex: 1;
    overflow-y: auto;
}

.widget-welcome {
    text-align: center;
    margin-bottom: 32px;
}

.widget-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f472b6, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
}

.widget-welcome h4 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #111827;
}

.widget-welcome p {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

/* Widget Forms */
#widget-login-form,
#widget-message-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#widget-login-form input,
#widget-message-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    transition: border-color 0.2s ease;
}

#widget-login-form input:focus,
#widget-message-input:focus {
    outline: none;
    border-color: #a78bfa;
}

.widget-btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, #f472b6, #a78bfa);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Montserrat', sans-serif;
}

.widget-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(167, 139, 250, 0.3);
}

.widget-btn-primary:active {
    transform: translateY(0);
}

/* Widget Messages */
.widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.widget-message {
    display: flex;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget-message.own {
    justify-content: flex-end;
}

.widget-message.other {
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-author {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    padding: 0 12px;
}

.message-text {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.widget-message.own .message-text {
    background: linear-gradient(135deg, #f472b6, #a78bfa);
    color: white;
    border-bottom-right-radius: 4px;
}

.widget-message.other .message-text {
    background: white;
    color: #111827;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    padding: 0 12px;
}

.widget-message.own .message-time {
    text-align: right;
}

/* Widget Input Area */
.widget-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

#widget-message-form {
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

#widget-message-input {
    flex: 1;
    margin: 0;
    padding: 10px 14px;
    font-size: 14px;
}

#widget-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #f472b6, #a78bfa);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#widget-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

#widget-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Typing Indicator */
.widget-typing {
    padding: 8px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.widget-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s ease-in-out infinite;
}

.widget-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.widget-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Scrollbar Styling */
.widget-messages::-webkit-scrollbar {
    width: 6px;
}

.widget-messages::-webkit-scrollbar-track {
    background: transparent;
}

.widget-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.widget-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .chat-widget-modal {
        padding: 0;
    }

    .chat-widget-container {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .chat-widget-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chat-widget-button svg {
        width: 24px;
        height: 24px;
    }
}
