/* ============================================================
   TFSR MARKETPLACE — ЕДИНЫЙ ФАЙЛ СТИЛЕЙ
   ============================================================ */

/* ============================================================
   1. БАЗОВЫЕ СТИЛИ
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary-blue: #0a2540;
    --accent-gold: #DAA520;
    --accent-red: #C8102E;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
    color: #1e293b;
    line-height: 1.6;
    background: #f8fafc;
}

/* ============================================================
   2. ХЕДЕР (из header-bar.php)
   ============================================================ */
.tfsr-header-wrapper {
    background: linear-gradient(180deg, rgba(218, 165, 32, 0.85) 0%, rgba(255, 165, 0, 0.35) 60%, rgba(255, 165, 0, 0.05) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    width: 100vw;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    box-sizing: border-box;
    z-index: 999;
    padding: 0;
}
.tfsr-header-bar {
    background: transparent !important;
    border-bottom: none;
    padding: 0 30px 4px 30px !important;
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 999;
}
.tfsr-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto;
    height: 60px;
    gap: 20px;
}
.tfsr-header-logo img { height: 52px; width: auto; display: block; }
.tfsr-search-wrap { position: relative; width: 280px; flex-shrink: 0; }
.tfsr-search-input {
    width: 100% !important;
    padding: 7px 16px !important;
    border: 2px solid rgba(218, 165, 32, 0.3) !important;
    border-radius: 30px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(12px) !important;
    color: #fff !important;
    font-size: 13.5px !important;
    height: 36px !important;
    outline: none !important;
    text-align: center !important;
}
.tfsr-search-input::placeholder { color: rgba(255, 255, 255, 0.5) !important; }
.tfsr-header-icons { display: flex; align-items: center; gap: 14px; }
.tfsr-header-icon {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 21px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    transition: all 0.25s ease;
    background: none;
    border: none;
    cursor: pointer;
}
.tfsr-header-icon:hover { background: rgba(255,255,255,0.1); color: #fff; }
.tfsr-cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #C8102E;
    color: white;
    font-size: 9px;
    font-weight: 700;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== ВЕРХНЕЕ МЕНЮ (ПК) ===== */
.tfsr-header-top {
    background: transparent !important;
    border-bottom: none;
    padding: 4px 30px 0 30px !important;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 10000;
}
.tfsr-header-top-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    gap: 35px;
    align-items: center;
    height: 40px;
    padding: 0 10px;
}
.tfsr-header-top-item {
    position: relative;
    cursor: pointer;
}
.tfsr-header-top-title {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
}
.tfsr-header-top-title:hover { color: #ffffff; }
.tfsr-header-top-arrow {
    font-size: 10px;
    transition: transform 0.3s;
    color: rgba(255, 255, 255, 0.5);
}
.tfsr-header-top-item:hover .tfsr-header-top-arrow { transform: rotate(180deg); }
.tfsr-header-top-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    padding: 8px 0;
    min-width: 210px;
    list-style: none;
    margin: 4px 0 0 0;
    border: 1px solid rgba(0,0,0,0.04);
    z-index: 1001;
}
.tfsr-header-top-item:hover .tfsr-header-top-dropdown { display: block; }
.tfsr-header-top-dropdown li a {
    display: block;
    padding: 10px 18px;
    color: #1e293b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.tfsr-header-top-dropdown li a:hover {
    background: #f8fafc;
    color: #DAA520;
}
.tfsr-header-top-lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.tfsr-header-top-lang-btn:hover { background: #f0f0f0; }
.tfsr-header-top-lang-btn.active { background: rgba(255, 215, 0, 0.3); }

/* ===== МЕНЮ-БУРГЕР ===== */
.tfsr-burger-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.tfsr-burger-btn span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #ffffff;
    border-radius: 3px;
    transition: all 0.3s;
}
.tfsr-burger-btn.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.tfsr-burger-btn.active span:nth-child(2) { opacity: 0; }
.tfsr-burger-btn.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.tfsr-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99998;
}
.tfsr-menu-overlay.active { display: block; }
.tfsr-menu-drawer {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    max-width: 70vw;
    height: 100vh;
    background: white;
    z-index: 99999;
    transition: left 0.3s;
    box-shadow: 4px 0 30px rgba(0,0,0,0.1);
    overflow-y: auto;
}
.tfsr-menu-drawer.open { left: 0; }
.tfsr-menu-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
}
.tfsr-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    gap: 12px;
}
.tfsr-menu-link.profile {
    background: #f8fafc;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

/* ============================================================
   3. КАРТОЧКИ ТОВАРОВ (ГЛАВНАЯ, КАТАЛОГ)
   ============================================================ */
.tfsr-products-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}
.tfsr-product-card {
    background: white;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
}
.tfsr-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.06);
    border-color: var(--accent-gold);
}
.tfsr-product-image { aspect-ratio: 1/1; overflow: hidden; background: #f1f5f9; }
.tfsr-product-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tfsr-product-info { padding: 12px; display: flex; flex-direction: column; flex: 1; }
.tfsr-product-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
}
.tfsr-product-title a { text-decoration: none; color: inherit; }
.tfsr-product-title a:hover { color: var(--accent-gold); }
.tfsr-product-price { font-size: 1.1rem; font-weight: 800; color: var(--accent-red); margin: 6px 0; }
.tfsr-product-min-order { font-size: 0.75rem; color: #64748b; }
.tfsr-product-min-order strong { color: var(--primary-blue); }
.tfsr-product-seller { font-size: 0.7rem; color: #94a3b8; margin-top: 6px; }
.tfsr-delivery-status { font-size: 0.7rem; color: var(--accent-gold); margin-top: 4px; }

/* ============================================================
   4. КАРТОЧКА ТОВАРА (TAOBAO-STYLE) — ИСПРАВЛЕНА
   ============================================================ */
.tfsr-product-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* ГРИД: ЛЕВАЯ (с вкладками) + ПРАВАЯ (sticky) */
.tfsr-product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: flex-start;
}

/* ===== ЛЕВАЯ ЧАСТЬ ===== */
.tfsr-product-left {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Галерея */
.tfsr-gallery-main {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    background: #fafafa;
}
.tfsr-gallery-main img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.tfsr-gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.tfsr-gallery-thumbs img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.tfsr-gallery-thumbs img:hover,
.tfsr-gallery-thumbs img.active {
    border-color: #DAA520;
}

/* ===== ВКЛАДКИ (внутри левой части) ===== */
.tfsr-tabs {
    margin-top: 20px;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
}
.tfsr-tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e8e8e8;
    overflow-x: auto;
    background: #fafafa;
}
.tfsr-tabs-nav button {
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    border-bottom: 2px solid transparent;
}
.tfsr-tabs-nav button:hover { color: #0a2540; }
.tfsr-tabs-nav button.active {
    color: #0a2540;
    border-bottom-color: #DAA520;
}
.tfsr-tabs-content { padding: 20px; }
.tfsr-tab-pane { display: none; }
.tfsr-tab-pane.active { display: block; }

/* Таблица характеристик */
.tfsr-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.tfsr-specs-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.tfsr-specs-table .label {
    color: #999;
    width: 140px;
    font-weight: 500;
}
.tfsr-specs-table .value { color: #1e293b; }

/* ===== ПРАВАЯ ЧАСТЬ: STICKY ===== */
.tfsr-product-right {
    position: sticky;
    top: 20px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.tfsr-product-brand {
    font-size: 13px;
    color: #DAA520;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tfsr-product-title {
    font-size: 20px;
    font-weight: 700;
    color: #0a2540;
    line-height: 1.4;
}
.tfsr-product-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}
.tfsr-product-rating .stars {
    color: #DAA520;
    font-size: 16px;
    letter-spacing: 1px;
}
.tfsr-product-rating .count { color: #999; }

/* Цена */
.tfsr-price-block {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 16px 20px;
}
.tfsr-price-block .price {
    font-size: 28px;
    font-weight: 800;
    color: #C8102E;
}
.tfsr-price-block .price-currency {
    font-size: 16px;
    font-weight: 600;
}
.tfsr-price-block .price-old {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
    margin-left: 10px;
}
.tfsr-price-block .price-note {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}
.tfsr-price-block .min-order {
    font-size: 13px;
    color: #333;
    margin-top: 8px;
}
.tfsr-price-block .min-order strong { color: #0a2540; }

/* Доставка */
.tfsr-delivery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}
.tfsr-delivery-item {
    font-size: 13px;
    color: #333;
}
.tfsr-delivery-item .label {
    color: #999;
    font-size: 11px;
}
.tfsr-delivery-item .value { font-weight: 600; }
.tfsr-delivery-item .in-stock { color: #22c55e; }
.tfsr-delivery-item .out-of-stock { color: #ef4444; }

/* Продавец */
.tfsr-seller-block {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.tfsr-seller-block .seller-name {
    font-weight: 600;
    color: #0a2540;
}
.tfsr-seller-block .seller-rating {
    font-size: 13px;
    color: #666;
}
.tfsr-seller-block .seller-rating .stars { color: #DAA520; }

/* Кнопки */
.tfsr-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.tfsr-actions .btn-cart {
    flex: 1;
    padding: 14px 20px;
    background: linear-gradient(135deg, #DAA520, #FFA500);
    color: #1a1a1a;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}
.tfsr-actions .btn-cart:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(218, 165, 32, 0.3);
}
.tfsr-actions .btn-buy {
    flex: 1;
    padding: 14px 20px;
    background: #C8102E;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}
.tfsr-actions .btn-buy:hover {
    background: #a00b25;
    transform: scale(1.02);
}
.tfsr-actions .btn-wishlist {
    padding: 14px 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s;
}
.tfsr-actions .btn-wishlist:hover { background: #e2e8f0; }

/* ============================================================
   5. ПЕРЕКЛЮЧЕНИЕ ЯЗЫКОВ
   ============================================================ */
.tfsr-cn { display: none; }
.tfsr-ru { display: inline; }
.show-cn .tfsr-ru { display: none !important; }
.show-cn .tfsr-cn { display: inline !important; }

/* ============================================================
   6. АДАПТИВ
   ============================================================ */

@media (max-width: 1024px) {
    .tfsr-header-top { display: none !important; }
    .tfsr-product-grid { grid-template-columns: 1fr; gap: 24px; }
    .tfsr-product-right { position: relative; top: 0; }
    .tfsr-gallery-main img { max-height: 400px; }
    .tfsr-products-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}

@media (max-width: 768px) {
    .tfsr-burger-btn { display: flex !important; }
    .tfsr-search-wrap { display: none !important; }
    .tfsr-header-inner { height: 46px !important; gap: 6px !important; }
    .tfsr-header-logo img { height: 30px !important; }
    .tfsr-header-bar { padding: 0 8px !important; }
    .tfsr-header-icon { width: 32px !important; height: 32px !important; font-size: 18px !important; }
    .tfsr-cart-count { width: 16px !important; height: 16px !important; font-size: 8px !important; }
    .tfsr-products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .tfsr-product-title { font-size: 0.75rem; height: 32px; }
    .tfsr-product-price { font-size: 0.9rem; }
    .tfsr-product-page { padding: 12px 10px; }
    .tfsr-product-title { font-size: 18px; }
    .tfsr-price-block .price { font-size: 24px; }
    .tfsr-price-block { padding: 14px; }
    .tfsr-delivery-grid { grid-template-columns: 1fr; gap: 6px; }
    .tfsr-actions { flex-wrap: wrap; }
    .tfsr-actions .btn-cart,
    .tfsr-actions .btn-buy { flex: 1 1 100%; padding: 12px; font-size: 15px; }
    .tfsr-actions .btn-wishlist { flex: 0 0 auto; }
    .tfsr-tabs-nav button { padding: 10px 14px; font-size: 13px; }
    .tfsr-specs-table td { padding: 8px 12px; font-size: 13px; }
    .tfsr-specs-table .label { width: 100px; }
    .tfsr-gallery-thumbs img { width: 50px; height: 50px; }
    .tfsr-product-rating { font-size: 13px; flex-wrap: wrap; }
    .tfsr-menu-drawer { width: 70vw; max-width: 300px; }
    .tfsr-product-right { padding: 16px; }
}

@media (max-width: 400px) {
    .tfsr-header-inner { height: 40px !important; gap: 4px !important; }
    .tfsr-header-logo img { height: 24px !important; }
    .tfsr-header-icon { width: 28px !important; height: 28px !important; font-size: 16px !important; }
    .tfsr-products-grid { gap: 6px; }
    .tfsr-product-title { font-size: 0.65rem; height: 28px; }
    .tfsr-product-price { font-size: 0.8rem; }
    .tfsr-product-right { padding: 12px; }
    .tfsr-price-block .price { font-size: 20px; }
    .tfsr-tabs-nav button { padding: 8px 12px; font-size: 12px; }
}