/* ============================================================
   AI CHATBOT WIDGET - FELNYÍLÓ ABLAK (JOBB ALSÓ SAROK)
   ============================================================ */

/* Chat widget konténer */
#chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Megnyitó gomb */
#chat-widget-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6f42c1 0%, #8b5cf6 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(111, 66, 193, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#chat-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(111, 66, 193, 0.5);
}

#chat-widget-toggle.active {
    background: linear-gradient(135deg, #dc3545 0%, #f87171 100%);
}

/* Chat ablak */
#chat-widget-window {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: 95vw;
    height: 500px;
    max-height: 70vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

#chat-widget-window.open {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat fejléc */
#chat-widget-header {
    background: linear-gradient(135deg, #6f42c1 0%, #8b5cf6 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#chat-widget-header h4,
#chat-widget-header .chat-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

#chat-widget-header .chat-header-title i {
    font-size: 18px;
}

#chat-widget-header .chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

#chat-widget-header .chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Üzenetlista */
#chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

/* Üzenet buborékok */
.chat-msg {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg.user {
    background: linear-gradient(135deg, #6f42c1 0%, #8b5cf6 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.ai {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-msg.ai a {
    color: #6f42c1;
    font-weight: 600;
    text-decoration: underline;
}

.chat-msg.ai .call-link {
    color: #28a745 !important;
}

/* Chat URL linkek stílusa */
.chat-msg.ai .chat-link {
    color: #007bff !important;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 6px;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 4px;
    display: inline-block;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.chat-msg.ai .chat-link:hover {
    background: rgba(0, 123, 255, 0.2);
    text-decoration: none;
}

.chat-msg.ai .chat-link i {
    margin-right: 4px;
    font-size: 10px;
    font-weight: bold;
    display: block;
    margin-top: 8px;
}

.chat-msg.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.chat-msg.limit-reached {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Beviteli terület */
#chat-widget-input-area {
    padding: 12px 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

#chat-widget-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

#chat-widget-input:focus {
    border-color: #6f42c1;
}

#chat-widget-send-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #6f42c1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

#chat-widget-send-btn:hover {
    transform: scale(1.05);
}

#chat-widget-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Chat widget footer (számláló + reset gomb) */
#chat-widget-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

/* Kérdésszámláló */
#chat-widget-counter {
    font-size: 11px;
    color: #888;
}

/* Reset gomb */
#chat-widget-reset {
    display: inline-flex;
    padding: 5px 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
    align-items: center;
    gap: 5px;
}

#chat-widget-reset:hover {
    background: #5a6268;
}

#chat-widget-reset i {
    font-size: 10px;
}

/* Loading animáció */
.chat-msg.loading {
    background: #e9ecef;
    color: #6c757d;
}

.chat-msg.loading i {
    margin-right: 8px;
}

/* Reszponzív - TABLET (992px alatt) */
@media (max-width: 991.98px) {
    /* Chat widget konténer tableten fix pozíció, nagyobb z-index */
    #chat-widget-container {
        bottom: 15px;
        right: 15px;
        z-index: 10000;
    }
    
    /* Kisebb toggle gomb tableten */
    #chat-widget-toggle {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    /* Chat ablak - fix pozíció, 20px padding minden oldalon */
    #chat-widget-window {
        position: fixed !important;
        top: 20px !important;
        left: 20px !important;
        right: 20px !important;
        bottom: 20px !important;
        width: calc(100% - 40px) !important;
        height: calc(100% - 40px) !important;
        max-width: calc(100% - 40px) !important;
        max-height: calc(100% - 40px) !important;
        border-radius: 16px;
        z-index: 10001;
    }
    
    /* Fejléc kicsit magasabb tableten */
    #chat-widget-header {
        padding: 18px 15px;
    }
    
    /* Beviteli mező tableten */
    #chat-widget-input-area {
        padding: 15px;
    }
    
    #chat-widget-input {
        font-size: 16px; /* Megakadályozza a zoom-ot iOS-en */
        padding: 14px 18px;
    }
    
    /* Üzenet buborékok tableten */
    .chat-msg {
        max-width: 90%;
        font-size: 15px;
    }
}

/* Reszponzív - MOBIL (768px alatt) */
@media (max-width: 767.98px) {
    /* Chat widget konténer mobilon */
    #chat-widget-container {
        bottom: 12px;
        right: 12px;
    }
    
    /* Kisebb toggle gomb mobilon */
    #chat-widget-toggle {
        width: 52px;
        height: 52px;
        font-size: 21px;
    }
    
    /* Chat ablak - fix pozíció, 20px padding minden oldalon */
    #chat-widget-window {
        position: fixed !important;
        top: 20px !important;
        left: 20px !important;
        right: 20px !important;
        bottom: 20px !important;
        width: calc(100% - 40px) !important;
        height: calc(100% - 40px) !important;
        max-width: calc(100% - 40px) !important;
        max-height: calc(100% - 40px) !important;
        border-radius: 16px;
        z-index: 10001;
    }
}

/* Reszponzív - KIS MOBIL (480px alatt) */
@media (max-width: 480px) {
    #chat-widget-container {
        bottom: 10px;
        right: 10px;
    }
    
    #chat-widget-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
        box-shadow: 0 3px 15px rgba(111, 66, 193, 0.5);
    }
    
    /* Footer és counter kisebb mobilon */
    #chat-widget-footer {
        padding: 10px 12px;
    }
    
    #chat-widget-counter {
        font-size: 10px;
    }
    
    #chat-widget-reset {
        font-size: 10px;
        padding: 4px 10px;
    }
}

/* Scrollbar stílus */
#chat-widget-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-widget-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-widget-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
