/* =========================================================
   PCMBOX FIRMWARE PAGE
   Search, category filters, brand sidebar, cards and pager
   ========================================================= */

.page-wrap {
        max-width: 1400px;
        margin: 0 auto;
        padding: 20px 16px 40px;
    }

    .top-toolbar {
        margin-bottom: 18px;
        display: flex;
        justify-content: end;
    }

    .search-bar {
        position: relative;
        width: 100%;
        max-width: 560px;
        margin: 0;
    }

    .search-input {
        width: 100%;
        height: 48px;
        border: 1px solid #d7d7d7;
        border-radius: 26px;
        background: #fff;
        padding: 0 18px;
        font-size: 15px;
        color: #444;
        outline: none;
        box-shadow: 0 2px 6px rgba(0,0,0,.05);
    }

    .search-input:focus {
        border-color: #96abd0;
        box-shadow: 0 0 0 3px rgba(113,145,191,.14);
    }

    .category-bar {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        margin-bottom: 22px;
        padding-bottom: 2px;
    }

    .category-track {
        display: flex;
        gap: 10px;
        min-width: max-content;
        padding: 4px 2px;
    }

    .category-item {
        flex: 0 0 auto;
        padding: 10px 16px;
        border-radius: 22px;
        background: linear-gradient(180deg, #f7f7f7 0%, #e9edf3 100%);
        border: 1px solid #d5dbe6;
        font-size: 13px;
        font-weight: 700;
        color: #4c5563;
        cursor: pointer;
        white-space: nowrap;
        transition: all .2s ease;
        box-shadow: 0 3px 8px rgba(0,0,0,.04);
        text-transform: uppercase;
        letter-spacing: .3px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .category-item:hover {
        background: #dde6f5;
        color: #1f2d3d;
        transform: translateY(-1px);
    }

    .category-item.active {
        background: linear-gradient(180deg, #5f7fb3 0%, #3f5f92 100%);
        color: #fff;
        border-color: #3d5a88;
        box-shadow: 0 4px 10px rgba(63,95,146,.25);
    }

    .category-label {
        display: inline-block;
    }

    .category-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 7px;
        border-radius: 999px;
        background: rgba(0,0,0,.08);
        font-size: 11px;
        font-weight: 700;
        line-height: 1;
    }

    .category-item.active .category-count {
        background: rgba(255,255,255,.22);
        color: #fff;
    }

    .category-bar::-webkit-scrollbar {
        height: 6px;
    }

    .category-bar::-webkit-scrollbar-thumb {
        background: #c8d3e3;
        border-radius: 10px;
    }

    .layout-row {
        display: flex;
        align-items: flex-start;
        gap: 28px;
    }

    .sidebar {
        width: 270px;
        flex-shrink: 0;
    }

    .content-area {
        flex: 1;
        min-width: 0;
    }

    .brand-box {
        margin-bottom: 12px;
        border-radius: 14px;
        overflow: hidden;
        background: linear-gradient(180deg, #f7f7f7 0%, #e9edf3 100%);
        border: 1px solid #d5dbe6;
        box-shadow: 0 4px 10px rgba(0,0,0,.05);
        transition: all .2s ease;
    }

    .brand-box:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0,0,0,.12);
    }

    .brand-head {
        padding: 14px 18px;
        font-size: 14px;
        font-weight: 600;
        color: #4c5563;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: all .2s ease;
    }

    .brand-head:hover {
        background: #dde6f5;
        color: #1f2d3d;
    }

    .brand-head.brand-filter.active {
        background: linear-gradient(180deg, #5f7fb3 0%, #3f5f92 100%);
        color: #fff;
        font-weight: 700;
    }

    .brand-head::after {
        content: "›";
        font-size: 18px;
        opacity: 0.6;
    }

    .brand-head.brand-filter.active::after {
        opacity: 1;
    }

    .brand-left {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .brand-icon {
        width: 22px;
        height: 22px;
        object-fit: contain;
        flex: 0 0 auto;
    }

    .brand-name {
        display: block;
        text-transform: uppercase;
        letter-spacing: .5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(240px, 1fr));
        gap: 22px 24px;
    }

    .product-card {
        position: relative;
        height: 300px;
        border-radius: 12px;
        overflow: hidden;
        color: #fff;
        background: #111;
        box-shadow: 0 2px 8px rgba(0,0,0,.18);
        cursor: pointer;
        transform: translateZ(0);
        transition: transform .22s ease, box-shadow .22s ease;
    }

    .product-card-bg {
        position: absolute;
        inset: 0;
        background-color: #101010;
        background-image:
            linear-gradient(to bottom, rgba(0,0,0,.20), rgba(0,0,0,.60)),
            var(--card-bg, url('uploads/default.jpg'));
        background-size: cover;
        background-position: center;
        transition: transform 1.35s ease;
    }

    .product-card:hover {
        transform: scale(1.02);
        box-shadow: 0 10px 26px rgba(0,0,0,.28);
    }

    .product-card:hover .product-card-bg {
        transform: scale(1.10);
    }
    .product-inner {
        position: relative;
        z-index: 3;
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 18px 18px 16px;
    }

    .product-title {
        margin: 24px 0 6px;
        text-align: center;
        font-size: 24px;
        line-height: 1.1;
        font-weight: 800;
        color: #FFB347;
        letter-spacing: .4px;
        word-break: break-word;
        text-shadow: 0 2px 4px rgba(0,0,0,.35);
    }
    .product-footer {
        margin-top: auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        font-size: 12px;
        color: #ececec;
        margin-left: -28px;
        margin-right: -32px;
        margin-bottom: -26px;
        padding: 12px 18px;
    }
    .footer-left {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        flex: 1 1 auto;
    }
    .footer-right {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
    .product-logo {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .product-logo img {
        max-width: 120px;
        max-height: 30px;
        object-fit: contain;
        filter: drop-shadow(0 3px 6px rgba(0,0,0,.4));
    }
    .footer-category {
        display: block;
        font-weight: 600;
        color: #1E90FF;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-transform: uppercase;
        letter-spacing: .3px;
    }

    .footer-price {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 28px;
        padding: 0 10px;
        border-radius: 999px;
        background: linear-gradient(180deg, #FFB347 0%, #FF8C00 100%);
        color: #1f1f1f;
        font-size: 13px;
        font-weight: 800;
        line-height: 1;
        box-shadow: 0 4px 10px rgba(240,185,11,.22);
    }
    .pager-wrap {
        margin-top: 34px;
        display: flex;
        justify-content: center;
    }

    .custom-pager {
        width: 100%;
        max-width: 100%;
        background: linear-gradient(180deg, #fafafa 0%, #ececec 100%);
        border: 1px solid #cfd7e6;
        border-radius: 18px;
        box-shadow: 0 10px 24px rgba(61,88,124,.12);
        padding: 12px 14px;
        display: flex;
        align-items: center;
        gap: 14px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .page-size {
        min-width: 155px;
        display: flex;
        align-items: center;
        gap: 8px;
        justify-content: flex-start;
        padding-right: 14px;
        border-right: 1px solid #d8dfea;
        flex: 0 0 auto;
    }

    .page-info {
        min-width: 180px;
        white-space: nowrap;
        color: #5f6f88;
        font-size: 13px;
        font-weight: 700;
        text-align: left;
        flex: 0 0 auto;
    }

    .page-nav {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
        background: rgba(255,255,255,.55);
        border: 1px solid #d8e0ed;
        border-radius: 14px;
        padding: 6px 10px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .page-nav-inner {
        display: flex;
        gap: 8px;
        margin: 0 auto;
    }

    .page-size a,
    .page-nav a,
    .page-nav span.disabled {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        height: 36px;
        padding: 0 12px;
        text-align: center;
        color: #5f6773;
        text-decoration: none;
        border-radius: 10px;
        border: 1px solid transparent;
        font-weight: 700;
        background: linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
        transition: all .2s ease;
        flex: 0 0 auto;
    }

    .page-size a:hover,
    .page-nav a:hover,
    .page-size a:focus,
    .page-nav a:focus {
        text-decoration: none;
        background: linear-gradient(180deg, #fdfefe 0%, #eaf1fb 100%);
        border-color: #bfd0ea;
        color: #314766;
        box-shadow: 0 3px 8px rgba(80,115,170,.12);
    }

    .page-size a.active,
    .page-nav a.active {
        color: #fff;
        background: linear-gradient(180deg, #5f7fb3 0%, #3f5f92 100%);
        border-color: #3d5a88;
        box-shadow: 0 4px 10px rgba(63,95,146,.28);
    }

    .page-nav a.disabled,
    .page-nav span.disabled {
        pointer-events: none;
        opacity: .45;
        background: #f4f4f4;
        box-shadow: none;
    }

    .nav-arrow {
        font-size: 20px;
        line-height: 1;
        padding: 0 10px !important;
    }

    .page-nav::-webkit-scrollbar {
        height: 6px;
    }

    .page-nav::-webkit-scrollbar-thumb {
        background: #c8d3e3;
        border-radius: 10px;
    }

    .mobile-filter-toggle {
        display: none;
        width: 100%;
        margin-bottom: 16px;
        border: 0;
        background: #d9d9d9;
        border-radius: 16px;
        padding: 12px 16px;
        text-align: left;
        color: #5b5b5b;
        font-size: 15px;
        font-weight: 600;
    }

    .mobile-filter-toggle .caret-icon {
        float: right;
        color: #d8a600;
        font-size: 18px;
        line-height: 1;
    }

    .empty-state {
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 12px;
        padding: 18px;
        font-size: 15px;
        color: #666;
        grid-column: 1 / -1;
    }

    @media (max-width: 1360px) {
        .product-grid {
            grid-template-columns: repeat(3, minmax(240px, 1fr));
        }
    }

    @media (max-width: 1199px) {
        .product-grid {
            grid-template-columns: repeat(2, minmax(240px, 1fr));
        }
    }

    @media (max-width: 991px) {
        .layout-row {
            display: block;
        }

        .mobile-filter-toggle {
            display: block;
        }

        .sidebar {
            width: 100%;
            margin-bottom: 18px;
            display: none;
        }

        .sidebar.open {
            display: block;
        }

        .product-grid {
            grid-template-columns: repeat(2, minmax(220px, 1fr));
            gap: 18px;
        }

        .search-bar {
            max-width: 100%;
        }

        .custom-pager {
            flex-wrap: wrap;
        }

        .page-size,
        .page-info,
        .page-nav {
            width: 100%;
            min-width: 100%;
        }

        .page-size {
            justify-content: center;
            border-right: 0;
            padding-right: 0;
        }

        .page-info {
            text-align: center;
        }

        .page-nav {
            justify-content: flex-start;
        }

        .page-nav-inner {
            margin: 0;
        }
    }

    @media (max-width: 767px) {
        .page-wrap {
            padding: 15px 10px 26px;
        }

        .product-grid {
            grid-template-columns: 1fr;
        }

        .product-card {
            height: 250px;
        }

        .product-title {
            font-size: 22px;
        }
        .custom-pager {
            gap: 10px;
            padding: 12px;
        }
    }

    @media (max-width: 420px) {
        .product-card {
            height: 230px;
        }

        .product-inner {
            padding: 15px 15px 14px;
        }

        .product-title {
            font-size: 19px;
            margin: 19px 0 6px;
        }

        .product-logo {
            font-size: 18px;
        }

        .product-footer {
            margin-left: -15px;
            margin-right: -15px;
            margin-bottom: -14px;
            padding: 10px 15px;
            font-size: 11px;
        }

        .search-input {
            height: 42px;
            font-size: 14px;
        }
    }
