* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container h1 {
    color: white;
    margin-bottom: 40px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.login-form {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 300px;
}

.login-form input {
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.google-login-btn {
    padding: 15px 20px;
    background: white;
    color: #757575;
    border: 2px solid #dadce0;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 500;
    width: 100%;
}

.google-login-btn:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-color: #dadce0;
    background: #f8f9fa;
}

.google-icon {
    flex-shrink: 0;
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    text-align: center;
    position: relative;
}

.divider::before {
    content: '';
    flex: 1;
    height: 1px;
    background: #dadce0;
    margin-right: 15px;
}

.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dadce0;
    margin-left: 15px;
}

.divider span {
    color: #5f6368;
    font-size: 14px;
    font-weight: 500;
}

.email-login-btn {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    width: 100%;
}

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

.error-message {
    color: #e74c3c;
    margin-top: 10px;
    text-align: center;
}

/* Main Chat Interface */
#chat-screen {
    background: #f5f7fa;
}

/* Header styles now handled by Bootstrap navbar */

/* These styles are now handled by Bootstrap components */

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.modal.show {
    pointer-events: auto;
}

.modal.fade:not(.show) {
    display: none !important;
}

.modal-backdrop {
    pointer-events: none;
}

.modal-backdrop.show {
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    min-width: 300px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
}

.close:hover {
    color: #2c3e50;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.modal-content input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    outline: none;
}

.modal-content input:focus {
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-actions button:first-child {
    background: #3498db;
    color: white;
}

.modal-actions button:first-child:hover {
    background: #2980b9;
}

.modal-actions button:last-child {
    background: #95a5a6;
    color: white;
}

.modal-actions button:last-child:hover {
    background: #7f8c8d;
}

/* Custom Bootstrap Overrides */
.status-indicator {
    font-size: 16px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Fix modal overlay blocking issue */
.modal {
    pointer-events: none;
}

.modal.show {
    pointer-events: auto;
}

.modal.fade:not(.show) {
    display: none !important;
}

.modal-backdrop {
    pointer-events: none;
}

.modal-backdrop.show {
    pointer-events: auto;
}

/* Ensure modal is properly hidden by default */
.modal:not(.show) {
    visibility: hidden;
    opacity: 0;
}

.modal.show {
    visibility: visible;
    opacity: 1;
}

/* Chat message styles */
.message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.message.support {
    align-items: flex-end;
}

.message.customer {
    align-items: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.message.support .message-bubble {
    background:  #cd853f ;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.customer .message-bubble {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 4px;
}

.message-content {
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    padding: 0 5px;
}

/* Message actions styles */
.message-actions {
    margin-top: 0.5rem;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.message-actions .btn {
    padding: 0.15rem 0.3rem;
    font-size: 0.7rem;
    background-color: white !important;
    border-color: #dee2e6;
}

.message-actions .btn:hover {
    transform: scale(1.05);
    background-color: white !important;
}

.message-actions .btn-outline-secondary:hover {
    color: #495057 !important;
}

.message-actions .btn-outline-danger:hover {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

/* Delete chat button styles */
.delete-chat-btn {
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.list-group-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    opacity: 1 !important;
    transform: scale(1.1);
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.delete-chat-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Chat item content styling */
.chat-item-content {
    min-width: 0; /* Allow text to be truncated if needed */
}

.chat-item-content p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* Selected chat session styling */
.list-group-item.active {
    background-color: #f5deb3 !important;
    border-color: #d2b48c !important;
    color: #8b4513 !important;
}

.list-group-item.active:hover {
    background-color: #f5deb3 !important;
    border-color: #d2b48c !important;
    color: #8b4513 !important;
}

.list-group-item.active .text-muted {
    color: #a0522d !important;
}

/* Mobile improvements */
@media (max-width: 767.98px) {
    .message-bubble {
        max-width: 85%;
    }
    
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    #user-email {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Photo message styles */
.message-photo {
    margin-bottom: 0.5rem;
}

.message-photo img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.message-photo img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.message-text {
    margin-top: 0.5rem;
}

/* Ensure photos don't break message layout */
.message.support .message-bubble .message-photo,
.message.customer .message-bubble .message-photo {
    max-width: 100%;
}

/* Live status toggle styling */
.form-check-input:checked {
    background-color: #28a745;
    border-color: #28a745;
}

.form-check-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-check-label {
    font-weight: 500;
    font-size: 0.9rem;
}

#live-status-text {
    transition: color 0.3s ease;
}

/* Image modal styles */
#imageModal .modal-body {
    padding: 1rem;
}

#imageModal .modal-body img {
    max-height: 70vh;
    width: auto;
}

/* Message image inline expansion */
.message-image-preview {
    max-width: 250px;
    max-height: 250px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-image-expanded {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.message-image-preview:hover, .message-image-expanded:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.photo-message {
    position: relative;
    overflow: visible;
}

/* User Card Styles */
.user-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.user-card img {
    object-fit: cover;
}

.user-card .badge {
    font-size: 0.7rem;
}

.user-card .text-muted {
    font-size: 0.8rem;
}

.user-card .fw-bold {
    color: #495057;
}

/* User card loading state */
#user-card-container .spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* User card responsive adjustments */
@media (max-width: 576px) {
    .user-card {
        padding: 0.75rem;
    }
    
    .user-card img, .user-card .bg-secondary {
        width: 40px !important;
        height: 40px !important;
    }
}
