/* ============================================
   AUTOGROUPEU - CATALOG PAGE
   Product Cards & Sidebar (Luxury Design)
   Based on MOCKUP_CONCEPT.html
   ============================================ */

/* ============================================
   PAGE LAYOUT
   ============================================ */

.catalog-page {
    background: #fafafa;
    min-height: 100vh;
    padding: 2rem 0;
}

.catalog-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* ============================================
   HOME INFO CARDS (Need Help / Service / VIN)
   ============================================ */

.pre-products-bar-scroll {
    width: 100%;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pre-products-bar-scroll::-webkit-scrollbar {
    display: none;
}

.pre-products-bar-inner {
    display: flex;
    gap: 1rem;
    width: max-content;
}

.btn-card {
    flex: 0 0 72vw;
    max-width: 340px;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    padding: 0.95rem 0.9rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 82px;
}

.btn-card:hover,
.btn-card:focus {
    background: #f8fafc;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.mini-title {
    color: var(--lr-forest-green);
    font-weight: 700;
    font-size: 0.96rem;
    line-height: 1.2;
}

.mini-title i {
    color: var(--primary-blue);
}

.mini-sub {
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.83rem;
    line-height: 1.35;
}

/* ============================================
   SIDEBAR - MODERN FILTERS
   ============================================ */

.catalog-sidebar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    position: sticky;
    top: calc(160px + 2rem); /* Header height + spacing */
    transition: top 0.3s ease;
}

/* When header is compact */
body.header-compact .catalog-sidebar {
    top: calc(108px + 2rem); /* Compact header height + spacing */
}

.sidebar-header {
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--lr-gold);
    margin-bottom: 1rem;
}

.sidebar-title {
    font-family: var(--font-headings);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--lr-forest-green);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-title i {
    color: var(--lr-gold);
}

/* Category List */
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-row,
.subcategory-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-row .category-link,
.subcategory-row .subcategory-link {
    flex: 1;
}

.category-toggle {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.category-toggle:hover {
    color: var(--lr-forest-green);
    background: rgba(26,77,46,0.08);
}

.category-toggle i {
    transition: transform 0.2s;
}

.tree-node.is-expanded > .category-row .category-toggle i,
.tree-node.is-expanded > .subcategory-row .category-toggle i {
    transform: rotate(180deg);
}

.tree-children[hidden] {
    display: none !important;
}

.tree-node.is-active-trail > .category-row > .category-link,
.tree-node.is-active-trail > .subcategory-row > .subcategory-link {
    background: rgba(26, 77, 46, 0.06);
    color: var(--lr-forest-green);
    font-weight: 500;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-size: 0.95rem;
    position: relative;
}

.category-parent-trigger,
.subcategory-parent-trigger {
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

/* Gold accent bar on hover */
.category-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--lr-gold);
    border-radius: 2px;
    transition: height 0.2s;
}

.category-link:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
    padding-left: 1rem;
}

.category-link:hover::before {
    height: 60%;
}

/* Active category - green gradient */
.category-link.active {
    background: linear-gradient(135deg, var(--lr-forest-green), var(--lr-british-racing));
    color: white;
    font-weight: 600;
}

.category-link.active::before {
    height: 80%;
    background: var(--lr-gold);
}

.category-link.active:hover {
    background: linear-gradient(135deg, var(--lr-british-racing), var(--lr-forest-green));
    padding-left: 1rem;
}

.category-icon {
    font-size: 1.1rem;
    opacity: 0.8;
    min-width: 20px;
    text-align: center;
}

.category-link.active .category-icon {
    opacity: 1;
}

/* Subcategory List */
.subcategory-list {
    list-style: none;
    margin: 0.5rem 0 0 2rem;
    padding: 0;
}

.subcategory-item {
    margin-bottom: 0.25rem;
}

.subcategory-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.subcategory-link:hover {
    color: var(--primary-blue);
    background: var(--bg-light);
    padding-left: 1rem;
}

.subcategory-link.active {
    color: var(--lr-forest-green);
    font-weight: 600;
    background: rgba(26, 77, 46, 0.05);
}

.subcategory-list.level-2 {
    margin-left: 1.25rem;
}

.subcategory-link.level-2 {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.subcategory-list.level-3,
.subcategory-list.level-4,
.subcategory-list.level-5 {
    margin-left: 1rem;
}

.subcategory-link.level-3,
.subcategory-link.level-4,
.subcategory-link.level-5 {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

/* ============================================
   CATALOG MAIN CONTENT
   ============================================ */

.catalog-main {
    min-height: 400px;
}

/* Catalog Header */
.catalog-header {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.catalog-title {
    font-family: var(--font-headings);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--lr-forest-green);
    margin: 0 0 0.5rem 0;
}

.catalog-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

/* Stock Banner */
.stock-banner {
    background: linear-gradient(135deg, var(--lr-forest-green) 0%, var(--lr-british-racing) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 0.6rem 1.25rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-md);
}

.stock-banner-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stock-banner-content h3 {
    color: white;
    font-size: 0.95rem;
    margin: 0 0 0.1rem 0;
}

.stock-banner-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.8rem;
}

/* ============================================
   PRODUCT GRID - LUXURY DESIGN
   ============================================ */

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

/* Product Card - Luxury Premium Design */
.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-premium);
    border-color: var(--lr-gold);
}

/* Product Image Wrapper */
.product-image-wrapper {
    position: relative;
    padding-top: 75%; /* 4:3 aspect ratio */
    background: var(--bg-light);
    overflow: hidden;
}

.product-image-wrapper > a {
    position: absolute;
    inset: 0;
    display: block;
}

.product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    transition: transform 0.3s ease;
}

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

/* Wishlist Button */
.product-wishlist {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-xs);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.product-wishlist:hover {
    background: white;
    color: var(--danger);
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.product-wishlist.active {
    color: var(--danger);
    background: rgba(239,68,68,0.1);
}

/* Product Badges */
.product-badge-group {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-badge {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: var(--shadow-xs);
}

.badge-stock {
    background: rgba(16,185,129,0.9);
    color: white;
}

.badge-new {
    background: rgba(26,77,46,0.9);
    color: white;
}

.badge-sale {
    background: rgba(239,68,68,0.9);
    color: white;
}

.badge-brand {
    background: rgba(255,255,255,0.95);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Product Content */
.product-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

/* Brand Name */
.product-brand {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--lr-forest-green);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

/* Product Title */
.product-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2; /* Standard property */
}

.product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.product-title a:hover {
    color: var(--primary-blue);
}

/* Article Code */
.product-article {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-article i {
    font-size: 0.7rem;
}

/* Product Price Section */
.product-price-section {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

/* Main Price */
.product-price-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lr-forest-green);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0 0 0.25rem 0;
}

.price-currency {
    font-size: 1.2rem;
}

.price-vat-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    padding: 0.125rem 0.375rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

/* Price Without VAT */
.product-price-secondary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Product Actions */
.product-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Add to Cart Button */
.btn-add-to-cart {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-add-to-cart:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-add-to-cart i {
    font-size: 1rem;
}

/* Quick View Button */
.btn-quick-view {
    background: white;
    border: 2px solid var(--border-light);
    color: var(--text-secondary);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-quick-view:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background: var(--bg-light);
}

/* ============================================
   QUICK VIEW MODAL - PHASE 2
   ============================================ */

.quick-view-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.quick-view-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.quick-view-window {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: var(--radius-lg);
    width: min(1000px, 100%);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.quick-view-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 2;
}

.quick-view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.quick-view-media {
    background: var(--bg-light);
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-view-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1rem;
    background: white;
}

.quick-view-placeholder {
    font-size: 3rem;
    color: var(--text-muted);
}

.quick-view-panel {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quick-view-title {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.25;
    color: var(--lr-forest-green);
}

.quick-view-meta {
    display: grid;
    gap: 0.5rem;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.quick-view-price-box {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.quick-view-price-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lr-forest-green);
}

.quick-view-price-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.quick-view-availability {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.availability-in-stock {
    color: #10b981;
}

.availability-on-request {
    color: #f59e0b;
}

.quick-view-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: auto;
}

.quick-view-add-to-cart,
.btn-quick-view-open {
    min-height: 44px;
}

.btn-quick-view-open {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    background: white;
}

.btn-quick-view-open:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

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

@media (max-width: 1200px) {
    .catalog-layout {
        grid-template-columns: 260px 1fr;
        gap: 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }
    
    .catalog-sidebar {
        position: static;
        margin-bottom: 2rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Sidebar повністю ховається на мобільному — каталог через bottom-nav */
    .catalog-sidebar {
        display: none;
    }

    .catalog-container {
        padding: 0 8px;
    }
    
    .catalog-page {
        padding: 0.5rem 0;
    }

    .pre-products-bar-scroll {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Компактні картки товарів */
    .product-card:hover {
        transform: none;
    }

    .product-card:hover .product-img {
        transform: none;
    }

    .product-content {
        padding: 0.5rem;
        gap: 0.35rem;
    }

    .product-brand {
        font-size: 0.65rem;
    }

    .product-title {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .product-article {
        font-size: 0.68rem;
    }

    .product-price-main {
        font-size: 1.1rem;
        gap: 0.25rem;
    }

    .price-currency {
        font-size: 0.9rem;
    }

    .price-vat-badge {
        font-size: 0.6rem;
        padding: 0.1rem 0.25rem;
    }

    .product-price-secondary {
        font-size: 0.72rem;
    }

    .product-price-section {
        padding-top: 0.4rem;
    }

    .product-actions {
        grid-template-columns: 1fr;
        gap: 0.35rem;
        margin-top: 0.4rem;
    }

    .btn-add-to-cart {
        padding: 0.5rem;
        font-size: 0.78rem;
    }

    .btn-quick-view {
        display: none;
    }

    .product-wishlist {
        width: 28px;
        height: 28px;
        top: 0.35rem;
        right: 0.35rem;
        font-size: 0.85rem;
    }

    .product-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.65rem;
    }

    .product-badge-group {
        top: 0.35rem;
        left: 0.35rem;
    }
    
    .stock-banner {
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 0.75rem;
    }
    
    .catalog-header {
        padding: 0.75rem;
    }

    .catalog-header .catalog-title {
        font-size: 1.1rem;
        margin-bottom: 0.15rem;
    }

    .catalog-header .catalog-subtitle {
        font-size: 0.78rem;
        display: none;
    }

    .stock-banner h3 {
        font-size: 0.8rem;
    }

    .stock-banner p {
        font-size: 0.68rem;
        margin: 0;
    }

    .quick-view-grid {
        grid-template-columns: 1fr;
    }

    .quick-view-media {
        min-height: 240px;
    }
}

@media (min-width: 992px) {
    .pre-products-bar-scroll {
        overflow: visible;
    }

    .pre-products-bar-inner {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .btn-card {
        flex: 1 1 auto;
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 576px) {
    /* Завжди 2 колонки навіть на маленьких екранах */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .product-card {
        max-width: none;
        margin: 0;
    }

    .product-image-wrapper {
        padding-top: 85%;
    }

    .product-content {
        padding: 0.4rem;
        gap: 0.25rem;
    }

    .product-price-main {
        font-size: 1rem;
    }

    .btn-add-to-cart {
        padding: 0.45rem;
        font-size: 0.72rem;
        gap: 0.3rem;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.products-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.products-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.products-empty i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.products-empty h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.products-empty p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-light);
    background: white;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    text-decoration: none;
}

.pagination-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background: var(--bg-light);
}

.pagination-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn:disabled:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
    background: white;
}
