/* AI UniMentorAI by Neuro Chatbot Styles */

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
    filter: drop-shadow(0 20px 40px rgba(102, 126, 234, 0.3));
    /* Ensure proper positioning on all platforms */
    max-width: calc(100vw - 60px);
    max-height: calc(100vh - 60px);
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.5), 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.chatbot-toggle:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.7), 0 8px 25px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 30%, #f093fb 70%, #f5576c 100%);
}

.chatbot-toggle:active {
    transform: scale(1.05) rotate(2deg);
}

.chatbot-icon {
    color: white;
    font-size: 32px;
    z-index: 2;
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
}

.chatbot-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    animation: pulse 2.5s infinite;
    opacity: 0.6;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.2;
    }
    100% {
        transform: scale(1);
        opacity: 0.6;
    }
}

.chatbot-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff4757 0%, #ff6b7a 100%);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    animation: bounce 1.2s infinite;
    display: none;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    border: 2px solid white;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    width: 500px;
    height: 700px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 25px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(102, 126, 234, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(102, 126, 234, 0.15);
    backdrop-filter: blur(10px);
    z-index: 10001;
    /* Ensure window stays within viewport on all platforms */
    max-width: calc(100vw - 60px);
    max-height: calc(100vh - 60px);
    min-width: 320px;
    min-height: 400px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(-50%) translateY(30px) scale(0.9) rotate(2deg);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateY(0) scale(1) rotate(0deg);
    }
}

.chatbot-window.active {
    display: flex;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 25px;
    display: flex;
    align-items: center;
    color: white;
    position: relative;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    overflow: hidden;
}

.chatbot-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: avatarGlow 3s ease-in-out infinite;
}

@keyframes avatarGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3); }
}

.chatbot-info h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.chatbot-status {
    font-size: 14px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.chatbot-status::before {
    content: '';
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 2s infinite;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.chatbot-controls {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.chatbot-minimize,
.chatbot-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.chatbot-minimize:hover,
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: linear-gradient(145deg, #f8fafc 0%, #ffffff 100%);
    position: relative;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.message {
    display: flex;
    gap: 15px;
    animation: messageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #64748b;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.message-content {
    flex: 1;
    max-width: 380px;
}

.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-bubble {
    background: white;
    padding: 16px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.05);
    position: relative;
    word-wrap: break-word;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.bot-message .message-bubble {
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
}

.message-bubble p {
    margin: 0 0 10px 0;
    line-height: 1.6;
    font-size: 15px;
    font-weight: 500;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble ul {
    margin: 10px 0;
    padding-left: 18px;
}

.message-bubble li {
    margin: 6px 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
}

.quick-options {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.quick-options li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    font-size: 13px;
}

.quick-options li:last-child {
    border-bottom: none;
}

.message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

.user-message .message-time {
    text-align: left;
}

/* Chatbot Input */
.chatbot-input-container {
    padding: 25px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-top: 2px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.chatbot-input-wrapper {
    display: flex;
    align-items: center;
    background: linear-gradient(145deg, #f1f5f9 0%, #ffffff 100%);
    border-radius: 30px;
    padding: 12px 20px;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.chatbot-input-wrapper:focus-within {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

#chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    color: #334155;
    padding: 10px 0;
    font-weight: 500;
}

#chatbot-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.chatbot-send:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.chatbot-send:active {
    transform: scale(1.05) rotate(2deg);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Chatbot Suggestions */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.suggestion-btn {
    background: linear-gradient(145deg, #f1f5f9 0%, #ffffff 100%);
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    padding: 10px 16px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.suggestion-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.suggestion-btn i {
    font-size: 12px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.typing-indicator.active {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-text {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
}

/* Windows-specific fixes and general responsive design */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* Internet Explorer/Edge specific fixes */
    .chatbot-container {
        right: 20px;
        bottom: 20px;
    }
    
    .chatbot-window {
        right: 20px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }
}

/* Windows Chrome/Firefox specific adjustments */
@media screen and (min-width: 1024px) and (max-width: 1440px) {
    .chatbot-container {
        right: 25px;
        bottom: 25px;
    }
    
    .chatbot-window {
        right: 25px;
        width: 480px;
        height: 650px;
        max-width: calc(100vw - 50px);
        max-height: calc(100vh - 50px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 80px);
        top: 50%;
        right: 15px;
        transform: translateY(-50%);
        border-radius: 15px;
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 80px);
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
    }
    
    .chatbot-icon {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        height: calc(100vh - 80px);
        bottom: 70px;
    }
    
    .message-content {
        max-width: 280px;
    }
    
    .chatbot-suggestions {
        flex-direction: column;
    }
    
    .suggestion-btn {
        justify-content: center;
    }
}

/* Animation Classes */
.chatbot-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-slide-out {
    animation: slideOut 0.3s ease-in;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* Loading Animation */
.chatbot-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.message-action-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* University Card in Chat */
.university-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin: 8px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.university-card h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #1e293b;
}

.university-card p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.university-card .university-rank {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 6px;
}

/* Link Styling */
.message-bubble a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.message-bubble a:hover {
    text-decoration: underline;
}

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.error-message .message-bubble {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* Success Message */
.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.success-message .message-bubble {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #16a34a;
}

/* Additional Windows compatibility fixes */
@media screen and (min-width: 1200px) {
    .chatbot-window {
        /* Ensure proper positioning on large Windows screens */
        right: 30px;
        top: 50%;
        transform: translateY(-50%);
        width: 500px;
        height: 700px;
    }
}

/* Windows high DPI displays */
@media screen and (-webkit-min-device-pixel-ratio: 2), 
       screen and (min-resolution: 192dpi) {
    .chatbot-container {
        right: 25px;
        bottom: 25px;
    }
    
    .chatbot-window {
        right: 25px;
        max-width: calc(100vw - 50px);
        max-height: calc(100vh - 50px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 20px;
        right: 20px;
    }
    
    .chatbot-toggle {
        width: 70px;
        height: 70px;
    }
    
    .chatbot-icon {
        font-size: 28px;
    }
    
    .chatbot-window {
        width: 90vw;
        max-width: 500px;
        height: 75vh;
        max-height: 600px;
        top: 50%;
        right: 20px;
        transform: translateY(-50%);
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }
    
    .chatbot-header {
        padding: 20px;
    }
    
    .chatbot-avatar {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .chatbot-info h3 {
        font-size: 18px;
    }
    
    .chatbot-messages {
        padding: 20px;
        gap: 15px;
    }
    
    .message-bubble {
        padding: 14px 18px;
    }
    
    .message-bubble p {
        font-size: 14px;
    }
    
    .chatbot-input-container {
        padding: 20px;
    }
    
    .chatbot-input-wrapper {
        padding: 10px 16px;
    }
    
    #chatbot-input {
        font-size: 14px;
    }
    
    .chatbot-send {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .suggestion-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: 95vw;
        height: 80vh;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
    }
    
    .chatbot-header {
        padding: 15px;
    }
    
    .chatbot-messages {
        padding: 15px;
    }
    
    .chatbot-input-container {
        padding: 15px;
    }
}
