/* HITS AI Chatbot Styling - Premium Glassmorphism */

:root {
    --chat-primary: #800000; /* HITS Maroon */
    --chat-secondary: #d48300; /* HITS Orange */
    --chat-bg: rgba(255, 255, 255, 0.85);
    --chat-text: #4a4a4a;
    --chat-radius: 20px;
    --chat-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

#hits-chatbot {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--chat-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: none;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
    font-family: var(--body-font, sans-serif);
}

.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), #5a0000);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-family: var(--heading-font, sans-serif);
    font-weight: 500;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.close-btn:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--chat-primary) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-primary);
    border-radius: 10px;
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message {
    align-self: flex-start;
    background: #f0f0f0;
    color: var(--chat-text);
    border-bottom-left-radius: 5px;
}

.user-message {
    align-self: flex-end;
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 10px rgba(128, 0, 0, 0.2);
}

.chat-input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    border: 1px solid #ddd;
    padding: 12px 15px;
    border-radius: 25px;
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: var(--chat-primary);
}

.send-btn {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background 0.3s;
    box-shadow: 0 4px 10px rgba(128, 0, 0, 0.2);
}

.send-btn:hover {
    transform: scale(1.05);
    background: #5a0000;
}

/* Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--chat-secondary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(212, 131, 0, 0.4);
    z-index: 10001;
    transition: transform 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    background: #b87100;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px !important;
    background: #f0f0f0 !important;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typing 1s infinite alternate;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    from { opacity: 0.3; transform: translateY(0); }
    to { opacity: 1; transform: translateY(-5px); }
}

/* Speak Button */
.speak-btn {
    background: transparent;
    border: none;
    color: var(--chat-primary);
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 8px;
    display: block;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.speak-btn:hover {
    opacity: 1;
}

/* Switch Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--chat-primary);
}

input:checked + .slider:before {
  -webkit-transform: translateX(14px);
  -ms-transform: translateX(14px);
  transform: translateX(14px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

@media (max-width: 768px) {
    #hits-chatbot {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 100px;
        height: 60vh;
        max-height: 500px;
    }
}

@media (max-width: 480px) {
    #hits-chatbot {
        width: 100%;
        right: 0;
        bottom: 0;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}
