/**
 * Matama Studio - Chat Widget Styles
 * Desktop/Tablet Chat Interface
 */

/* Chat Toggle Button */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #00E676 0%, #00C853 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 230, 118, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.6);
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
}

.chat-toggle--active {
    background: linear-gradient(135deg, #1a1a1a 0%, #000 100%);
}

/* Badge for unread messages */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF3B30;
    color: white;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #000;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    animation: chatSlideIn 0.3s ease;
}

@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #000 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #00E676;
}

.chat-header-info h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
}

.chat-status {
    margin: 0;
    font-size: 13px;
    opacity: 0.8;
    display: flex;
    align-items: center;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #00E676;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
}

.chat-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

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

.chat-close svg {
    width: 20px;
    height: 20px;
}

/* Chat Info Banner */
.chat-info {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 12px 20px;
}

.chat-info-text {
    margin: 4px 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

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

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

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

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

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

/* Message Bubbles */
.chat-message {
    display: flex;
    margin-bottom: 8px;
    animation: messageSlideIn 0.2s ease;
}

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

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

.chat-message--admin {
    justify-content: flex-start;
}

.chat-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
}

.chat-message--user .chat-message-content {
    background: linear-gradient(135deg, #00E676 0%, #00C853 100%);
    color: #000;
    border-bottom-right-radius: 4px;
}

.chat-message--admin .chat-message-content {
    background: white;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message-content p {
    margin: 0 0 6px 0;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message-content p:last-of-type {
    margin-bottom: 0;
}

.chat-message-time {
    font-size: 11px;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
}

/* Welcome Message */
.chat-message--welcome .chat-message-content {
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.1) 0%, rgba(0, 200, 83, 0.1) 100%);
    color: #1a1a1a;
    border: 1px solid rgba(0, 230, 118, 0.3);
}

/* System Message */
.chat-message--system {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.chat-system-content {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
    max-width: 85%;
}

.chat-system-content p {
    margin: 0;
}

/* Email Collection Form */
.chat-email-form {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 20px;
}

.chat-email-header {
    margin-bottom: 16px;
}

.chat-email-header p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
}

.chat-email-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.chat-email-input:focus {
    outline: none;
    border-color: #00E676;
}

.chat-email-buttons {
    display: flex;
    gap: 8px;
}

.btn-skip {
    flex: 1;
    padding: 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-skip:hover {
    background: #e0e0e0;
}

.btn-save-email {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, #00E676 0%, #00C853 100%);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #000;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-save-email:hover {
    transform: translateY(-2px);
}

/* Input Form */
.chat-input-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    max-height: 120px;
    overflow-y: auto;
}

.chat-input:focus {
    border-color: #00E676;
}

.chat-input::placeholder {
    color: #999;
}

.chat-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #00E676 0%, #00C853 100%);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 230, 118, 0.4);
}

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

.chat-send svg {
    width: 20px;
    height: 20px;
}

/* Mobile Styles */
@media (max-width: 767px) {
    /* Hide chat widget on mobile - WhatsApp button is shown instead */
    .chat-toggle,
    .chat-window {
        display: none !important;
    }
}

/* Tablet Adjustments */
@media (max-width: 1024px) and (min-width: 768px) {
    .chat-window {
        width: 340px;
        height: 500px;
    }

    .chat-toggle {
        width: 56px;
        height: 56px;
    }

    .chat-toggle svg {
        width: 24px;
        height: 24px;
    }
}

/* Small Desktop Adjustments */
@media (max-height: 700px) {
    .chat-window {
        height: calc(100vh - 140px);
        max-height: 500px;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #1a1a1a;
    }

    .chat-info {
        background: #2a2a2a;
        border-bottom-color: #3a3a3a;
    }

    .chat-info-text {
        color: #999;
    }

    .chat-messages {
        background: #0f0f0f;
    }

    .chat-message--admin .chat-message-content {
        background: #2a2a2a;
        color: #e0e0e0;
    }

    .chat-input-form {
        background: #1a1a1a;
        border-top-color: #3a3a3a;
    }

    .chat-input {
        background: #2a2a2a;
        color: white;
        border-color: #3a3a3a;
    }

    .chat-input::placeholder {
        color: #666;
    }
}
