﻿.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
}

    .chat-toggle-btn:hover {
        background: #0056b3;
        transform: scale(1.1);
    }

.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transform: translateY(100vh);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow: hidden;
}

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

.connection-status {
    padding: 5px 15px;
    font-size: 12px;
    text-align: center;
    font-weight: 500;
}

    .connection-status.connected {
        background: #d4edda;
        color: #155724;
    }

    .connection-status.connecting {
        background: #fff3cd;
        color: #856404;
    }

    .connection-status.disconnected {
        background: #f8d7da;
        color: #721c24;
    }

.chat-header {
    background: #007bff;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

    .chat-header h3 {
        margin: 0;
        font-size: 18px;
    }

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

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

.customer-info-form {
    padding: 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

    .customer-info-form h4 {
        margin: 0 0 15px 0;
        color: #333;
    }

.form-group {
    margin-bottom: 15px;
}

    .form-group label {
        display: block;
        margin-bottom: 5px;
        font-weight: 500;
        color: #555;
    }

    .form-group input {
        width: 100%;
        padding: 10px;
        border: 2px solid #ddd;
        border-radius: 5px;
        font-size: 14px;
        transition: border-color 0.3s;
        box-sizing: border-box;
    }

        .form-group input:focus {
            outline: none;
            border-color: #007bff;
        }

.submit-info-btn {
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

    .submit-info-btn:hover:not(:disabled) {
        background: #0056b3;
    }

    .submit-info-btn:disabled {
        background: #ccc;
        cursor: not-allowed;
    }

.customer-selection {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

    .customer-selection select {
        width: 100%;
        padding: 10px;
        border: 1px solid #ccc;
        border-radius: 5px;
        font-size: 14px;
        background: white;
    }

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    min-height: 0; /* Allows flex item to shrink below content size */
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
}

    .message.sent {
        margin-left: auto;
        text-align: right;
    }

    .message.received {
        margin-right: auto;
        text-align: left;
    }

.sender-name {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.message-bubble {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 100%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.message.sent .message-bubble {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 5px;
}

.message.received .message-bubble {
    background: #e9ecef;
    color: #333;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.message-status {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid #eee;
    background: white;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

    .chat-input-container.hidden {
        display: none !important;
    }

.chat-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 20px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    min-height: 20px;
    max-height: 60px;
    overflow-y: auto;
}

    .chat-input:focus {
        outline: none;
        border-color: #007bff;
    }

    .chat-input:disabled {
        background: #f8f9fa;
        cursor: not-allowed;
    }

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

    .send-btn:hover:not(:disabled) {
        background: #0056b3;
        transform: scale(1.1);
    }

    .send-btn:disabled {
        background: #ccc;
        cursor: not-allowed;
    }

    .send-btn:not(:disabled) {
        background-color: #007bff;
        cursor: pointer;
    }

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
    .chat-container {
        width: 420px;
        height: 650px;
    }

    .chat-toggle-btn {
        width: 65px;
        height: 65px;
        font-size: 26px;
    }
}

/* Desktop (992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .chat-container {
        width: 400px;
        height: 600px;
    }
}

/* Tablet Landscape (768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .chat-container {
        width: 380px;
        height: 550px;
        bottom: 15px;
        right: 15px;
    }

    .chat-toggle-btn {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 22px;
    }

    .customer-info-form {
        padding: 15px;
    }

    .messages-container {
        padding: 12px;
    }

    .chat-input-container {
        padding: 12px;
        gap: 8px;
    }
}

/* Tablet Portrait (576px to 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .chat-container {
        width: 350px;
        height: 500px;
        bottom: 10px;
        right: 10px;
    }

    .chat-toggle-btn {
        bottom: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .chat-header {
        padding: 12px 15px;
    }

        .chat-header h3 {
            font-size: 16px;
        }

    .customer-info-form {
        padding: 15px;
    }

    .form-group input {
        padding: 8px;
        font-size: 13px;
    }

    .messages-container {
        padding: 10px;
    }

    .message-bubble {
        font-size: 13px;
        padding: 8px 12px;
    }

    .chat-input-container {
        padding: 10px;
        gap: 8px;
    }

    .chat-input {
        padding: 8px 12px;
        font-size: 13px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* Mobile Large (480px to 575px) */
@media (min-width: 480px) and (max-width: 575px) {
    .chat-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 10px;
        right: 10px;
        left: 10px;
        border-radius: 10px;
        max-width: 450px;
        margin: 0 auto;
    }

    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .chat-header {
        padding: 12px;
    }

        .chat-header h3 {
            font-size: 16px;
        }

    .customer-info-form {
        padding: 12px;
    }

    .form-group {
        margin-bottom: 12px;
    }

        .form-group input {
            padding: 8px;
            font-size: 14px;
        }

    .messages-container {
        padding: 10px;
    }

    .message {
        max-width: 85%;
    }

    .message-bubble {
        font-size: 13px;
        padding: 8px 12px;
    }

    .chat-input-container {
        padding: 10px;
        gap: 8px;
    }

    .chat-input {
        padding: 8px 12px;
        font-size: 14px;
        border-radius: 18px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* Mobile Small (320px to 479px) */
@media (max-width: 479px) {
    .chat-container {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .chat-header {
        padding: 10px 15px;
    }

        .chat-header h3 {
            font-size: 16px;
        }

    .connection-status {
        padding: 4px 10px;
        font-size: 11px;
    }

    .customer-info-form {
        padding: 15px 10px;
    }

    .form-group {
        margin-bottom: 10px;
    }

        .form-group input {
            padding: 8px;
            font-size: 14px;
        }

    .customer-selection {
        padding: 10px;
    }

    .messages-container {
        padding: 10px 8px;
    }

    .message {
        margin-bottom: 12px;
        max-width: 90%;
    }

    .message-bubble {
        font-size: 14px;
        padding: 8px 12px;
        border-radius: 16px;
    }

    .message.sent .message-bubble {
        border-bottom-right-radius: 4px;
    }

    .message.received .message-bubble {
        border-bottom-left-radius: 4px;
    }

    .chat-input-container {
        padding: 10px 8px;
        gap: 6px;
    }

    .chat-input {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 18px;
        max-height: 80px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* Ultra-wide screens (1400px and up) */
@media (min-width: 1400px) {
    .chat-container {
        width: 450px;
        height: 700px;
    }

    .chat-toggle-btn {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    .chat-header h3 {
        font-size: 20px;
    }

    .message-bubble {
        font-size: 15px;
    }
}

/* Extra small devices (less than 320px) */
@media (max-width: 319px) {
    .chat-container {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
    }

    .chat-header {
        padding: 8px 10px;
    }

        .chat-header h3 {
            font-size: 14px;
        }

    .customer-info-form {
        padding: 10px 8px;
    }

    .form-group input {
        padding: 6px 8px;
        font-size: 13px;
    }

    .messages-container {
        padding: 8px 6px;
    }

    .message-bubble {
        font-size: 13px;
        padding: 6px 10px;
    }

    .chat-input-container {
        padding: 8px 6px;
        gap: 4px;
    }

    .chat-input {
        padding: 8px 10px;
        font-size: 13px;
    }

    .send-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chat-toggle-btn {
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4);
    }

    .chat-container {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .chat-container {
        height: calc(100vh - 20px);
        max-height: calc(100vh - 20px);
    }

    .customer-info-form {
        padding: 10px 15px;
    }

    .form-group {
        margin-bottom: 8px;
    }

    .messages-container {
        padding: 8px 15px;
    }

    .message {
        margin-bottom: 8px;
    }

    .chat-input-container {
        padding: 8px 15px;
    }
}

/* Print styles */
@media print {
    .chat-container,
    .chat-toggle-btn {
        display: none !important;
    }
}
