/* Chat System Styles */

/* Chat Button */
.chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

    .chat-button:hover {
        box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    }

/* Chat Badge */
.chat-badge {
    position: fixed !important;
    bottom: 65px !important;
    right: 15px !important;
    background: #dc3545 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 12px !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    min-width: 20px !important;
    line-height: 1 !important;
    z-index: 1001 !important;
}

/* Special styling for zero count */
.chat-badge[data-count="0"] {
    background: #28a745 !important; /* Green background for zero */
    opacity: 0.8 !important;
}

/* Chat Popup */
.chat-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 1001;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .chat-header h6 {
        margin-bottom: 0;
    }

    .chat-header button {
        background: none;
        border: none;
        font-size: 18px;
    }

/* Chat Content */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Chat Views */
.chat-view {
    height: 100%;
    display: none;
    flex-direction: column;
}

.chat-header-back {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

    .chat-header-back button {
        margin-right: 8px;
    }

    .chat-header-back span {
        font-weight: 500;
    }

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 320px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-end;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.sent {
    justify-content: flex-end;
}

.chat-message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    min-width: 80px;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-message.sent .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
    margin-left: 20%;
}

.chat-message.sent .message-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left: 8px solid #764ba2;
    border-bottom: none;
}

.chat-message.received .message-bubble {
    background: #ffffff;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px;
    margin-right: 20%;
}

.chat-message.received .message-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right: 8px solid #ffffff;
    border-bottom: none;
}

.chat-message.received .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -9px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right: 8px solid #e2e8f0;
    border-bottom: none;
    z-index: -1;
}

.message-bubble img {
    max-width: 100% !important;
    border-radius: 12px;
    margin: 8px 0 4px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-time {
    opacity: 0.7;
    font-size: 11px;
    margin-top: 6px;
    display: block;
    font-weight: 400;
}

.chat-message.sent .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.8);
}

.chat-message.received .message-time {
    text-align: left;
    color: #718096;
}

.message-bubble small {
    opacity: 0.8;
    font-size: 11px;
    display: block;
    margin-top: 4px;
}

/* Message content styling */
.message-bubble div:first-child {
    line-height: 1.4;
    word-break: break-word;
}

/* Empty chat state */
.chat-messages:empty::before {
    content: "Start a conversation...";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #a0aec0;
    font-style: italic;
    font-size: 16px;
}

/* Chat Input - Moved to chat-popup.css for better organization */

/* Conversations List */
.conversations-view {
    height: 100%;
    display: block;
}

    .conversations-view .p-3 {
        padding: 1rem;
    }

    .conversations-view h6 {
        margin-bottom: 0;
    }

.conversations-list {
    max-height: 400px;
    overflow-y: auto;
}

.conversation-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

    .conversation-item:hover {
        background-color: #f8f9fa;
    }

    .conversation-item .d-flex {
        display: flex;
        justify-content: space-between;
    }

    .conversation-item strong {
        font-weight: 600;
    }

    .conversation-item .text-muted {
        color: #6c757d;
    }

    .conversation-item .small {
        font-size: 0.875rem;
    }

    .conversation-item .badge {
        background-color: #007bff;
        color: white;
        padding: 0.25em 0.6em;
        border-radius: 10rem;
        font-size: 0.75em;
    }

/* Designer Selection */
.designer-selection {
    height: 100%;
    display: none;
}

.designers-list {
    max-height: 400px;
    overflow-y: auto;
}

.designer-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

    .designer-item:hover {
        background-color: #f8f9fa;
    }

    .designer-item .d-flex {
        display: flex;
        align-items: center;
    }

    .designer-item .me-3 {
        margin-right: 1rem;
    }

    .designer-item img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
    }

    .designer-item strong {
        font-weight: 600;
    }

    .designer-item .text-muted {
        color: #6c757d;
    }

    .designer-item .small {
        font-size: 0.875rem;
    }

/* Toast Notifications */
.chat-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 5px;
    color: white;
    z-index: 9999;
    display: none;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

    .chat-toast.info {
        background-color: #17a2b8;
    }

    .chat-toast.error {
        background-color: #dc3545;
    }

    .chat-toast.success {
        background-color: #28a745;
    }

/* Responsive Design */
@media (max-width: 768px) {
    .chat-popup {
        width: 300px;
        height: 450px;
        bottom: 80px;
        right: 10px;
    }

    .chat-button {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .chat-badge {
        bottom: 55px;
        right: 10px;
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .chat-popup {
        width: calc(100vw - 20px);
        height: 400px;
        bottom: 70px;
        right: 10px;
        left: 10px;
    }
}
/* Message input styles moved to chat-popup.css */
/* Chat popup input area styles */
.chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid #e9ecef;
    background: #fff;
    /* max-height: 200px; */
}

.message-input-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 0px 12px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    /* min-height: 150px; */
}

.message-input-container:focus-within {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.image-btn {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.image-btn:hover {
    background: #e9ecef;
    color: #0d6efd;
}

.message-editor-popup {
    flex: 1;
    /* min-height: 40px; */
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.4;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    resize: none;
    padding: 10px 0;
}

.message-editor-popup:empty:before {
    content: attr(data-placeholder);
    color: #6c757d;
    pointer-events: none;
}

.message-editor-popup img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin: 4px 2px;
    cursor: pointer;
}

.message-editor-popup br {
    line-height: 1.4;
}

.send-btn {
    background: #0d6efd;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #0b5ed7;
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Message image styles */
.message img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    margin: 5px 0;
    cursor: pointer;
}

.message img:hover {
    opacity: 0.9;
} 