/* ===================================
   Bueten AI Assistant - Chatbot Styles
   =================================== */

/* Floating Chat Button */
.chat-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #020304 0%, #801923f5 100%);
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.4);
    z-index: 9999;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: float-pulse 2s ease-in-out infinite;
}

.chat-float-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 12px 35px rgba(30, 60, 114, 0.6);
    color: #fff;
    text-decoration: none;
}

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

.chat-float-btn i {
    transition: transform 0.3s ease;
}

.chat-float-btn:hover i {
    transform: rotate(15deg);
}

/* Floating Button Label */
.chat-float-btn::before {
    content: 'AI Assistant';
    position: absolute;
    right: 70px;
    background: linear-gradient(135deg, #020304 0%, #801923f5 100%);
    color: #fff;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
}

.chat-float-btn:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

@keyframes float-pulse {

    0%,
    100% {
        box-shadow: 0 8px 25px rgba(30, 60, 114, 0.4);
    }

    50% {
        box-shadow: 0 8px 35px rgba(30, 60, 114, 0.6), 0 0 0 10px rgba(30, 60, 114, 0.1);
    }
}

/* ===================================
   Chatbot Page Styles
   =================================== */

.chatbot-container {
    min-height: 100vh;
    height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chatbot-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(146, 33, 15, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(23, 47, 65, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.chatbot-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #020304 0%, #801923 100%);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(146, 33, 15, 0.3);
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chatbot-back-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.chatbot-back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(-3px);
    color: #fff;
    text-decoration: none;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-info h1 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 4px 0;
    font-weight: 600;
}

.chatbot-header-info p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    margin: 0;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.status-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
}

/* Chat Messages Area */
.chatbot-messages {
    position: absolute;
    top: 90px; /* Height of header */
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    padding-bottom: 140px; /* Space for fixed input area */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.message {
    max-width: 75%;
    animation: message-fade-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

@keyframes message-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.assistant {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 100%;
}

.message.assistant .message-wrapper {
    flex-direction: row;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    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);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #92210f 0%, #801923 100%);
    color: #fff;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #172f41 0%, #1e3c72 100%);
    color: #fff;
}

.message-content {
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.7;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.message-content:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

.message.assistant .message-content {
    background: #ffffff;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user .message-content {
    background: linear-gradient(135deg, #172f41 0%, #1e3c72 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 20px rgba(23, 47, 65, 0.3);
}

.message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 8px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.message.user .message-time {
    text-align: right;
    color: #94a3b8;
}

.message.assistant .message-time {
    text-align: left;
    color: #94a3b8;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 50px 20px;
    animation: welcome-fade-in 0.8s ease;
}

@keyframes welcome-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-icon {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #020304 0%, #801923 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 40px;
    color: #fff;
    box-shadow: 0 10px 40px rgba(146, 33, 15, 0.4);
    animation: icon-pulse 2s ease-in-out infinite;
    position: relative;
}

.welcome-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #020304 0%, #801923 100%);
    opacity: 0.3;
    animation: ripple 2s ease-out infinite;
}

@keyframes icon-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.welcome-message h2 {
    color: #252525;
    font-size: 28px;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.welcome-message p {
    color: #64748b;
    font-size: 16px;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 30px;
}

.quick-action-btn {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quick-action-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.quick-action-btn:hover {
    border-color: #92210f;
    background: linear-gradient(135deg, #020304 0%, #801923 100%);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(146, 33, 15, 0.3);
}

.quick-action-btn:hover i {
    transform: scale(1.1);
}

.quick-action-btn:active {
    transform: translateY(-1px);
}

/* Chat Input Area */
.chatbot-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.char-counter-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding: 0 5px;
}

.char-counter {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    transition: color 0.3s ease;
}

.char-counter.warning {
    color: #f59e0b;
}

.char-counter.error {
    color: #ef4444;
    font-weight: 600;
}

/* reCAPTCHA v3 is invisible, no styling needed */

.chatbot-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: 900px;
    margin: 0 auto;
}

.chatbot-input {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    resize: none;
    overflow-y: auto;
    min-height: 52px;
    max-height: 120px;
    font-family: inherit;
    line-height: 1.5;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chatbot-input:focus {
    border-color: #92210f;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(146, 33, 15, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.chatbot-input::placeholder {
    color: #94a3b8;
    font-style: italic;
}

.chatbot-send-btn {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #020304 0%, #801923 100%);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    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 15px rgba(146, 33, 15, 0.4);
    position: relative;
    overflow: hidden;
}

.chatbot-send-btn::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;
}

.chatbot-send-btn:hover::before {
    width: 300px;
    height: 300px;
}

.chatbot-send-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(146, 33, 15, 0.5);
}

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

.chatbot-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: scale(1);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 18px 22px;
    background: #ffffff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #92210f 0%, #801923 100%);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-10px) scale(1.1);
        opacity: 1;
    }
}

/* Error Messages */
.message.error .message-content {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.message.error .message-avatar {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Smooth Scroll Behavior */
.chatbot-messages {
    scroll-padding-bottom: 20px;
}

/* Message Copy Button (optional enhancement) */
.message-content-wrapper {
    position: relative;
}

.message-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    opacity: 0;
}

.message:hover .message-copy-btn {
    display: flex;
    opacity: 1;
}

.message-copy-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

.message.user .message-copy-btn {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.message.user .message-copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .chat-float-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .chat-float-btn::before {
        display: none;
    }

    .chatbot-container {
        height: 100dvh; /* Use dynamic viewport height */
        min-height: 100dvh;
    }

    .chatbot-header {
        padding: 12px 15px;
    }

    .chatbot-header-info h1 {
        font-size: 16px;
        margin-bottom: 2px;
    }

    .chatbot-header-info p {
        font-size: 11px;
    }

    .chatbot-messages {
        top: 70px; /* Adjust for smaller header on mobile */
        padding: 15px;
        padding-bottom: 110px; /* Space for fixed input area on mobile */
    }

    .message {
        max-width: 85%;
    }

    .message-wrapper {
        gap: 8px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .message-content {
        padding: 12px 16px;
        font-size: 14px;
    }

    .welcome-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
        margin-bottom: 20px;
    }

    .welcome-message {
        padding: 30px 15px;
    }

    .welcome-message h2 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .welcome-message p {
        font-size: 14px;
    }

    .chatbot-input-area {
        padding: 12px 15px;
    }

    .chatbot-input {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }

    .chatbot-send-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .chatbot-back-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .chatbot-header-info h1 img {
        height: 20px !important; /* Resize logo */
    }

    /* Grid layout for quick actions on mobile */
    .quick-actions {
        display: grid;
        grid-template-columns: 1fr; /* Stack vertically for better readability on very small screens, or 1fr 1fr */
        gap: 8px;
        width: 100%;
    }

    .quick-action-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 15px;
        font-size: 13px;
        white-space: normal; /* Allow text wrapping */
        text-align: center;
    }

    .message {
        max-width: 90%;
    }

    .message-content h1 { font-size: 1.3em; }
    .message-content h2 { font-size: 1.2em; }
    .message-content h3 { font-size: 1.1em; }
    
    .status-text {
        display: none; /* Hide status text on very small screens to save space */
    }
}