/**
 * Clara Chat Widget Styles
 * Matches PourPlan's burgundy theme (#7B1E3A)
 */

/* Toggle Button */
.clara-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: #7B1E3A;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(123, 30, 58, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.clara-toggle-btn:hover {
    background: #5a1629;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(123, 30, 58, 0.4);
}

.clara-toggle-btn svg {
    flex-shrink: 0;
}

.clara-toggle-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Chat Modal */
.clara-chat-modal {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 650px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
}

/* Header */
.clara-chat-header {
    background: linear-gradient(135deg, #7B1E3A 0%, #5a1629 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.clara-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.clara-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.clara-chat-title {
    margin: 0;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.92);
}

.clara-close-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.clara-close-btn:hover {
    opacity: 1;
}

/* Messages Container */
.clara-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f7fafc;
    scroll-behavior: smooth;
}

.clara-welcome-message {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.clara-welcome-message p {
    margin: 0 0 14px;
    color: #1E1E1E;
    line-height: 1.6;
}

.clara-welcome-message ul {
    margin: 0 0 12px;
    padding-left: 24px;
    color: #4a5568;
}

.clara-welcome-message li {
    margin: 4px 0;
}

.clara-welcome-prompt {
    font-weight: 600;
    color: #7B1E3A;
}

/* Quick Reply Buttons */
.clara-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.clara-quick-reply-btn {
    background: transparent;
    color: #7B1E3A;
    border: 1px solid #cbd5e0;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.clara-quick-reply-btn:hover {
    background: #f7fafc;
    border-color: #7B1E3A;
}

.clara-quick-reply-btn svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* Multi-select button states */
.clara-quick-reply-btn.selected {
    background: #7B1E3A;
    color: white;
    border-color: #7B1E3A;
}

.clara-quick-reply-btn.selected:hover {
    background: #651832;
    border-color: #651832;
}

/* Confirm button for multi-select */
.clara-confirm-btn {
    background: #7B1E3A;
    color: white;
    border: 1px solid #7B1E3A;
    font-weight: 600;
}

.clara-confirm-btn:hover {
    background: #651832;
    border-color: #651832;
}

/* Link-type quick reply */
.clara-quick-reply-link {
    text-decoration: none;
}

.clara-quick-reply-link:hover {
    text-decoration: none;
}

/* Messages */
.clara-message {
    margin-bottom: 16px;
}

.clara-message-assistant {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.clara-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    border: 2px solid #f7fafc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clara-message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}

.clara-message-user .clara-message-content {
    background: #7B1E3A;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.clara-message-assistant .clara-message-content {
    background: white;
    color: #1E1E1E;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

/* Typing Indicator */
.clara-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.clara-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #718096;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Input Container */
.clara-input-container {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

/* Hide input container while welcome/quiz is active (prevents mobile keyboard from pushing content off-screen) */
.clara-chat-modal.quiz-active .clara-input-container {
    display: none;
}

.clara-input {
    flex: 1;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 44px;
}

.clara-input:focus {
    outline: none;
    border-color: #7B1E3A;
}

.clara-send-btn {
    background: #7B1E3A;
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.clara-send-btn:hover {
    background: #5a1629;
}

.clara-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards Container */
.clara-cards-container {
    margin-top: 8px;
}

.clara-tasting-room-card {
    margin-bottom: 12px;
}

/* Recommendation Summary */
.clara-recommendation-summary {
    background: #f7fafc;
    border-left: 3px solid #7B1E3A;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.clara-recommendation-summary p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #2d3748;
}

/* See All Link */
.clara-see-all-link {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.clara-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    background: #7B1E3A;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: 999px;
    border: none;
    transition: all 0.2s ease;
}

.clara-link-btn:hover {
    background: #651832;
    transform: translateY(-1px);
}

.clara-link-btn svg {
    flex-shrink: 0;
}

.clara-card {
    background: white;
    border-radius: 8px;
    overflow: visible; /* Changed from hidden to allow dropdowns */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.clara-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.clara-card-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    border-radius: 8px 8px 0 0;
}

.clara-card-body {
    padding: 12px;
    position: relative;
    z-index: 1;
}

.clara-card-actions {
    position: relative;
    z-index: 10;
}

/* Make dropdown menus appear above other content */
.clara-card .dropdown-menu {
    z-index: 1050 !important;
}

/* Five-icons styling within Clara chat */
.clara-card .five-icons-container {
    justify-content: center;
}

.clara-card .dropdown {
    flex: 1;
}

.clara-card .outing-pill-btn {
    width: 100%;
}

.clara-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.clara-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.clara-card-title a {
    color: #1E1E1E;
    text-decoration: none;
}

.clara-card-title a:hover {
    color: #7B1E3A;
}

.clara-badge {
    background: #f7fafc;
    color: #4a5568;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.clara-card-location {
    color: #718096;
    font-size: 13px;
    margin: 0 0 8px;
}

.clara-card-fee {
    font-size: 13px;
    margin: 0 0 8px;
    color: #4a5568;
}

.clara-text-muted {
    color: #718096;
}

.clara-card-tagline {
    font-size: 13px;
    color: #1E1E1E;
    margin: 0 0 8px;
    font-style: italic;
}

.clara-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.clara-tag {
    background: #f7fafc;
    color: #4a5568;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.clara-card-actions {
    display: flex;
    gap: 6px;
}

.clara-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}

.clara-btn-favorite {
    background: transparent;
    color: #7B1E3A;
    border: 1px solid #e2e8f0;
}

.clara-btn-favorite:hover {
    background: #f7fafc;
    border-color: #7B1E3A;
}

.clara-btn-outing {
    background: transparent;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.clara-btn-outing:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .clara-chat-modal {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 10px;
        right: 20px;
        left: 20px;
    }

    /* Keep button large and clear on mobile - don't hide the text! */
    .clara-toggle-btn {
        width: auto;
        min-width: 130px;
        height: 60px;
        border-radius: 30px;
        padding: 14px 20px;
        font-size: 15px;
        gap: 10px;
        font-weight: 600;
        /* Add subtle pulse animation to draw attention */
        animation: subtle-pulse 3s ease-in-out infinite;
    }

    /* Keep text visible on mobile - it's important! */
    .clara-toggle-text {
        display: inline;
    }

    /* Make avatar slightly larger on mobile */
    .clara-toggle-avatar {
        width: 32px;
        height: 32px;
    }

    .clara-card-actions {
        flex-direction: column;
    }
}

/* Subtle pulse animation for mobile button */
@keyframes subtle-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(123, 30, 58, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(123, 30, 58, 0.5);
    }
}

/* Scrollbar Styling */
.clara-messages::-webkit-scrollbar {
    width: 6px;
}

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

.clara-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.clara-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}
