/* Live Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f6996, #2980b9);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(31, 105, 150, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(31, 105, 150, 0.4);
}

.chat-toggle.has-notification::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 550px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e6ed;
}

.chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-header {
    background: linear-gradient(135deg, #1f6996, #2980b9);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.chat-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-start-form {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
}

.form-group input,
.form-group select {
    padding: 8px 10px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #1f6996;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.message.user {
    background: #1f6996;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.message.admin,
.message.system {
    background: #f8f9fa;
    color: #2c3e50;
    align-self: flex-start;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 6px;
}

.message.system {
    background: #e8f4f8;
    color: #1f6996;
    font-style: italic;
    align-self: center;
    text-align: center;
    border-radius: 12px;
    max-width: 90%;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #e0e6ed;
    background: #f8f9fa;
}

.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: #f8f9fa;
    border-top: 1px solid #e0e6ed;
    margin-top: 0;
}

.back-to-menu-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    margin: 0;
    border: none;
    border-radius: 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    width: 100%;
    text-align: center;
}

.back-to-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

.chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0e6ed;
    border-radius: 20px;
    resize: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    max-height: 80px;
    min-height: 40px;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #1f6996;
}

.chat-send {
    background: #1f6996;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    background: #2980b9;
}

.chat-send:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn-primary {
    background: #1f6996;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 600;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e6ed;
    border-top: 2px solid #1f6996;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-offline {
    padding: 20px;
    text-align: center;
    color: #7f8c8d;
}

.chat-offline h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #7f8c8d;
    font-size: 12px;
    font-style: italic;
}

.typing-dots {
    display: inline-flex;
    margin-left: 5px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #7f8c8d;
    margin: 0 1px;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .chat-window {
        width: 100% !important;
        height: calc(100vh - 100px) !important;
        max-width: none !important;
        max-height: none !important;
        bottom: 70px;
        right: 0;
        left: 0;
        border-radius: 12px;
    }
    
    .faq-section {
        max-height: calc(100vh - 380px);
        min-height: 280px;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-title {
        font-size: 15px;
    }
    
    .chat-messages {
        padding: 12px;
        max-height: none !important;
        flex: 1;
    }
    
    .message {
        max-width: 85%;
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .message.system {
        max-width: 95%;
    }
    
    .chat-input-area {
        padding: 12px;
    }
    
    .chat-input {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .chat-send {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .chat-toggle {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 8px;
        right: 8px;
        left: 8px;
    }
    
    .chat-window {
        width: 100% !important;
        height: calc(100vh - 90px) !important;
        bottom: 65px;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-title {
        font-size: 14px;
    }
    
    .chat-status {
        font-size: 11px;
    }
    
    .chat-messages {
        padding: 10px;
        gap: 8px;
    }
    
    .message {
        max-width: 90%;
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    .chat-input-area {
        padding: 10px;
    }
    
    .chat-input {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 36px;
    }
    
    .chat-send {
        padding: 8px 14px;
        font-size: 12px;
        min-width: 60px;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Error message styling */
.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 15px;
    font-size: 13px;
    border: 1px solid #fcc;
}

/* Success message styling */
.success-message {
    background: #efe;
    color: #363;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 15px;
    font-size: 13px;
    border: 1px solid #cfc;
}

/* ============================================ */
/* FAQ Chatbot Styles */
/* ============================================ */

/* Welcome Message in Start Form */
.chat-welcome {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 8px;
    text-align: center;
}

.chat-welcome h3 {
    font-size: 14px;
    margin: 0 0 3px 0;
    font-weight: 600;
}

.chat-welcome p {
    font-size: 12px;
    margin: 0;
    opacity: 0.95;
}

/* FAQ Section Container */
.faq-section {
    padding: 10px 15px;
    max-height: 320px;
    overflow-y: auto;
    flex-shrink: 0;
}

.faq-section h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.faq-section h4 {
    font-size: 13px;
    color: #495057;
    margin-bottom: 10px;
    margin-top: 0;
    font-weight: 600;
}

/* FAQ Category */
.faq-category {
    margin-bottom: 10px;
}

.faq-category-btn {
    width: 100%;
    padding: 10px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.faq-category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.faq-category-btn:active {
    transform: translateY(0);
}

.faq-category-btn .arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.faq-category-btn.active .arrow {
    transform: rotate(180deg);
}

/* FAQ Questions List */
.faq-questions {
    display: none;
    padding: 8px 0;
    margin-top: 6px;
}

.faq-questions.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Individual FAQ Question Button */
.faq-question-btn {
    width: 100%;
    padding: 8px 12px;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: left;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.faq-question-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateX(5px);
}

.faq-question-btn:active {
    background: #dee2e6;
}

/* Chat Divider (OR separator) */
.chat-divider {
    display: flex;
    align-items: center;
    margin: 12px 15px;
    color: #6c757d;
    font-size: 12px;
    font-weight: 500;
}

.chat-divider::before,
.chat-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dee2e6;
}

.chat-divider::before {
    margin-right: 8px;
}

.chat-divider::after {
    margin-left: 8px;
}

/* Bot Message Styling */
.bot-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 12px 12px 12px 4px;
    margin: 10px 15px 10px 50px;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.bot-message .message-header {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.bot-message .message-content {
    margin-top: 6px;
}

.bot-message .message-content strong {
    font-weight: 700;
}

.bot-message .message-content a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

.bot-message .message-content a:hover {
    opacity: 0.8;
}

.bot-message .message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.bot-message .message-content li {
    margin: 4px 0;
}

/* Bot Action Buttons */
.bot-action-buttons {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    justify-content: center;
    margin: 0;
}

.bot-action-buttons button,
.bot-action-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    color: white;
}

.bot-action-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bot-action-btn.primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.bot-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.bot-action-buttons button:active {
    transform: translateY(0);
}

/* Welcome Message for Bot */
.bot-welcome {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin: 15px;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.bot-welcome h3 {
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.bot-welcome p {
    margin: 0;
    opacity: 0.95;
}

/* Scrollbar for FAQ Section */
.faq-section::-webkit-scrollbar {
    width: 6px;
}

.faq-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.faq-section::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.faq-section::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile Responsive Adjustments */
@media (max-width: 480px) {
    .chat-window {
        height: calc(100vh - 90px) !important;
    }
    
    .chat-start-form {
        padding: 12px;
        gap: 10px;
    }
    
    .chat-welcome {
        padding: 8px 12px;
        margin-bottom: 6px;
    }
    
    .chat-welcome h3 {
        font-size: 13px;
        margin-bottom: 2px;
    }
    
    .chat-welcome p {
        font-size: 11px;
    }
    
    .faq-section {
        padding: 8px 12px;
        max-height: calc(100vh - 420px);
        min-height: 250px;
    }
    
    .faq-section h4 {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .bot-message {
        margin: 10px 10px 10px 35px;
        padding: 10px 12px;
    }
    
    .faq-category-btn {
        padding: 9px 10px;
        font-size: 12px;
    }
    
    .faq-question-btn {
        padding: 7px 10px;
        font-size: 11px;
    }
    
    .bot-action-buttons {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
        margin: 0;
    }
    
    .bot-action-buttons button,
    .bot-action-btn {
        width: 100%;
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .back-to-menu-btn {
        padding: 12px 14px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        font-size: 13px !important;
    }
    
    .chat-input-container {
        padding: 0 !important;
        gap: 0 !important;
        margin-top: 0 !important;
    }
    
    .chat-messages {
        padding: 12px !important;
    }
    
    .bot-welcome {
        margin: 10px;
        padding: 12px;
        font-size: 13px;
    }
}