/* =============================================
   VibeShopper — Modern Deal Discovery UI
   Clean, bold, shopping-focused design
   ============================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --accent: #6C5CE7;
    --accent-light: #A29BFE;
    --accent-bg: #F0EEFF;
    --hot: #FF6B6B;
    --green: #00B894;
    --dark: #1A1A2E;
    --text: #2D3436;
    --text-secondary: #636E72;
    --text-muted: #B2BEC3;
    --bg: #FAFAFA;
    --card: #FFFFFF;
    --border: #E8E8E8;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* =====================
   Navbar
   ===================== */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.92);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.nav-brand a {
    text-decoration: none;
}

.nav-brand h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.brand-logo {
    font-family: 'Space Grotesk', sans-serif;
}

.brand-accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover { color: var(--accent); background: var(--accent-bg); }
.nav-link.active { color: var(--accent); background: var(--accent-bg); }

/* =====================
   Deals Hero
   ===================== */
.deals-hero {
    text-align: center;
    padding: 48px 24px 24px;
}

.deals-hero h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.deals-slogan {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    margin: 8px 0 4px;
}

.deals-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* =====================
   About Page
   ===================== */
.about-hero {
    text-align: center;
    padding: 80px 24px 48px;
}

.about-eyebrow {
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
}

.about-hero h2 {
    font-size: 42px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -1.5px;
    line-height: 1.2;
    margin-bottom: 20px;
}

.about-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

.about-section { margin-bottom: 60px; }

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.about-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    transition: var(--transition);
}

.about-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-light);
}

.about-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 16px;
}

.about-card h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.about-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-cta {
    background: linear-gradient(135deg, var(--accent), #8B7CF7);
    color: white;
    text-align: center;
    padding: 64px 32px;
    border-radius: var(--radius);
    margin-bottom: 48px;
}

.about-cta h3 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
}

.about-cta p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 28px;
}

/* =====================
   Buttons
   ===================== */
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
    background: #5A4BD1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.35);
}

.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover:not(:disabled) {
    background: var(--accent);
    color: white;
}

.btn-outline:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-ghost:hover {
    border-color: var(--hot);
    color: var(--hot);
    background: #FFF5F5;
}

.btn-lg { padding: 14px 36px; font-size: 16px; }

a.btn-primary { text-decoration: none; display: inline-block; }

/* =====================
   Category Tabs
   ===================== */
.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    background: var(--card);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    text-transform: capitalize;
}

.category-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.category-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.category-count {
    font-size: 12px;
    background: rgba(0,0,0,0.06);
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 700;
}

.category-tab.active .category-count {
    background: rgba(255,255,255,0.25);
}

/* =====================
   Search Bar
   ===================== */
.search-container {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-wrapper {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
    background: var(--card);
    color: var(--text);
    font-family: inherit;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.search-input:disabled { background: #F0F0F0; cursor: not-allowed; }

/* =====================
   Results Bar
   ===================== */
.results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* =====================
   Products Grid
   ===================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.product-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.product-image-wrap {
    position: relative;
    background: #F8F8FA;
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    padding: 20px;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--hot);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

.category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.06);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.product-info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 42px;
}

.price-row {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.price-new {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
}

.price-old {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.deal-type {
    display: inline-block;
    background: #FFF3E0;
    color: #E67E22;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
    width: fit-content;
}

/* =====================
   States
   ===================== */
.loading-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
    text-align: center;
    padding: 60px 20px;
    background: #FFF5F5;
    border-radius: var(--radius);
    color: var(--hot);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-title { font-size: 16px; color: var(--text); margin-bottom: 8px; }

.empty-hint {
    font-size: 14px;
    color: var(--text-muted);
}

.empty-hint a { color: var(--accent); text-decoration: underline; }

/* =====================
   Load More
   ===================== */
.load-more-container {
    text-align: center;
    margin: 40px 0;
}

.no-more {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* =====================
   Footer
   ===================== */
.footer {
    text-align: center;
    padding: 40px 24px;
    margin-top: 60px;
    border-top: 1px solid var(--border);
}

.affiliate-disclaimer {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 680px;
    margin: 0 auto;
}

/* =====================
   Responsive — Tablet
   ===================== */
@media (max-width: 768px) {
    .navbar .container { padding: 12px 16px; }
    .nav-brand h1 { font-size: 18px; }

    .deals-hero { padding: 32px 16px 16px; }
    .deals-hero h2 { font-size: 28px; }

    .about-hero { padding: 48px 16px 32px; }
    .about-hero h2 { font-size: 30px; }
    .about-subtitle { font-size: 16px; }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 12px;
    }

    .product-image { height: 160px; padding: 12px; }
    .product-title { font-size: 13px; min-height: 38px; }
    .price-new { font-size: 18px; }
    .product-info { padding: 12px; }
}

/* =====================
   Responsive — Mobile
   ===================== */
@media (max-width: 480px) {
    .navbar .container {
        flex-direction: row;
    }

    .nav-links { gap: 4px; }
    .nav-link { padding: 6px 12px; font-size: 13px; }

    .results-bar {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .products-grid { grid-template-columns: repeat(2, 1fr); }
    .product-image { height: 140px; }

    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper { min-width: unset; }

    .btn-primary, .btn-ghost, .btn-outline { width: 100%; text-align: center; }

    .about-cta { padding: 40px 20px; }
    .about-cta h3 { font-size: 24px; }
}

/* Touch targets */
@media (hover: none) and (pointer: coarse) {
    .btn-primary, .btn-outline, .btn-ghost, .category-tab { min-height: 44px; }
}

/* =====================
   Chat UI
   ===================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 65px);
    max-width: 900px;
    margin: 0 auto;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
    scroll-behavior: smooth;
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    flex-direction: row-reverse;
    margin-left: auto;
}

.ai-message {
    margin-right: auto;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: #E8F5E9;
}

.message-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.7;
    box-shadow: var(--shadow-sm);
}

.user-message .message-content {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }

/* Suggestion chips */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.suggestion-chip {
    background: var(--accent-bg);
    color: var(--accent);
    border: 1.5px solid transparent;
    border-radius: 100px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.suggestion-chip:hover {
    border-color: var(--accent);
    background: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.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); }
}

/* Chat product cards */
.chat-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.chat-product-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.chat-product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: transparent;
}

.recommend-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    margin: 16px 0 8px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.recommended-card {
    opacity: 0.85;
}

.recommended-card:hover {
    opacity: 1;
}

.recommend-reason {
    font-size: 12px;
    color: var(--accent);
    margin: 4px 0 6px;
    font-style: italic;
    line-height: 1.4;
}

.api-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #2563eb;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.chat-product-image-wrap {
    position: relative;
    background: white;
}

.chat-product-image {
    width: 100%;
    height: 140px;
    object-fit: contain;
    padding: 12px;
}

.chat-product-info {
    padding: 10px 12px;
}

.chat-product-title {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 6px;
}

.chat-product-info .price-row { gap: 6px; }
.chat-product-info .price-new { font-size: 16px; }
.chat-product-info .price-old { font-size: 12px; }

/* Chat input area */
.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    max-width: 900px;
    margin: 0 auto;
}

.chat-input {
    flex: 1;
    padding: 14px 20px;
    font-size: 15px;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    outline: none;
    transition: var(--transition);
    background: var(--card);
    color: var(--text);
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.chat-input:disabled { background: #F0F0F0; cursor: not-allowed; }

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: #5A4BD1;
    transform: scale(1.05);
}

.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Chat responsive */
@media (max-width: 768px) {
    .chat-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .chat-product-image { height: 110px; padding: 8px; }
    .chat-product-title { font-size: 11px; }
    .chat-product-info .price-new { font-size: 14px; }
    .chat-message { max-width: 92%; }
}

@media (max-width: 480px) {
    .chat-products-grid { grid-template-columns: repeat(2, 1fr); }
    .suggestion-chips { flex-direction: column; }
    .suggestion-chip { text-align: left; }
}
