/* ========================================= */
/* General Chat Widget Styles (For Desktop)  */
/* ========================================= */

#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-width: 90%;
    z-index: 1050; /* Chat box hamesha upar show hoga */
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    border-radius: 15px;
    overflow: hidden;
    background-color: white;
    transition: all 0.3s ease-in-out;
}

#chat-header {
    background: linear-gradient(to right, #5d001e, #8c002c);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#chat-header #chat-title {
    margin-right: 10px;
}

#notification-badge {
    background: #ff4136;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    margin-left: 8px;
    font-weight: bold;
    color: white;
    box-shadow: 0 0 5px rgba(255, 65, 54, 0.5);
    transition: all 0.3s ease;
    transform-origin: center;
}
#notification-badge:empty {
    display: none !important;
}

#toggle-chat {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    transform: scaleY(0.8);
    transition: transform 0.2s ease;
}

#toggle-chat:hover {
    transform: scaleY(0.8) scale(1.1);
}

#chat-widget.minimized #toggle-chat {
    /* transform: rotate(90deg); */
}


/* Chat Container (main body) */
#chat-container {
    background: white;
    border: none;
    height: 400px;
    display: flex;
    flex-direction: column;
}

/* Chat Messages Area */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fdfdfd;
    border-bottom: 1px solid #eee;
}

/* Custom scrollbar for chat messages (for a cleaner look) */
#chat-messages::-webkit-scrollbar {
    width: 8px;
}
#chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
#chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.no-messages {
    text-align: center;
    color: #888;
    padding: 20px;
    font-style: italic;
}

/* Typing Indicator */
#typing-indicator {
    color: #666;
    font-style: italic;
    font-size: 13px;
    padding: 8px 15px;
    background-color: #f0f0f0;
    border-top: 1px solid #eee;
    display: none;
}

/* Chat Form Area (contains visitor info and message input) */
#chat-form {
    padding: 15px;
    border-top: 1px solid #eee;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Input Fields (Visitor Info & Message) */
#visitor-info-form input[type="text"],
#visitor-info-form input[type="email"],
#visitor-info-form input[type="tel"],
#message-form textarea {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 0.95em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#visitor-info-form input[type="text"]:focus,
#visitor-info-form input[type="email"]:focus,
#visitor-info-form input[type="tel"]:focus,
#message-form textarea:focus {
    border-color: #5d001e;
    box-shadow: 0 0 0 3px rgba(93, 0, 30, 0.1);
    outline: none;
}

#message-form textarea {
    min-height: 60px;
    max-height: 120px;
    resize: vertical;
}

/* Buttons */
#start-chat,
#send-message {
    background: #5d001e;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 1.05em;
    font-weight: bold;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

#start-chat:hover,
#send-message:hover {
    background: #8c002c;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#start-chat:active,
#send-message:active {
    transform: translateY(0);
    box-shadow: none;
}

#start-chat:disabled,
#send-message:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Message Bubbles - Styles extracted and refined from your JavaScript */
.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.message.admin-message {
    background-color: #e3f2fd;
    color: #333;
    margin-left: auto;
    margin-right: 0;
    border-bottom-right-radius: 4px;
}

.message.visitor-message {
    background-color: #5d001e;
    color: white;
    margin-left: 0;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message div:first-child {
    margin-bottom: 4px;
}

.message div:last-child {
    font-size: 11px;
    color: rgba(0,0,0,0.6);
    text-align: right;
}

.message.visitor-message div:last-child {
    color: rgba(255,255,255,0.7);
}

/* ====================================== */
/* Global Desktop Hide Rule */
/* ====================================== */
.fixed-top-header, .fixed-bottom-bar {
    display: none; /* Desktop par hide karne ke liye */
}


/* ====================================== */
/* Mobile-specific Styles (Media Queries) */
/* ====================================== */

@media (max-width: 767.98px) {

    /* Chat Widget mobile styles */
    #chat-widget {
        width: 280px;
        right: 10px;
        bottom: 70px; /* Chat box ki position ko adjust kiya gaya hai */
    }

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

    /* 'Live Chat Support' text ko sirf mobile par chupayenge */
    #chat-header #chat-title {
        display: none;
    }

    #notification-badge {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    #chat-container {
        height: 320px;
    }

    #typing-indicator {
        font-size: 11px;
        padding: 6px 10px;
    }

    #message-form textarea {
        min-height: 50px;
    }

    #start-chat,
    #send-message {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    /* Minimized chat widget icon ko mobile par force kar ke chupa denge */
    #chat-widget.minimized {
        display: none !important;
    }
    
    /* Fixed top header (mobile only) */
    .fixed-top-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background-color: #333;
        color: white;
        padding: 5px 0;
        z-index: 1030;
        text-align: center;
        display: flex !important; /* Mobile par show karne ke liye */
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
    }

    .header-content {
        display: flex;
        justify-content: center;
        gap: 15px;
    }

    .header-contact {
        color: white;
        text-decoration: none;
        font-size: 0.8em;
        display: flex;
        align-items: center;
        transition: color 0.3s ease;
    }

    .header-contact:hover {
        color: #ffd700;
    }

    .header-contact i {
        margin-right: 8px;
    }

    /* Fixed bottom bar (mobile only) */
    .fixed-bottom-bar {
        display: flex !important; /* Mobile par show karne ke liye */
        position: fixed;
        bottom: 0px;
        left: 0;
        width: 100%;
        height: 60px;
        z-index: 1020;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    /* Call button ko mobile par wapas show karenge aur usay yellow color denge */
    .call-now {
        background-color: #f7d20a;
        color: #333;
    }

    .bar-button {
        flex-grow: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        color: white;
        text-decoration: none;
        font-size: 1.1em;
        font-weight: bold;
        transition: background-color 0.3s ease;
    }

    .bar-button i {
        margin-right: 8px;
    }

    .bar-button:active {
        transform: scale(0.98);
    }
    
    .chat-now {
        background-color: #1a1a1a;
    }
}