/* ========================================
   Lumina E-Commerce - Styles
   ======================================== */

:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --primary-bg: #f8f7ff;
    --primary-gradient: linear-gradient(180deg, #eee9ff 0%, #ffffff 60%);
    --text-dark: #1a1a2e;
    --text-mid: #4a4a5a;
    --text-light: #8a8a9a;
    --border: #e8e8ee;
    --card-bg: #ffffff;
    --chat-user-bg: #f0f0f5;
    --chat-bot-bg: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   HOME PAGE
   ======================================== */

.home-page {
    background: var(--primary-gradient);
    min-height: 100vh;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
}

.btn-signup {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-signup:hover {
    border-color: var(--text-dark);
}

/* Hero */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 60px;
    max-width: 720px;
    margin: 0 auto;
}

.hero-logo {
    margin-bottom: 8px;
}

.hero-title {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -2px;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 12px;
}

.hero-tagline {
    font-size: 1.1rem;
    color: var(--text-mid);
    margin-bottom: 28px;
}

/* Gender Toggle */
.gender-toggle {
    display: flex;
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 28px;
    overflow: hidden;
    margin-bottom: 24px;
}

.gender-btn {
    padding: 10px 28px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-mid);
}

.gender-btn.active {
    background: var(--text-dark);
    color: #fff;
    border-radius: 24px;
}

/* Search Box */
.search-box {
    width: 100%;
    max-width: 640px;
    position: relative;
    background: var(--card-bg);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 48px;
}

.search-box textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 20px 60px 20px 20px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-dark);
    background: transparent;
    line-height: 1.5;
}

.search-box textarea::placeholder {
    color: var(--text-light);
}

.search-submit {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-submit:not(:disabled) {
    background: var(--text-dark);
    color: #fff;
}

.search-submit:not(:disabled):hover {
    background: var(--primary);
}

/* Trending */
.trending-section {
    width: 100%;
    max-width: 800px;
}

.trending-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-weight: 600;
}

.trending-header svg {
    color: var(--text-dark);
}

.trending-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.trending-card {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.trending-card:hover {
    transform: scale(1.02);
}

.trending-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trending-card .trending-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

/* ========================================
   SEARCH PAGE
   ======================================== */

.search-page {
    background: #fff;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.search-topbar {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-shrink: 0;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
}

.topbar-logo .logo-icon-sm {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f7;
    border-radius: 24px;
    padding: 12px 20px;
    width: 480px;
    margin: 0 auto;
}

.topbar-search-icon {
    flex-shrink: 0;
    color: var(--text-light);
}

.topbar-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
}

.topbar-search-input::placeholder {
    color: var(--text-light);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-mid);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-cart:hover, .btn-cart.active {
    color: var(--text-dark);
    background: #f5f5f7;
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Search Layout */
.search-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Chat Sidebar */
.chat-sidebar {
    width: 380px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: #fafafa;
    position: relative;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kai-brand-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kai-name {
    font-size: 16px;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: 1.5px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-reset-btn,
.chat-clear-btn,
.chat-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-reset-btn:hover,
.chat-clear-btn:hover,
.chat-close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-mid);
}

/* Resize handle */
.chat-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
}

.chat-resize-handle:hover,
.chat-resize-handle:active {
    background: var(--primary-light);
    opacity: 0.4;
}

/* Collapsed Kai (inline in topbar) */
.kai-collapsed {
    display: flex;
    align-items: center;
    margin-left: 4px;
}

.kai-open-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--border);
    background: #fafafa;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.kai-open-btn:hover {
    background: rgba(108, 92, 231, 0.08);
    border-color: var(--primary);
}

.kai-logo-inline {
    height: 22px;
    width: auto;
    object-fit: contain;
}

.kai-logo {
    height: 20px;
    width: auto;
    object-fit: contain;
}

.kai-collapsed-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.kai-collapsed-name {
    font-size: 14px;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: 1.5px;
}

.kai-collapsed-tagline {
    font-size: 9px;
    color: var(--text-light);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 100%;
}

.chat-msg.user {
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.chat-msg.user .chat-msg-avatar {
    background: var(--chat-user-bg);
    color: var(--text-mid);
}

.chat-msg.bot .chat-msg-avatar {
    background: none;
}

.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.4;
    max-width: 85%;
    word-wrap: break-word;
}

/* Compact markdown inside chat bubbles */
.chat-msg-bubble .md-content {
    line-height: 1.4;
}

.chat-msg-bubble .md-content p {
    margin: 0 0 4px 0;
}

.chat-msg-bubble .md-content p:last-child {
    margin-bottom: 0;
}

.chat-msg-bubble .md-content .md-h {
    margin: 6px 0 2px 0;
    font-size: 13px;
    line-height: 1.3;
}

.chat-msg-bubble .md-content h2.md-h { font-size: 15px; }
.chat-msg-bubble .md-content h3.md-h { font-size: 14px; }
.chat-msg-bubble .md-content h4.md-h { font-size: 13px; }

.chat-msg-bubble .md-content .md-list {
    margin: 2px 0 4px 0;
    padding-left: 18px;
}

.chat-msg-bubble .md-content .md-list li {
    margin-bottom: 1px;
}

.chat-msg-bubble .md-content code {
    background: rgba(108, 92, 231, 0.08);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

.chat-msg-bubble .md-content .md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 12px;
}

.chat-msg-bubble .md-content .md-table th,
.chat-msg-bubble .md-content .md-table td {
    border: 1px solid var(--border);
    padding: 4px 8px;
    text-align: left;
}

.chat-msg-bubble .md-content .md-table th {
    background: rgba(108, 92, 231, 0.06);
    font-weight: 600;
    font-size: 11px;
}

.chat-msg-bubble .md-content .md-table tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

.chat-msg-bubble .md-content a {
    color: var(--primary);
    text-decoration: none;
}

.chat-msg-bubble .md-content a:hover {
    text-decoration: underline;
}

.chat-msg.user .chat-msg-bubble {
    background: var(--chat-user-bg);
    border-top-right-radius: 4px;
}

.chat-msg.bot .chat-msg-bubble {
    background: var(--chat-bot-bg);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}

/* Feedback & copy action row under bot messages */
.chat-msg.bot {
    flex-wrap: wrap;
}

.chat-msg-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 0;
    margin-top: -4px;
    padding-left: 38px;
    flex-basis: 100%;
    opacity: 0;
    transition: opacity .15s;
}

.chat-msg.bot:hover .chat-msg-actions {
    opacity: 1;
}

.chat-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: color .15s;
}

.chat-action-btn:hover {
    color: #6b7280;
}

.chat-feedback-icon {
    position: relative;
    width: 14px;
    height: 14px;
    display: block;
}

.chat-icon-outline,
.chat-icon-filled {
    width: 14px;
    height: 14px;
    display: block;
}

.chat-icon-filled {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
}

.chat-feedback-btn.chat-active .chat-icon-outline {
    display: none;
}

.chat-feedback-btn.chat-active .chat-icon-filled {
    display: block;
}

.chat-feedback-btn.chat-active {
    color: #007a87;
}

@keyframes chat-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.chat-feedback-btn.chat-pop {
    animation: chat-pop .3s ease;
}

/* Welcome recommendation carousels in chat */
.chat-carousel-bubble {
    max-width: 100% !important;
    padding: 8px !important;
}

.welcome-rec-section {
    margin-bottom: 12px;
}

.welcome-rec-section:last-child {
    margin-bottom: 0;
}

.welcome-rec-title h3 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 2px 0;
}

.welcome-rec-description p {
    font-size: 11px;
    color: var(--text-mid);
    margin: 0 0 6px 0;
}

.product-carousel-container {
    width: 100%;
    overflow: hidden;
}

.product-carousel {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.product-carousel::-webkit-scrollbar {
    height: 4px;
}

.product-carousel::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 2px;
}

.product-card-horizontal {
    flex: 0 0 120px;
    min-width: 120px;
    max-width: 120px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px;
    background: var(--bg-primary);
}

.product-card-horizontal .product-image-container {
    position: relative;
}

.product-card-horizontal .product-image {
    width: 100%;
    height: 70px;
    object-fit: contain;
    border-radius: 4px;
}

.product-card-horizontal .product-title {
    font-size: 11px;
    font-weight: 500;
    max-height: 26px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 4px 0 2px 0;
}

.product-card-horizontal .product-brand {
    font-size: 10px;
    color: var(--text-mid);
}

.product-card-horizontal .product-price {
    font-size: 11px;
    font-weight: 600;
}

.product-card-horizontal .product-sku {
    font-size: 9px;
    color: var(--text-mid);
}

.product-card-horizontal .ask-question-btn,
.product-card-horizontal .more-like-this-btn {
    position: absolute;
    font-size: 8px;
    padding: 2px 6px;
    border: none;
    border-radius: 3px;
    color: #fff;
    cursor: pointer;
}

.product-card-horizontal .ask-question-btn {
    bottom: 4px;
    left: 4px;
    background: #ff8c00;
}

.product-card-horizontal .more-like-this-btn {
    top: 4px;
    left: 4px;
    background: #6366f1;
    display: none;
}

.carousel-scroll-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 10px;
    margin-top: 2px;
}

/* Welcome sectioned product view */
.sectioned-view {
    display: block !important;
}

.welcome-section {
    margin-bottom: 32px;
}

.welcome-section:last-child {
    margin-bottom: 0;
}

.welcome-section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.welcome-section-desc {
    font-size: 13px;
    color: var(--text-mid);
    margin: 0 0 12px 0;
}

.welcome-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typing 1.2s 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); }
}

.personalize-prompt {
    padding: 8px 16px;
}

.btn-personalize {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-personalize:hover {
    background: var(--primary);
    color: #fff;
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chat-input-area textarea {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area textarea:focus {
    border-color: var(--primary-light);
}

.image-attach-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-mid);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.image-attach-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chat-send-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

/* Image preview strip */
.image-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 8px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.image-preview-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
}

.image-preview-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-mid);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-remove-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--text-light);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.image-remove-btn:hover {
    background: #e74c3c;
}

/* Image thumbnail in user chat bubble */
.chat-image-thumb {
    max-width: 100%;
    max-height: 120px;
    border-radius: 6px;
    object-fit: contain;
    display: block;
    margin-bottom: 4px;
}

/* Product Area */
.product-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

/* UI block view (compare, etc.) — override grid for freeform HTML */
.product-grid.ui-block-view {
    display: block;
    padding: 16px;
}

.product-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
    background: var(--card-bg);
    cursor: pointer;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.product-card-image {
    position: relative;
    aspect-ratio: 1/1;
    background: #f5f5f5;
    overflow: hidden;
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-card-image img {
    transform: scale(1.03);
}

.product-bookmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.product-bookmark:hover {
    background: #fff;
    transform: scale(1.1);
}

.product-bookmark.saved {
    color: var(--primary);
}

.product-more-like {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: all 0.2s;
    opacity: 0;
}

.product-card:hover .product-more-like {
    opacity: 1;
}

.product-more-like:hover {
    background: #fff;
    transform: scale(1.05);
}

.more-like-icon {
    color: var(--primary);
    font-weight: 700;
}

.product-ask-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: all 0.2s;
    opacity: 0;
}

.product-card:hover .product-ask-btn {
    opacity: 1;
}

.product-ask-btn:hover {
    background: #fff;
    transform: scale(1.05);
}

.ask-icon {
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
}

/* View Products button in chat */
.chat-view-products {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 8px 32px;
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
}

.chat-view-products:hover {
    background: #f0edff;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.15);
}

.view-products-icon {
    flex-shrink: 0;
}

/* Ask question popout */
.ask-popout {
    position: fixed;
    width: 520px;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    padding: 20px 24px;
    z-index: 1100;
    animation: popoutFadeIn 0.15s ease;
}

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

.ask-popout-header {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.ask-popout-row {
    display: flex;
    gap: 12px;
}

.ask-popout-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 24px;
    font-family: inherit;
    outline: none;
    color: var(--text-dark);
}

.ask-popout-input:focus {
    border-color: var(--primary-light);
}

.ask-popout-send {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ask-popout-send:hover {
    background: #5b4bd5;
}

.product-card-info {
    padding: 5px 7px 6px;
}

.product-brand {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-dark);
    display: block;
    margin-bottom: 1px;
}

.product-title {
    font-size: 11px;
    color: var(--text-mid);
    display: block;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-sku {
    font-size: 9px;
    color: var(--text-light);
    display: block;
    margin-bottom: 2px;
    font-family: monospace;
}

.product-rating {
    font-size: 11px;
    color: #f5a623;
    margin-bottom: 2px;
}

.product-rating .rating-value {
    font-size: 10px;
    color: var(--text-mid);
    margin-left: 2px;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 5px;
}

.price-original {
    font-size: 10px;
    color: var(--text-light);
    text-decoration: line-through;
}

.price-current {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Loading Skeleton */
.loading-state {
    display: none;
}

.loading-state.active {
    display: block;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.skeleton-card {
    border-radius: var(--radius);
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    display: block;
    aspect-ratio: 3/4;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

.skeleton-card::after {
    content: '';
    display: block;
    height: 60px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-top: 8px;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
    font-size: 16px;
}

/* ========================================
   PRODUCT DETAIL MODAL
   ======================================== */

.product-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.product-modal {
    background: #fff;
    border-radius: var(--radius);
    max-width: 820px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-mid);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.12);
}

.modal-body {
    display: flex;
    min-height: 400px;
}

.modal-image {
    width: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-image img {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.modal-details {
    width: 50%;
    padding: 32px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-brand {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.modal-price {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
}

.modal-price-current {
    font-weight: 700;
    color: var(--text-dark);
}

.modal-price-original {
    font-size: 16px;
    color: var(--text-light);
    text-decoration: line-through;
}

.modal-description {
    font-size: 14px;
    color: var(--text-mid);
    line-height: 1.6;
    margin-top: 4px;
}

.desc-toggle {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.desc-toggle:hover {
    text-decoration: underline;
}

.modal-buy-btn {
    width: 100%;
    padding: 14px;
    background: var(--text-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.modal-buy-btn:hover {
    background: var(--primary);
}

.modal-meta {
    font-size: 13px;
    color: var(--text-light);
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.modal-similar {
    padding-top: 12px;
}

.modal-similar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.modal-similar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.modal-similar-card {
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.modal-similar-card:hover {
    box-shadow: var(--shadow);
}

.modal-similar-card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: #f5f5f5;
}

.modal-similar-info {
    padding: 4px 6px 6px;
}

.modal-similar-name {
    display: block;
    font-size: 10px;
    color: var(--text-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-similar-price {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
    }

    .modal-image,
    .modal-details {
        width: 100%;
    }

    .modal-image {
        max-height: 300px;
    }
}

/* ========================================
   CART PAGE
   ======================================== */

.cart-page {
    background: #fff;
    min-height: 100vh;
}

.cart-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

.cart-heading {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 24px;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 16px;
}

.btn-shop {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 28px;
    background: var(--text-dark);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s;
}

.btn-shop:hover {
    background: var(--primary);
}

.cart-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.cart-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #f5f5f5;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-brand {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.cart-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 14px;
    color: var(--text-mid);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mid);
    transition: all 0.2s;
}

.qty-btn:hover {
    border-color: var(--text-dark);
    color: var(--text-dark);
}

.qty-value {
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.cart-item-total {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cart-item-remove:hover {
    background: #fee;
    color: #e74c3c;
}

/* Cart Summary */
.cart-summary {
    width: 280px;
    flex-shrink: 0;
    background: #fafafa;
    border-radius: var(--radius);
    padding: 24px;
    position: sticky;
    top: 80px;
}

.cart-summary h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-mid);
}

.summary-row.summary-total {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.summary-free {
    color: #27ae60;
    font-weight: 600;
}

.btn-checkout {
    width: 100%;
    padding: 14px;
    background: var(--text-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 16px;
}

.btn-checkout:hover {
    background: var(--primary);
}

@media (max-width: 768px) {
    .cart-layout {
        flex-direction: column;
    }

    .cart-summary {
        width: 100%;
        position: static;
    }

    .cart-item-total {
        display: none;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .skeleton-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 3rem;
    }

    .trending-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-layout {
        flex-direction: column;
    }

    .chat-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    .skeleton-grid {
        grid-template-columns: 1fr;
    }
    .trending-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
