/* Shared styles — extracted from inline style blocks (Phase 2) */
:root {
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-bg-light: #f7f3f0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-bg-light);
}

/* Navigation glassmorphism effect */
.nav-glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg-light);
}
::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* Chat Widget Styles */
.chat-bubble {
    position: fixed;
    bottom: calc(2rem + env(safe-area-inset-bottom));
    right: 2rem;
    z-index: 40;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    border: none;
    transition: all 0.3s ease;
    font-size: 28px;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.6);
}

.chat-window {
    position: fixed;
    bottom: 8rem;
    right: 2rem;
    z-index: 45;
    width: 100%;
    max-width: 400px;
    height: 550px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Animation: hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    pointer-events: none;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

.chat-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-close:hover {
    transform: scale(1.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f9fafb;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

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

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.4;
}

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

.message-user .message-bubble {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

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

.message-assistant .message-bubble {
    background: #e5e7eb;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
    background: #e5e7eb;
    border-radius: 18px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    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);
    }
    30% {
        transform: translateY(-10px);
    }
}

.chat-input-container {
    border-top: 1px solid #e5e7eb;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    padding-top: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    background: white;
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.chat-send {
    background: #3b82f6;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send:hover {
    background: #2563eb;
}

.chat-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.chat-chips {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1.25rem 1rem;
    background: #f9fafb;
}

.chat-chip {
    background: white;
    border: 1.5px solid #3b82f6;
    color: #3b82f6;
    border-radius: 18px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.chat-chip:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* Loading Screen Overlay */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #1e3a5f;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    width: 80px;
    height: 80px;
    animation: pulse-logo 1.2s ease-in-out infinite;
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

/* Hero Text Entrance Animation */
.hero-animate-ready {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.hero-animate-ready.hero-animate-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Back-to-Top Button */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 640px) {
    .chat-window {
        width: 100%;
        max-width: 100%;
        left: 0;
        right: 0;
        bottom: 0;
        height: 70vh;
        height: 70dvh;
        border-radius: 12px 12px 0 0;
    }

    .message-bubble {
        max-width: 90%;
    }
}
