/* ============================================
   PORTFOLIO CHATBOT STYLES
   Modern Glassmorphism Design
   ============================================ */

/* Chatbot Bubble */
.chatbot-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    animation: chatbotPulse 2s infinite;
}

.chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.chatbot-bubble i {
    font-size: 24px;
    color: white;
}

/* Pulse Ring Animation */
.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes chatbotPulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(118, 75, 162, 0.4);
    }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateY(100%) scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.chatbot-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Chatbot Header */
.chatbot-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px 20px 0 0;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.chatbot-avatar i {
    font-size: 18px;
    color: white;
}

.chatbot-info {
    flex: 1;
}

.chatbot-info h6 {
    margin: 0;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.chatbot-info span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.chatbot-close {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* Message Styles */
.chatbot-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: messageSlideIn 0.3s ease;
}

.chatbot-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.chatbot-message.bot .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chatbot-message.user .message-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chatbot-message.bot .message-content {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-bottom-left-radius: 6px;
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 6px;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing Indicator */
.chatbot-message.typing .message-content {
    padding: 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: typingDots 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 typingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area */
.chatbot-input {
    display: flex;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0 0 20px 20px;
    gap: 10px;
}

#chatbot-input-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

#chatbot-input-field::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#chatbot-input-field:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

/* ============================================
   COMPREHENSIVE MOBILE RESPONSIVE DESIGN
   ============================================ */

/* Large Tablets */
@media (max-width: 1200px) {
    .chatbot-window {
        width: 380px;
        height: 520px;
    }
    
    .chatbot-bubble {
        width: 65px;
        height: 65px;
    }
    
    .chatbot-bubble i {
        font-size: 26px;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .chatbot-window {
        width: 360px;
        height: 500px;
        bottom: 25px;
        right: 25px;
    }
    
    .chatbot-bubble {
        bottom: 25px;
        right: 25px;
        width: 60px;
        height: 60px;
    }
    
    .chatbot-bubble i {
        font-size: 24px;
    }
    
    .chatbot-header {
        padding: 18px;
    }
    
    .chatbot-messages {
        padding: 18px;
    }
    
    .chatbot-input {
        padding: 18px;
    }
}

/* Mobile Landscape and Small Tablets */
@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 20px;
        right: 20px;
        max-width: 400px;
        max-height: 600px;
    }
    
    .chatbot-bubble {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .chatbot-bubble i {
        font-size: 22px;
    }
    
    .chatbot-header {
        padding: 16px;
    }
    
    .chatbot-avatar {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }
    
    .chatbot-avatar i {
        font-size: 16px;
    }
    
    .chatbot-info h6 {
        font-size: 13px;
    }
    
    .chatbot-info span {
        font-size: 11px;
    }
    
    .chatbot-close {
        width: 28px;
        height: 28px;
    }
    
    .chatbot-messages {
        padding: 16px;
        gap: 12px;
    }
    
    .message-avatar {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    
    .message-content {
        max-width: 75%;
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 16px;
    }
    
    .chatbot-message.bot .message-content {
        border-bottom-left-radius: 5px;
    }
    
    .chatbot-message.user .message-content {
        border-bottom-right-radius: 5px;
    }
    
    .chatbot-input {
        padding: 16px;
        gap: 8px;
    }
    
    #chatbot-input-field {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 20px;
    }
    
    .chatbot-send-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* Mobile Portrait */
@media (max-width: 576px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 15px;
        right: 10px;
        border-radius: 16px;
    }
    
    .chatbot-bubble {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
    
    .chatbot-bubble i {
        font-size: 20px;
    }
    
    .chatbot-header {
        padding: 14px;
        border-radius: 16px 16px 0 0;
    }
    
    .chatbot-avatar {
        width: 32px;
        height: 32px;
        margin-right: 8px;
    }
    
    .chatbot-avatar i {
        font-size: 14px;
    }
    
    .chatbot-info h6 {
        font-size: 12px;
    }
    
    .chatbot-info span {
        font-size: 10px;
    }
    
    .chatbot-close {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    
    .chatbot-messages {
        padding: 14px;
        gap: 10px;
    }
    
    .message-avatar {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .message-content {
        max-width: 80%;
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 14px;
        line-height: 1.3;
    }
    
    .chatbot-message.bot .message-content {
        border-bottom-left-radius: 4px;
    }
    
    .chatbot-message.user .message-content {
        border-bottom-right-radius: 4px;
    }
    
    .chatbot-input {
        padding: 14px;
        gap: 6px;
        border-radius: 0 0 16px 16px;
    }
    
    #chatbot-input-field {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 18px;
    }
    
    .chatbot-send-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    /* Typing indicator mobile */
    .typing-dots span {
        width: 5px;
        height: 5px;
    }
}

/* Extra Small Mobile */
@media (max-width: 375px) {
    .chatbot-window {
        width: calc(100vw - 15px);
        height: calc(100vh - 90px);
        bottom: 10px;
        right: 7px;
    }
    
    .chatbot-bubble {
        bottom: 12px;
        right: 12px;
        width: 45px;
        height: 45px;
    }
    
    .chatbot-bubble i {
        font-size: 18px;
    }
    
    .chatbot-header {
        padding: 12px;
    }
    
    .chatbot-avatar {
        width: 28px;
        height: 28px;
        margin-right: 6px;
    }
    
    .chatbot-avatar i {
        font-size: 12px;
    }
    
    .chatbot-info h6 {
        font-size: 11px;
    }
    
    .chatbot-info span {
        font-size: 9px;
    }
    
    .chatbot-close {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .chatbot-messages {
        padding: 12px;
        gap: 8px;
    }
    
    .message-avatar {
        width: 22px;
        height: 22px;
        font-size: 9px;
    }
    
    .message-content {
        max-width: 85%;
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 12px;
    }
    
    .chatbot-input {
        padding: 12px;
        gap: 5px;
    }
    
    #chatbot-input-field {
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 16px;
    }
    
    .chatbot-send-btn {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
}

/* Landscape Mobile Orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .chatbot-window {
        width: calc(50vw - 20px);
        height: calc(100vh - 80px);
        max-width: 350px;
        max-height: 500px;
    }
    
    .chatbot-bubble {
        width: 45px;
        height: 45px;
    }
    
    .chatbot-bubble i {
        font-size: 18px;
    }
    
    .chatbot-header {
        padding: 12px;
    }
    
    .chatbot-messages {
        padding: 12px;
    }
    
    .chatbot-input {
        padding: 12px;
    }
    
    .message-content {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .chatbot-bubble:hover,
    .chatbot-close:hover,
    .chatbot-send-btn:hover {
        transform: none;
    }
    
    .chatbot-bubble,
    .chatbot-close,
    .chatbot-send-btn {
        transition: background-color 0.3s ease, box-shadow 0.3s ease;
        min-height: 44px;
        min-width: 44px;
    }
    
    .chatbot-bubble:active {
        background: linear-gradient(135deg, #5a6fd8, #6a4190);
    }
    
    .chatbot-send-btn:active {
        background: linear-gradient(135deg, #5a6fd8, #6a4190);
    }
    
    /* Improve touch scrolling */
    .chatbot-messages {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Larger touch targets for input */
    #chatbot-input-field {
        min-height: 40px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chatbot-avatar,
    .message-avatar {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .chatbot-window {
        transition: opacity 0.3s ease;
    }
    
    .chatbot-window.active {
        transform: none;
    }
    
    .chatbot-bubble {
        animation: none;
    }
    
    .pulse-ring {
        animation: none;
    }
    
    .typing-dots span {
        animation: none;
    }
    
    @keyframes messageSlideIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* Dark Theme Enhancements */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .chatbot-header {
        background: rgba(0, 0, 0, 0.2);
    }
    
    .chatbot-input {
        background: rgba(0, 0, 0, 0.2);
    }
}