/* Chat Widget Styles - FilamentBros */
:root {
    --chat-primary: #1f6463;
    --chat-primary-light: #2a8a89;
    --chat-primary-dark: #1a5454;
    --chat-light-bg: #f0f4f2;
    --chat-text-dark: #2d3436;
    --chat-text-light: #ffffff;
    --chat-border-radius: 24px;
    --chat-box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating Chat Button */
.chat-widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(31, 100, 99, 0.4);
    z-index: 99999;
    transition: var(--chat-transition);
    border: none;
    color: var(--chat-text-light);
}

.chat-widget-button:hover {
    background: var(--chat-primary-light);
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(31, 100, 99, 0.5);
}

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

.chat-widget-button i {
    font-size: 24px;
}

/* Unread Badge */
.chat-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.chat-widget-badge.hidden {
    display: none;
}

/* Chat Panel */
.chat-widget-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: var(--chat-border-radius);
    box-shadow: var(--chat-box-shadow);
    z-index: 99998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    transition: var(--chat-transition);
}

.chat-widget-panel.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Chat Header */
.chat-widget-header {
    background: var(--chat-primary);
    color: var(--chat-text-light);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--chat-border-radius) var(--chat-border-radius) 0 0;
}

.chat-widget-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-widget-close {
    background: transparent;
    border: none;
    color: var(--chat-text-light);
    cursor: pointer;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--chat-transition);
    padding: 0;
}

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

/* Chat Messages Container */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--chat-light-bg);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

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

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: rgba(31, 100, 99, 0.3);
    border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(31, 100, 99, 0.5);
}

/* Message Bubbles */
.chat-widget-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: messageSlideIn 0.3s ease-out;
}

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

.chat-widget-message.customer {
    align-self: flex-end;
}

.chat-widget-message.staff {
    align-self: flex-start;
}

.chat-widget-message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-widget-message.customer .chat-widget-message-bubble {
    background: var(--chat-primary);
    color: var(--chat-text-light);
    border-bottom-right-radius: 4px;
}

.chat-widget-message.staff .chat-widget-message-bubble {
    background: #e0e0e0;
    color: var(--chat-text-dark);
    border-bottom-left-radius: 4px;
}

.chat-widget-message-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.chat-widget-message.customer .chat-widget-message-time {
    text-align: right;
}

.chat-widget-message.staff .chat-widget-message-time {
    text-align: left;
}

/* Image Attachments */
.chat-widget-message-image {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: var(--chat-transition);
}

.chat-widget-message-image:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* Chat Input Area */
.chat-widget-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-widget-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-widget-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: var(--chat-transition);
}

.chat-widget-input:focus {
    outline: none;
    border-color: var(--chat-primary);
}

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

/* Action Buttons */
.chat-widget-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-widget-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
    color: var(--chat-text-light);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chat-widget-btn-upload {
    background: var(--chat-primary-light);
}

.chat-widget-btn-upload:hover {
    background: var(--chat-primary);
    transform: scale(1.05);
}

.chat-widget-btn-send {
    background: var(--chat-primary);
}

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

.chat-widget-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.chat-widget-btn:disabled:hover {
    transform: none;
}

/* Loading State */
.chat-widget-loading {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.chat-widget-loading i {
    animation: spin 1s linear infinite;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Empty State */
.chat-widget-empty {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.chat-widget-empty i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Error Message */
.chat-widget-error {
    background: #fee;
    color: #c33;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin: 0.5rem 1rem;
    font-size: 0.9rem;
    border: 1px solid #fcc;
}

/* Sender ID Form (Email/Phone Input) */
.chat-widget-sender-form {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 2rem 1.5rem;
}

.chat-widget-sender-form-content {
    text-align: center;
    max-width: 320px;
    width: 100%;
}

.chat-widget-sender-form-content i {
    font-size: 3rem;
    color: var(--chat-primary);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.chat-widget-sender-form-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    color: var(--chat-text-dark);
    font-weight: 600;
}

.chat-widget-sender-form-content > p {
    margin: 0 0 1.5rem 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-widget-sender-form-input {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.chat-widget-sender-form-input input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--chat-transition);
    box-sizing: border-box;
}

.chat-widget-sender-form-input input:focus {
    outline: none;
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(31, 100, 99, 0.1);
}

.chat-widget-sender-submit {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--chat-primary);
    color: var(--chat-text-light);
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--chat-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.chat-widget-sender-submit:hover {
    background: var(--chat-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(31, 100, 99, 0.3);
}

.chat-widget-sender-submit:active {
    transform: translateY(0);
}

.chat-widget-contact-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.chat-widget-contact-info > p {
    margin: 0 0 0.75rem 0;
    color: #666;
    font-size: 0.85rem;
}

.chat-widget-contact-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-widget-contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--chat-primary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--chat-transition);
}

.chat-widget-contact-link:hover {
    background: rgba(31, 100, 99, 0.1);
    color: var(--chat-primary-dark);
}

.chat-widget-contact-link i {
    font-size: 0.9rem;
}

/* Hidden File Input */
.chat-widget-file-input {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-widget-button {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }

    .chat-widget-button i {
        font-size: 22px;
    }

    .chat-widget-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 80vh;
        max-height: 80vh;
        border-radius: var(--chat-border-radius) var(--chat-border-radius) 0 0;
        transform: translateY(100%);
    }

    .chat-widget-panel.open {
        transform: translateY(0);
    }

    .chat-widget-message {
        max-width: 85%;
    }

    .chat-widget-header {
        border-radius: var(--chat-border-radius) var(--chat-border-radius) 0 0;
    }
}

/* Overlay for mobile */
.chat-widget-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99997;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-widget-overlay.show {
    display: block;
    opacity: 1;
}

@media (min-width: 769px) {
    .chat-widget-overlay {
        display: none !important;
    }
}
