/* Chatbot CSS - OpenAI-like Interface */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #10a37f;
    --secondary-color: #f0f1f4;
    --background-main: #ffffff;
    --background-sidebar: #f9f9f9;
    --text-primary: #343541;
    --text-secondary: #6e7681;
    --border-color: #e5e7eb;
    --message-user-bg: #10a37f;
    --message-assistant-bg: #ffffff;
    --border-radius: 8px;
    --text-muted: #8e8ea0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background-color: var(--background-main);
    color: var(--text-primary);
    overflow: hidden;
}

/* Main Container */
.chatbot-container {
    display: flex;
    height: 100vh;
    background-color: var(--background-main);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--background-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: #0e9670;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.nav-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding: 0 8px;
}

.sessions-list {
    list-style: none;
}

.session-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    background-color: transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.session-item.active {
    background-color: rgba(16, 163, 127, 0.2);
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Sidebar Ad & Register Buttons */
.list-ad-btn, .register-biz-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
    cursor: pointer;
}

.list-ad-btn {
    background: #fdf2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
}

.list-ad-btn:hover {
    background: #fee2e2;
    border-color: #f87171;
    transform: translateY(-1px);
}

.register-biz-btn {
    background: white;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
}

.register-biz-btn:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.15);
    transform: translateY(-1px);
}

.footer-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.footer-controls {
    display: flex;
    gap: 8px;
}

.history-btn, .settings-btn {
    flex: 1;
    padding: 10px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.history-btn:hover, .settings-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--background-main);
}

/* Chat Header */
.chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.05);
}

.header-content {
    flex: 1;
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mode-indicator {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background-color: rgba(16, 163, 127, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.clear-btn {
    padding: 8px 12px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* ========== Location Widget ========== */
.location-btn-wrapper {
    position: relative;
}

.location-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #f0fdf9;
    color: var(--primary-color);
    border: 1.5px solid #a7f3d0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
    display: inline-block;
}

.location-pill:hover {
    background: #d1fae5;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(16,163,127,0.15);
}

.location-pill.location-set {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.location-pill.location-set:hover {
    background: #0e9670;
}

.location-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 300px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 2000;
    padding: 12px;
    animation: fadeSlideDown 0.15s ease;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gps-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: #f0fdf9;
    border: 1.5px solid #a7f3d0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    color: var(--text-primary);
}

.gps-option i.fa-crosshairs {
    font-size: 18px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.gps-option strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
}

.gps-option small {
    font-size: 11px;
    color: var(--text-secondary);
}

.gps-option:hover {
    background: #d1fae5;
    border-color: var(--primary-color);
}

.loc-divider {
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    margin: 10px 0 8px;
    position: relative;
}

.loc-divider::before,
.loc-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: var(--border-color);
}

.loc-divider::before { left: 0; }
.loc-divider::after  { right: 0; }

.loc-search-wrap {
    position: relative;
}

.loc-search-wrap input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.loc-search-wrap input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16,163,127,0.1);
}

.loc-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 12px;
    pointer-events: none;
}

.loc-suggestions {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    max-height: 160px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: empty-block;
}

.loc-suggestions:empty {
    display: none;
}

.loc-suggestions li {
    padding: 9px 12px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    transition: background 0.15s;
}

.loc-suggestions li:last-child {
    border-bottom: none;
}

.loc-suggestions li:hover {
    background: rgba(16,163,127,0.08);
}

.loc-suggestions li i {
    color: #ef4444;
    flex-shrink: 0;
    margin-top: 2px;
}

.loc-status {
    font-size: 12px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.loc-status:empty { display: none; }
.loc-status.info    { background: #eff6ff; color: #3b82f6; }
.loc-status.success { background: #f0fdf4; color: #16a34a; }
.loc-status.error   { background: #fef2f2; color: #dc2626; }

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.welcome-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.welcome-section h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.welcome-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.quick-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 600px;
}

.prompt-btn {
    padding: 12px;
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.prompt-btn:hover {
    background-color: rgba(16, 163, 127, 0.1);
    border-color: var(--primary-color);
}

/* Messages */
.message {
    display: flex;
    margin-bottom: 12px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Streaming text animation - character by character */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Blinking cursor animation */
@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* Streaming text - simulates OpenAI's text streaming */
.message-content.streaming {
    min-height: 24px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.message-content.streaming::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: currentColor;
    animation: blink 0.8s infinite;
    margin-left: 2px;
}

/* Skeleton loading animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton-loader {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-loader:last-child {
    margin-bottom: 0;
}

/* Enhanced typing indicator */
.typing-indicator-enhanced {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    min-height: 40px;
}

.typing-square {
    width: 12px;
    height: 12px;
    background-color: var(--primary-color);
    animation: square-expand 1.2s infinite ease-in-out;
    border-radius: 2px;
}

.loading-timer {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    margin-left: 4px;
    opacity: 0.8;
}

.generation-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 5px;
    opacity: 0.8;
    align-self: flex-end;
    width: 100%;
    text-align: right;
    display: block;
}

@keyframes square-expand {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.8);
        opacity: 1;
    }
}

/* Loading message container */
.message.loading {
    opacity: 0.8;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.message.user .message-content {
    background-color: var(--message-user-bg);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(16, 163, 127, 0.2);
}

.message.assistant .message-content {
    color: var(--text-primary);
    padding: 12px 16px;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background-color: transparent;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5px;
}

.list-item {
    display: block;
    margin-bottom: 0.5px;
    width: 100%;
    line-height: 1.25;
}

.card-loading-placeholder {
    color: var(--primary-color);
    font-size: 12px;
    font-style: italic;
    margin: 10px 0;
    padding: 8px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    animation: blink 1s infinite;
}

.message.assistant .message-content:hover {
    box-shadow: none;
}

.message-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 8px;
}

.message.user .message-meta {
    text-align: right;
}

/* Loading Animation */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: bounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Chat Footer */
.chat-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.ai-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 10px;
    width: 100%;
    pointer-events: none;
    letter-spacing: 0.2px;
    opacity: 0.8;
}

.legal-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
    line-height: 1.5;
    padding: 0 20px;
    opacity: 0.7;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.legal-disclaimer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.legal-disclaimer a:hover {
    text-decoration: underline;
}

.message-form {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    resize: none;
    max-height: 100px;
    transition: border-color 0.2s;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.1);
}

.message-input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    padding: 12px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background-color: #0e9670;
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
}



.search-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #ffffff;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-group label {
    font-weight: 500;
}

.setting-group input,
.setting-group select {
    padding: 6px 8px;
    background-color: #f9f9f9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .message-content {
        max-width: 90%;
    }

    .quick-prompts {
        grid-template-columns: 1fr;
    }

    /* Review cards on mobile */
    .review-form-container {
        width: calc(100% - 24px);
        max-width: none;
        margin: 12px;
        padding: 16px;
    }
}

/* Product Image Rendering */
.product-image-container {
    margin-top: 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    max-width: 100%;
    width: fit-content;
    background: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.product-image-container:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: var(--primary-color);
}

.product-image {
    display: block;
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 11px;
}

.image-shimmer {
    display: none;
}

@keyframes imageAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shimmerEffect {
    from {
        background-position: -200% 0;
    }
    to {
        background-position: 200% 0;
    }
}

/* Ensure images don't break the message flow */
.message.assistant .message-content {
    /* Styles handled in main message section */
}

/* Premium Product Card - Refined Vertical Layout */
.premium-product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 82px 0 12px 0; /* Increased top margin to account for floating photo (12px + 70px) */
    overflow: visible; /* Allow the photo to stick out */
    width: 260px; /* Solid compact width */
    max-width: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.1s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

@keyframes slideUpFadePremium {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.premium-product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 12px 40px rgba(16, 163, 127, 0.2);
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 170px; /* Increased height so cars are more visible */
    background: transparent;
    cursor: pointer;
    margin-top: -70px; /* Move only the photo up */
    z-index: 1;
}

.card-product-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fill the entire area perfectly */
    padding: 0; /* No gaps at edges */
}

.card-details {
    padding: 10px 10px 0 10px; /* 10px padding on top/sides, 0 on bottom to handle it in actions */
    display: flex;
    flex-direction: column;
    gap: 4px; /* Tighter gap */
    flex: 1; /* Expand to fill card height */
}

.card-badge {
    background: rgba(16, 163, 127, 0.2);
    color: var(--primary-color);
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
    letter-spacing: 0.5px;
    margin-top: -25px; /* Reduced overlap to show more image */
    position: relative;
    z-index: 2;
}

.card-title {
    font-size: 14px; /* Reduced from 15px */
    font-weight: 700;
    color: var(--text-primary);
    margin: 4px 0 0 0; /* Changed from negative margin to avoid overlap */
    line-height: 1.2;
}

.card-price {
    font-size: 16px; /* Reduced from 18px */
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
}

.card-description {
    font-size: 11px;
    color: var(--text-secondary); /* Brightest grey for visibility */
    line-height: 1.4;
    margin-top: -9px; /* Lifted up by 15px from 6px */
    margin-bottom: 10px;
    overflow: visible; /* Ensure nothing is hidden */
    display: block;
    min-height: 1.4em; /* Ensure it takes up at least one line of space */
}

.card-actions {
    display: flex;
    gap: 8px; /* Increased gap for pill buttons */
    margin-top: auto; /* Push to the very bottom */
    padding-bottom: 10px; /* Precise 10px gap from bottom of card */
    padding-top: 8px; /* Space from description */
}

.card-btn {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 2px; /* Pointy, sharp corners */
    height: 22px; /* Explicitly slim height */
    padding: 0 10px;
    font-size: 9px;
    font-weight: 600;
    line-height: 1; /* Center text better in fixed height */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-transform: none;
}

.card-btn.share-btn {
    flex: 0 0 22px; /* Matched to 22px height */
    height: 22px;
    border-radius: 2px; /* Pointy share button */
    padding: 0;
}

.card-btn i {
    font-size: 9px; /* Smaller icons for slim buttons */
}

.card-btn.primary.call-btn {
    display: none; /* Hide call button by default (desktop) */
}

.card-btn.primary {
    background: var(--primary-color);
    color: white;
}

.card-btn.primary:hover {
    background: #12b88f;
}

.card-btn.secondary {
    background: #f9f9f9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.card-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Graphical Star Rating Display */
.rating-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    vertical-align: middle;
}

.star-rating-display {
    display: inline-flex;
    position: relative;
    font-size: 1rem;
    color: #e5e7eb; /* Grey stars background */
    letter-spacing: 2px;
}

.star-rating-display .filled-stars {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    color: #fbbf24; /* Yellow stars foreground */
    transition: width 0.3s ease;
}

.write-review-trigger {
    font-size: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    background: var(--primary-color);
    padding: 4px 12px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
    margin-left: 8px;
    border: 1px solid var(--primary-color);
}

.write-review-trigger:hover {
    background: #0e9670;
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(16, 163, 127, 0.3);
}

.write-review-trigger i {
    font-size: 11px;
}

.rating-text {
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 600;
    white-space: nowrap;
}

/* Review Modal Specifics */
.review-modal-content {
    max-width: 400px;
    border-radius: 16px;
    padding: 30px;
}

.star-rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.star-rating-input i {
    cursor: pointer;
    font-size: 2rem;
    color: #e5e7eb;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.star-rating-input i:hover,
.star-rating-input i:hover ~ i,
.star-rating-input i.active,
.star-rating-input i.active ~ i {
    color: #fbbf24;
    transform: scale(1.1);
}

.review-textarea-modal {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    background: #f9fafb;
    transition: border-color 0.2s;
}

.review-textarea-modal:focus {
    border-color: var(--primary-color);
    outline: none;
    background: #ffffff;
}

.review-status-msg {
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

.review-status-msg.error { color: #dc2626; }
.review-status-msg.success { color: #059669; }

/* Ensure cards look good on mobile */
@media (max-width: 480px) {
    .premium-product-card {
        width: 100%;
    }
    
    .card-btn.primary.call-btn {
        display: flex; /* Show call button ONLY on mobile */
    }
    
    .review-modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* Products Modal Styles */
.products-modal-content {
    width: 600px;
    max-width: 90%;
    max-height: 85vh;
    padding: 24px;
    overflow-y: auto;
}

.products-modal-header {
    margin-bottom: 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.product_item_card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.product_item_card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.product_item_image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f3f4f6;
}

.product_item_details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product_item_name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.product_item_price {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-color);
}

.product_item_desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.view-products-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    border: none;
    transition: all 0.2s;
}

.view-products-btn:hover {
    background: #5a67d8;
    transform: translateX(4px);
}

/* Responsive adjustment for products modal */
@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    .products-modal-content {
        padding: 16px;
    }
}
/* Structured AI Response Styles */
.info-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 4px 24px;
    font-size: 14px;
    line-height: 1.4;
}

.info-label {
    min-width: 90px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
}

.info-value {
    color: var(--text-primary);
    flex: 1;
}

/* Structured AI Response Styles - Premium UI Refinement */
.business-header {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-top: 24px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(16, 163, 127, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Ensure the number in the header stands out */
.business-header strong {
    color: var(--text-primary);
}

.info-row {
    display: flex;
    align-items: flex-start;
    gap: 5.5px;
    margin: 0 0 0 16px;
    padding: 0.5px 8px;
    font-size: 14.5px;
    line-height: 1.25;
    transition: background 0.2s;
    border-radius: 6px;
}

.info-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

.info-label {
    min-width: 100px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    padding-top: 2px;
}

.info-value {
    color: var(--text-primary);
    flex: 1;
    font-weight: 500;
}

/* Links & Buttons Refinement */
.phone-link, .directions-link {
    text-decoration: none;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    margin: 2px 0;
}

.phone-link {
    color: var(--primary-color);
    background: rgba(16, 163, 127, 0.08);
    border: 1px solid rgba(16, 163, 127, 0.2);
}

.phone-link:hover {
    background: var(--primary-color);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.2);
}

.directions-link {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.directions-link:hover {
    background: #3b82f6;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.view-products-container {
    margin-left: 16px;
    margin-top: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
}

/* Dark Mode Overrides */
[data-theme="dark"] .business-header {
    background: rgba(255, 255, 255, 0.05);
    color: #10a37f;
}

[data-theme="dark"] .info-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .info-label {
    color: #9ca3af;
}

[data-theme="dark"] .info-value {
    color: #ececec;
}

[data-theme="dark"] .phone-link {
    background: rgba(16, 163, 127, 0.15);
}

[data-theme="dark"] .directions-link {
    background: rgba(59, 130, 246, 0.15);
}

.auth-modal-content {
    max-width: 400px;
    padding: 30px;
    border-radius: 16px;
    border: 1px solid rgba(16, 163, 127, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    background: var(--background-main);
}

.auth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-radius: 50%;
    margin: 0 auto 20px;
}

.auth-modal-footer {
    border-top: none;
    padding: 0;
}

/* Guest Auth Header Buttons */
.guest-auth-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 8px;
}

.guest-login-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.guest-login-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: var(--text-secondary);
}

.guest-signup-btn {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white !important;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
}

.guest-signup-btn:hover {
    background-color: #0e9670;
    box-shadow: 0 4px 8px rgba(16, 163, 127, 0.3);
    transform: translateY(-1px);
}

/* Mobile Responsiveness & UI Refinements */
@media (max-width: 768px) {
    /* Sidebar as Overlay */
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 2000;
        width: 280px;
        box-shadow: 15px 0 30px rgba(0,0,0,0.1);
        background: rgba(249, 249, 249, 0.95) !important;
        backdrop-filter: blur(10px);
    }

    .sidebar.collapsed {
        width: 280px;
        transform: translateX(-100%);
    }

    /* Header Compact Layout */
    .chat-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-content {
        order: 1;
        min-width: 120px;
    }

    .chat-header h2 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }

    .location-btn-wrapper {
        order: 2;
    }

    .guest-auth-header {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-right: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 8px;
    }

    .location-pill {
        max-width: 140px;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Message Bubbles - Wider on Mobile */
    .message-content {
        max-width: 90% !important;
    }

    .welcome-section {
        padding: 20px;
        text-align: center !important;
        align-items: center !important;
    }

    .user-greeting {
        font-size: 1.6rem !important;
        margin-left: 0 !important;
        text-align: center;
        width: 100%;
    }

    .welcome-icon {
        align-self: center !important;
    }

    .quick-prompts {
        grid-template-columns: 1fr 1fr;
    }

    /* Input Area - Better for Touch */
    .chat-footer {
        padding: 12px;
    }

    .input-container {
        padding: 8px 12px;
    }

    .message-input {
        font-size: 16px; /* Prevents auto-zoom on iOS */
    }

    /* Review & Products Modals */
    .modal-content {
        width: 95% !important;
        padding: 20px !important;
        margin: 10px auto;
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
        z-index: 1500;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar:not(.collapsed) ~ .sidebar-overlay {
        display: block;
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .quick-prompts {
        grid-template-columns: 1fr;
    }
    
    .chat-header h2 {
        max-width: 100px;
    }

    .guest-auth-header {
        gap: 6px;
    }

    .guest-login-btn, .guest-signup-btn {
        flex: 1;
        text-align: center;
        padding: 8px 4px;
        font-size: 12px;
    }
}
