/* ============================================
   Fujairah Adventures Chatbot Styles
   Based on fujairah-adventures-redesign
   ============================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Almarai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    overflow: hidden;
}

/* ============================================
   Design Tokens (from redesign)
   ============================================ */
:root {
    /* Primary Palette */
    --desert-dune: #C4B684;
    --deep-olive: #464100;
    --rusty-terracotta: #AD5523;
    --olive-green: #4A5A29;
    --warm-brown: #9A622F;
    --sand-beige: #BDAA8B;
    --light-sand-orange: #C4A663;
    --teal-sand: #2E5D48;
    --mustard-yellow: #BDAA2B;
    --burnt-orange: #C47330;
    --khaki-green: #7A7543;

    /* Supporting Colors */
    --off-white: #F7F6F4;
    --unfocused-white: #F7F7F7;
    --light-beige: #E8E6E0;
    --beige: #FFEACC;
    --blackish: #262626;
    --grayish: #333333;
    --info-gray: #6B6C7E;
    --chart-gray: #8C8C8C;
    --border-gray: #E6E6E6;
    --border-light-gray: #E6E5E3;

    /* Functional Colors */
    --error: #FF3B30;
    --success-green: #1A8200;
    --success-bg: #E6F4EA;
    --interested-orange: #FF8D28;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 4px 20px rgba(196, 115, 48, 0.35);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* ============================================
   Chat Toggle Button
   ============================================ */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--burnt-orange) 0%, var(--rusty-terracotta) 100%);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.chat-toggle:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 28px rgba(196, 115, 48, 0.5);
}

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

.chat-toggle svg {
    width: 28px;
    height: 28px;
    color: white;
}

.chat-toggle .icon-close {
    display: none;
}

.chat-toggle.active {
    display: none;
}

.chat-toggle.active .icon-chat {
    display: none;
}

.chat-toggle.active .icon-close {
    display: block;
}

/* ============================================
   Chat Window
   ============================================ */
.chat-window {
    position: fixed;
    background: var(--off-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light-gray);
}

.chat-window.open {
    display: flex;
}

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

/* ============================================
   Chat Header (matches fujairah-adventures-redesign Navbar)
   ============================================ */
.chat-header {
    background: var(--light-beige);
    color: var(--blackish);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light-gray);
}

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

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(196, 115, 48, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid rgba(196, 115, 48, 0.2);
}

.chat-header h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
    font-family: 'Almarai', sans-serif;
    color: var(--blackish);
    letter-spacing: 0.02em;
}

.status {
    font-size: 12px;
    color: var(--info-gray);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-green);
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(26, 130, 0, 0.2);
}

.minimize-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--grayish);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: 'Almarai', sans-serif;
    line-height: 1;
}

.minimize-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--blackish);
    transform: scale(1.05);
}

/* ============================================
   Chat Messages
   ============================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--off-white);
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--sand-beige);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--warm-brown);
}

/* Firefox */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--sand-beige) transparent;
}

/* ============================================
   Message
   ============================================ */
.message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 85%;
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    word-wrap: break-word;
    font-family: 'Almarai', sans-serif;
    line-height: 1.6;
}

.bot-message .message-content {
    background: white;
    color: var(--blackish);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light-gray);
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--burnt-orange) 0%, var(--rusty-terracotta) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(196, 115, 48, 0.25);
}

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

/* ============================================
   Clickable Links in Chat Messages
   ============================================ */
.chat-link {
    color: var(--teal-sand);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
    word-break: break-all;
    font-weight: 600;
}

.chat-link:hover {
    color: var(--deep-olive);
    text-decoration: none;
}

.user-message .chat-link {
    color: var(--beige);
}

.user-message .chat-link:hover {
    color: white;
}

.message-time {
    font-size: 11px;
    color: var(--chart-gray);
    padding: 0 4px;
    font-family: 'Almarai', sans-serif;
}

.bot-message .message-time {
    align-self: flex-start;
}

.user-message .message-time {
    align-self: flex-end;
    color: var(--sand-beige);
}

/* ============================================
   Typing Indicator
   ============================================ */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: var(--radius-md);
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: var(--shadow-sm);
    margin: 0 20px 10px;
    border: 1px solid var(--border-light-gray);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sand-beige);
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        background: var(--sand-beige);
    }
    30% {
        transform: translateY(-10px);
        background: var(--burnt-orange);
    }
}

/* ============================================
   Chat Input
   ============================================ */
.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--border-light-gray);
}

#chat-form {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-gray);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    font-family: 'Almarai', sans-serif;
    background: var(--off-white);
    color: var(--blackish);
}

.chat-input::placeholder {
    color: var(--chart-gray);
}

.chat-input:focus {
    border-color: var(--burnt-orange);
    box-shadow: 0 0 0 3px rgba(196, 115, 48, 0.1);
    background: white;
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--burnt-orange) 0%, var(--rusty-terracotta) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(196, 115, 48, 0.25);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(196, 115, 48, 0.35);
}

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

.send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================
   Error Message
   ============================================ */
.error-message {
    background: #FFF2F2;
    color: var(--error);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin: 0 20px;
    border: 1px solid #FFD6D6;
    font-family: 'Almarai', sans-serif;
}

/* ============================================
   Knowledge Badge
   ============================================ */
.knowledge-badge {
    display: inline-block;
    background: var(--beige);
    color: var(--rusty-terracotta);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    font-family: 'Almarai', sans-serif;
    letter-spacing: 0.02em;
}

/* ============================================
   Loading State
   ============================================ */
.message-content.loading {
    background: var(--unfocused-white);
    color: var(--chart-gray);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
    .chat-window {
        margin: 5px;
        width: calc(100vw - 10px);
        height: calc(100vh - 10px);
        border-radius: var(--radius-md);
    }

    .chat-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chat-header {
        padding: 14px 16px;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-input-container {
        padding: 12px 16px;
    }
}

/* ============================================
   Accessibility: Respect prefers-reduced-motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .chat-toggle,
    .chat-window,
    .message,
    .send-btn,
    .minimize-btn,
    .typing-dot {
        animation: none !important;
        transition: none !important;
    }
}
