/* Chatbot Styles for Govindam Nursery */

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #4a7c59, #2d5a3d, #1e3a2a);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(74, 124, 89, 0.4), 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.chatbot-toggle:hover::before {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.chatbot-toggle:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 12px 40px rgba(74, 124, 89, 0.5), 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.chatbot-toggle:active {
    transform: scale(1.05);
    transition: all 0.1s ease;
}

.chatbot-toggle i {
    color: white;
    font-size: 28px;
    transition: all 0.4s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
    position: relative;
}

.chatbot-toggle:hover i {
    transform: scale(1.2) rotate(-5deg);
    filter: brightness(1.2);
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ff4757, #ff3742);
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    border: 2px solid white;
    z-index: 3;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 15px rgba(255, 71, 87, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    }
}

/* Add floating animation to the main button */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.chatbot-toggle {
    animation: float 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
    animation: none; /* Stop floating on hover */
}

/* Chatbot Window */
.chatbot-window {
    display: none;
    flex-direction: column;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #4a7c59, #2d5a3d);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.chatbot-title i {
    font-size: 18px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #4a7c59;
    border-radius: 3px;
}

/* Message Styles */
.chatbot-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a7c59, #2d5a3d);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.message-avatar.user-avatar {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 280px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    line-height: 1.4;
    max-height: 400px;
    overflow-y: auto;
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

/* Typing Indicator */
.typing-indicator .message-content {
    padding: 12px 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4a7c59;
    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);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Container */
.chatbot-input-container {
    display: flex;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 10px;
}

#chatbot-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

#chatbot-input:focus {
    border-color: #4a7c59;
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

.chatbot-send {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #4a7c59, #2d5a3d);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(74, 124, 89, 0.3);
}

.chatbot-send i {
    font-size: 16px;
}

/* Quick Actions */
.chatbot-quick-actions {
    display: flex;
    gap: 8px;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.quick-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #495057;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.quick-btn:hover {
    background: #4a7c59;
    color: white;
    border-color: #4a7c59;
    transform: translateY(-2px);
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 1024px) {
    .chatbot-container {
        bottom: 20px;
        right: 20px;
    }

    .chatbot-window {
        width: 360px;
        height: 520px;
    }
}

@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
    }

    .chatbot-window {
        width: calc(100vw - 40px);
        max-width: 350px;
        height: 500px;
        right: 20px;
        bottom: 90px;
    }

    .chatbot-toggle {
        width: 65px;
        height: 65px;
    }

    .chatbot-toggle i {
        font-size: 26px;
    }

    .message-content {
        max-width: calc(100vw - 140px);
        font-size: 14px;
    }

    .chatbot-messages {
        padding: 15px;
    }

    .chatbot-input-container {
        padding: 12px 15px;
    }

    .quick-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        max-height: 500px;
        right: 10px;
        bottom: 80px;
        border-radius: 15px;
    }

    .chatbot-toggle {
        width: 60px;
        height: 60px;
    }

    .chatbot-toggle i {
        font-size: 24px;
    }

    .message-content {
        max-width: calc(100vw - 120px);
        font-size: 13px;
        padding: 10px 14px;
    }

    .chatbot-messages {
        padding: 12px;
        gap: 12px;
    }

    .chatbot-input-container {
        padding: 10px 12px;
        gap: 8px;
    }

    #chatbot-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 14px;
    }

    .chatbot-send {
        width: 40px;
        height: 40px;
    }

    .chatbot-send i {
        font-size: 14px;
    }

    .quick-btn {
        font-size: 10px;
        padding: 5px 8px;
        border-radius: 15px;
    }

    .chatbot-badge {
        font-size: 9px;
        padding: 2px 6px;
        top: -3px;
        right: -3px;
    }
}

@media (max-width: 360px) {
    .chatbot-window {
        width: calc(100vw - 15px);
        right: 7px;
        bottom: 75px;
    }

    .chatbot-toggle {
        width: 55px;
        height: 55px;
    }

    .chatbot-toggle i {
        font-size: 22px;
    }

    .message-content {
        max-width: calc(100vw - 100px);
        font-size: 12px;
    }

    .chatbot-header {
        padding: 12px 15px;
    }

    .chatbot-title {
        font-size: 14px;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .chatbot-window {
        height: calc(100vh - 60px);
        max-height: 400px;
    }

    .chatbot-messages {
        padding: 10px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chatbot-toggle {
        border-width: 2px;
    }

    .chatbot-toggle i {
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .chatbot-toggle:hover {
        transform: scale(1.1);
        animation: none;
    }

    .chatbot-toggle:active {
        transform: scale(0.95);
        transition: all 0.1s ease;
    }

    .quick-btn:hover {
        background: #f8f9fa;
        color: #495057;
        transform: none;
    }

    .quick-btn:active {
        background: #4a7c59;
        color: white;
        transform: scale(0.95);
    }

    .chatbot-send:hover {
        transform: none;
    }

    .chatbot-send:active {
        transform: scale(0.9);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .chatbot-toggle {
        animation: none;
    }

    .chatbot-badge {
        animation: none;
    }

    .chatbot-window {
        animation: none;
    }

    .chatbot-message {
        animation: none;
    }

    .typing-dots span {
        animation: none;
    }

    .chatbot-container *,
    .chatbot-toggle,
    .chatbot-window,
    .chatbot-message,
    .message-content,
    .chatbot-send,
    .quick-btn {
        transition: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #2d3748;
        color: #e2e8f0;
    }

    .chatbot-messages {
        background: #1a202c;
    }

    .message-content {
        background: #4a5568;
        color: #e2e8f0;
    }

    .chatbot-message.user .message-content {
        background: linear-gradient(135deg, #007bff, #0056b3);
        color: white;
    }

    #chatbot-input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }

    #chatbot-input:focus {
        border-color: #4a7c59;
        background: #2d3748;
    }

    .quick-btn {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }

    .quick-btn:hover {
        background: #4a7c59;
        color: white;
    }
}
