/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10000;
}

/* Hide checkbox */
.chat-toggle {
    display: none;
}

/* Chat Button */
.chat-button {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #420d24 0%, #5a1233 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(66, 13, 36, 0.4);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    z-index: 2;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(66, 13, 36, 0.5);
    background: linear-gradient(135deg, #5a1233 0%, #6e1640 100%);
}

.chat-button i {
    font-size: 28px;
    color: white;
    transition: all 0.3s ease;
}

.chat-toggle:checked + .chat-button .chat-icon {
    transform: rotate(360deg) scale(0);
    opacity: 0;
}

.chat-toggle:checked + .chat-button .close-icon {
    transform: rotate(0deg) scale(1);
    opacity: 1;
}

.chat-button .close-icon {
    position: absolute;
    transform: rotate(180deg) scale(0);
    opacity: 0;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 85px;
    left: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom left;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    opacity: 0;
    visibility: hidden;
}

.chat-toggle:checked ~ .chat-window {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #420d24 0%, #5a1233 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-content i {
    font-size: 32px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 50%;
}

.chat-header-text h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-header-text p {
    margin: 5px 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

.status-text {
    font-size: 12px;
    font-weight: 500;
}

@keyframes statusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #420d24;
    border-radius: 5px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5a1233;
}

/* Message Bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeInUp 0.3s ease-out;
}

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

.message.received {
    align-items: flex-start;
}

.message.sent {
    align-items: flex-end;
    margin-left: auto;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 15px;
    position: relative;
    word-break: break-word;
}

.message.received .message-content {
    background: white;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
}

.message.sent .message-content {
    background: linear-gradient(135deg, #420d24 0%, #5a1233 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-content i {
    font-size: 20px;
    flex-shrink: 0;
}

.message.received .message-content i {
    color: #420d24;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.message-time {
    font-size: 10px;
    color: #999;
    margin-top: 5px;
    margin-left: 35px;
}

.message.sent .message-time {
    margin-right: 10px;
    margin-left: auto;
}

/* Chat Options */
.chat-options {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.chat-option-btn {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 12px;
    color: #420d24;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.chat-option-btn:hover {
    background: #420d24;
    color: white;
    border-color: #420d24;
    transform: translateY(-2px);
}

.chat-option-btn:active {
    transform: translateY(0);
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 5px 15px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #420d24;
    box-shadow: 0 0 0 2px rgba(66, 13, 36, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 80px;
    font-family: inherit;
}

.chat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-send-btn {
    background: #420d24;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #5a1233;
    transform: scale(1.05);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

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

.chat-send-btn i {
    font-size: 14px;
}

.chat-footer-note {
    text-align: center;
    margin-top: 10px;
}

.chat-footer-note small {
    font-size: 10px;
    color: #999;
}

/* Typing Indicator - Enhanced */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    background: white;
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #420d24;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
    opacity: 0.6;
}

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

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

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-12px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 576px) {
    .chatbot-container {
        bottom: 20px;
        left: 20px;
    }

    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        left: 0;
        bottom: 75px;
    }

    .chat-button {
        width: 55px;
        height: 55px;
    }

    .chat-button i {
        font-size: 24px;
    }

    .chat-options {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .chat-option-btn {
        white-space: nowrap;
        font-size: 11px;
        padding: 6px 12px;
    }

    .message {
        max-width: 90%;
    }

    .message-content p {
        font-size: 13px;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-header-content i {
        font-size: 24px;
        padding: 8px;
    }

    .chat-header-text h4 {
        font-size: 16px;
    }
}

/* Tablet Responsive */
@media (min-width: 577px) and (max-width: 768px) {
    .chat-window {
        width: 350px;
        height: 500px;
    }
}

/* Unread Badge */
.chat-button::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 15px;
    height: 15px;
    background: #ff4444;
    border-radius: 50%;
    border: 2px solid white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-button.has-unread::after {
    opacity: 1;
    animation: badgePulse 1s infinite;
}

@keyframes badgePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Ripple Effect */
.chat-button {
    position: relative;
    overflow: hidden;
}

.chat-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.chat-button:active::before {
    width: 100px;
    height: 100px;
}

/* Loading state for send button */
.chat-send-btn.loading {
    position: relative;
    pointer-events: none;
}

.chat-send-btn.loading i {
    opacity: 0;
}

.chat-send-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Disabled input state */
.chat-input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

/* Smooth transitions for all interactive elements */
.chat-option-btn,
.chat-send-btn,
.chat-button,
.chat-input,
.chat-input-wrapper {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus styles for accessibility */
.chat-option-btn:focus-visible,
.chat-send-btn:focus-visible,
.chat-input:focus-visible,
.chat-button:focus-visible {
    outline: 2px solid #420d24;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #1a1a1a;
    }

    .chat-messages {
        background: #2d2d2d;
    }

    .message.received .message-content {
        background: #3d3d3d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }

    .message.received .message-content i {
        color: #5a1233;
    }

    .chat-options {
        background: #1a1a1a;
        border-top-color: #3d3d3d;
    }

    .chat-option-btn {
        background: #2d2d2d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }

    .chat-option-btn:hover {
        background: #420d24;
        color: white;
    }

    .chat-input-area {
        background: #1a1a1a;
        border-top-color: #3d3d3d;
    }

    .chat-input-wrapper {
        background: #2d2d2d;
        border-color: #4d4d4d;
    }

    .chat-input {
        color: #e0e0e0;
    }

    .chat-input::placeholder {
        color: #999;
    }

    .typing-indicator {
        background: #3d3d3d;
    }

    .typing-indicator span {
        background: #5a1233;
    }

    .chat-footer-note small {
        color: #999;
    }
}

/* Print styles */
@media print {
    .chatbot-container {
        display: none;
    }
}

/* Welcome message animation */
@keyframes welcomeGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 13, 36, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(66, 13, 36, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 13, 36, 0);
    }
}

.chat-button.welcome {
    animation: welcomeGlow 1.5s ease-out 3;
}

/* Smooth scroll behavior */
.chat-messages {
    scroll-behavior: smooth;
}

/* Message hover effect */
.message:hover .message-time {
    opacity: 1;
}

.message-time {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

/* Link styling in messages */
.message-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.message.sent .message-content a {
    color: #ffd700;
}

.message.received .message-content a {
    color: #420d24;
}

/* Emoji support */
.message-content p {
    word-break: break-word;
    white-space: pre-wrap;
}