/* Chatbot Widget Styles */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}

.chatbot-toggle {
    background: linear-gradient(135deg, #C4182C 0%, #8B1C1C 50%, #6B1A1A 100%);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(196, 24, 44, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-glow 3s ease-in-out infinite;
    overflow: hidden;
    position: relative;
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%, rgba(255,255,255,0.1) 100%);
    border-radius: 50%;
    transition: opacity 0.3s ease;
}

.chatbot-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(196, 24, 44, 0.6);
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 50%, #7F1C1C 100%);
}

.chatbot-toggle:hover::before {
    opacity: 0.8;
}

.chatbot-toggle.active {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    transform: rotate(45deg);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.chatbot-toggle svg.chatbot-icon {
    fill: white !important;
}

.chatbot-toggle svg.chatbot-icon path {
    fill: white !important;
}

.chatbot-toggle:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(196, 24, 44, 0.4);
    }
    50% {
        box-shadow: 0 8px 35px rgba(196, 24, 44, 0.6);
    }
}

.chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(196, 24, 44, 0.1);
    z-index: 1001;
}

.chatbot-container.active {
    display: flex;
    transform: scale(1) translateY(0);
    opacity: 1;
    animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInUp {
    0% {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #C4182C 0%, #8B1C1C 50%, #6B1A1A 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
}

.chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 1;
    position: relative;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
    position: relative;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.chatbot-close svg {
    fill: white;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
    position: relative;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #C4182C 0%, #8B1C1C 100%);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
}

.chatbot-message {
    margin-bottom: 16px;
    animation: messageSlideIn 0.4s ease-out;
}

.chatbot-message.message-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease-out;
}

.chatbot-message.message-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    animation: bubbleBounce 0.3s ease-out;
}

@keyframes bubbleBounce {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    60% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.message-bubble.user {
    background: linear-gradient(135deg, #C4182C 0%, #8B1C1C 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(196, 24, 44, 0.3);
    position: relative;
    overflow: hidden;
}

.message-bubble.user::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: messageShimmer 2s ease-in-out infinite;
}

@keyframes messageShimmer {
    0%, 100% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        transform: translateX(100%);
        opacity: 1;
    }
}

.message-bubble.bot {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
    margin-right: auto;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(196, 24, 44, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-time {
    font-size: 11px;
    color: #64748b;
    text-align: right;
    margin-top: 4px;
}

.chatbot-message.user .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

.chatbot-message.bot .message-time {
    text-align: left;
}

.chatbot-input-area {
    padding: 20px;
    background: linear-gradient(to top, #ffffff 0%, #f8fafc 100%);
    border-top: 1px solid rgba(196, 24, 44, 0.1);
}

.chatbot-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    background: white;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.chatbot-input:focus {
    border-color: #C4182C;
    box-shadow: 0 0 0 3px rgba(196, 24, 44, 0.1), inset 0 2px 4px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.chatbot-send-btn {
    background: linear-gradient(135deg, #C4182C 0%, #8B1C1C 100%);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(196, 24, 44, 0.3);
    position: relative;
    overflow: hidden;
}

.chatbot-send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
    border-radius: 50%;
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.chatbot-send-btn:hover::before {
    transform: translateX(100%);
}

.chatbot-send-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(196, 24, 44, 0.5);
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
}

.chatbot-send-btn:active {
    transform: translateY(0) scale(0.95);
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
    transition: transform 0.3s ease;
    z-index: 1;
    position: relative;
}

.chatbot-send-btn:hover svg {
    transform: scale(1.1) rotate(15deg);
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 18px;
    max-width: 80%;
    border: 1px solid rgba(196, 24, 44, 0.1);
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #C4182C 0%, #8B1C1C 100%);
    border-radius: 50%;
    animation: typingDot 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0ms;
}

.typing-dot:nth-child(2) {
    animation-delay: 150ms;
}

.typing-dot:nth-child(3) {
    animation-delay: 300ms;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }
    
    .chatbot-header {
        padding: 16px 20px;
        position: relative;
        z-index: 10000;
    }
    
    .chatbot-header h3 {
        font-size: 16px;
    }
    
    .chatbot-messages {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .chatbot-input-area {
        padding: 16px;
        background: white;
        border-top: 1px solid #e2e8f0;
    }
    
    .chatbot-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 10px 14px;
    }
    
    .chatbot-send-btn {
        width: 40px;
        height: 40px;
    }
    
    .chatbot-send-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }
    
    .chatbot-toggle {
        width: 52px;
        height: 52px;
    }
    
    .chatbot-toggle svg {
        width: 22px;
        height: 22px;
    }
    
    .chatbot-header {
        padding: 14px 16px;
    }
    
    .chatbot-header h3 {
        font-size: 15px;
    }
    
    .chatbot-close {
        width: 28px;
        height: 28px;
    }
    
    .chatbot-messages {
        padding: 12px;
    }
    
    .message-bubble {
        max-width: 90%;
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 16px;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    .chatbot-input-area {
        padding: 12px;
    }
    
    .chatbot-input-form {
        gap: 8px;
    }
    
    .chatbot-input {
        font-size: 16px !important;
        padding: 8px 12px;
        border-radius: 20px;
    }
    
    .chatbot-send-btn {
        width: 36px;
        height: 36px;
    }
    
    .chatbot-send-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Markdown styles for chatbot messages */
.message-bubble.bot strong {
    font-weight: 600;
    color: #1e293b;
}

.message-bubble.bot em {
    font-style: italic;
    color: #475569;
}

.message-bubble.bot code {
    background: rgba(196, 24, 44, 0.1);
    color: #C4182C;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-bubble.bot a {
    color: #C4182C;
    text-decoration: underline;
    font-weight: 500;
}

.message-bubble.bot a:hover {
    color: #8B1C1C;
    text-decoration: none;
}

.chatbot-list {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-list li {
    margin: 4px 0;
    list-style-type: disc;
}

.chatbot-ordered-list {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-ordered-list li {
    margin: 4px 0;
    list-style-type: decimal;
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .chatbot-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .chatbot-toggle {
        width: 60px;
        height: 60px;
    }
    
    .chatbot-close {
        width: 36px;
        height: 36px;
    }
    
    .chatbot-send-btn {
        width: 44px;
        height: 44px;
    }
    
    .message-bubble {
        padding: 12px 16px;
    }
}

/* Prevent body scroll when chatbot is open on mobile */
@media (max-width: 768px) {
    body.chatbot-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
}
