/*
Theme Name: TikTok Shop Marketplace
Theme URI: https://lodraka.store/
Description: Light Mode E-commerce Marketplace - Clean & Vibrant
Version: 3.0.0
Author: Lodraka
Text Domain: tiktok-shop-marketplace
*/

/* --- GLOBAL RESET & LIGHT MODE CANVAS --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    color: #161823;
    width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* --- CSS VARIABLES --- */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f0;
    --accent: #fe2c55;
    --accent-hover: #e0254a;
    --text-primary: #161823;
    --text-secondary: #8a8d91;
    --text-muted: #a8aab0;
    --border-color: #e8e8e8;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* --- HEADER BAR (Fixed Top) --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.header-inner {
    max-width: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.header-logo a {
    font-size: 1.3rem;
    font-weight: 800;
    color: #161823;
    letter-spacing: -0.02em;
}

.header-logo .logo-slash {
    color: var(--accent);
}

.header-search {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.header-search-input {
    width: 100%;
    padding: 10px 48px 10px 20px;
    background: #f8f8f8;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.header-search-input::placeholder {
    color: var(--text-muted);
}

.header-search-input:focus {
    border-color: var(--accent);
}

.header-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    position: relative;
}

.header-icon-btn:hover {
    background: var(--bg-hover);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-create-btn {
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.header-create-btn:hover {
    background: var(--accent-hover);
}

/* --- MAIN MARKETPLACE GRID CONTAINER --- */
.site-main {
    margin-top: 64px;
    padding: 20px 24px;
    max-width: 100%;
    width: 100%;
}

.marketplace-grid {
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    gap: 20px;
    align-items: start;
    width: 100%;
    align-content: start;
}

/* --- CARD BASE STYLES --- */
.sidebar-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-link {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.section-link:hover {
    color: var(--accent-hover);
}

/* --- LEFT SIDEBAR: Categories + TikTok Video (240px) --- */
.left-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 84px);
}

/* TikTok Video in Sidebar */
.sidebar-video-card {
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 9/16;
    position: relative;
}

.sidebar-video-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.sidebar-video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-live-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.sidebar-live-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.sidebar-viewer-count {
    position: absolute;
    top: 12px;
    left: 70px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
}

.sidebar-video-title {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    z-index: 10;
}

.sidebar-video-interactions {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.sidebar-interaction-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.sidebar-interaction-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Categories */
.category-list {
    display: flex;
    flex-direction: column;
    padding: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

.category-item:hover {
    background: var(--bg-secondary);
}

.category-icon {
    font-size: 1.2rem;
}

.category-name {
    flex: 1;
}

.category-arrow {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* --- CENTER SECTION: Product Grids Only --- */
.center-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Products Section */
.products-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 16px;
}

.product-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-image-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8f8f8;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-content {
    padding: 12px;
}

.product-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.product-original {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.product-stats {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.product-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-buy-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.product-buy-btn:hover {
    background: var(--accent-hover);
}

/* --- RIGHT SIDEBAR: Highlights + Chat (280px) --- */
.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 84px);
}

.highlights-scroll {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.highlights-scroll::-webkit-scrollbar {
    width: 4px;
}

.highlights-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.highlight-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.highlight-card:hover {
    background: var(--bg-hover);
}

.highlight-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.highlight-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.highlight-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.highlight-discount {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 700;
}

.highlight-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
}

/* Live Chat */
.chat-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    overflow-y: auto;
    min-height: 0;
}

.chat-scroll::-webkit-scrollbar {
    width: 4px;
}

.chat-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.chat-item {
    display: flex;
    gap: 8px;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    flex-shrink: 0;
}

.chat-content {
    flex: 1;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-md);
}

.chat-user {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

.chat-text {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.chat-input-wrapper {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

/* --- FOOTER --- */
.site-footer {
    margin-top: 32px;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-inner {
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--accent);
}

.footer-badges {
    display: flex;
    gap: 12px;
}

.footer-badge {
    min-width: 60px;
    height: 32px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid var(--border-color);
    padding: 0 12px;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1200px) {
    .marketplace-grid {
        grid-template-columns: 200px 1fr 240px;
        gap: 16px;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .marketplace-grid {
        grid-template-columns: 1fr;
    }

    .left-sidebar,
    .right-sidebar {
        position: static;
        max-height: none;
    }

    .sidebar-video-card {
        aspect-ratio: 16/9;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .header-search {
        display: none;
    }

    .header-create-btn {
        display: none;
    }

    .site-main {
        padding: 16px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .sidebar-video-card {
        aspect-ratio: 16/9;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-video-card {
        aspect-ratio: 16/9;
    }
}
