/* Royal Mobil - kategorija/brend listing, moderni sloj.
   Cilj: ista vizuelna jezik kao home-modern.css (.rm-product-card sistem),
   bez diranja stare category.css/theme.css - samo override + dopuna preko
   klasa koje vec postoje u markupu (category.php, categoryproducts.php).
   Stara pravila (.view-type-grid .category-product{flex:0 25%;...}) nemaju
   !important, pa .category-product.rm-product-card selektor (dve klase na
   istom elementu) ima dovoljno specificnosti da ih zameni bez sukoba. */

/* ===== Grid raspored (zamenjuje stare border-right/text-align/flex-baznu podelu) ===== */
.view-type-grid .products-group > .category-product.rm-product-card,
.category-product.rm-product-card {
    display: flex;
    flex: 0 0 25% !important;
    max-width: 25% !important;
    flex-direction: column;
    padding: 0 8px !important;
    margin-bottom: 16px !important;
    text-align: left !important;
    border-right: 0 !important;
}
.products-group {
    row-gap: 0;
}

/* ===== Kartica - identican sistem kao .rm-product-card sa pocetne stranice ===== */
.rm-product-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e5e8f0;
    border-radius: 14px;
    background: #fff;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.rm-product-card:hover {
    border-color: #ccd1dd;
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(10, 15, 45, .08);
}
.rm-product-card-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 14px;
    background: #fff;
}
/* Unutrasnji <a> ispunjava ceo prostor slike - lista zelja (dugme) je NAMERNO
   van njega kao sused u markupu (ne sme se ugnjezditi dugme unutar linka,
   nevazeci HTML), ali se i dalje vizuelno oslanja na position:relative sa
   spoljasnjeg .rm-product-card-image kontejnera. */
.rm-product-card-image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.rm-product-card-image .precolor {
    position: absolute;
    inset: 14px;
    z-index: 1;
    border-radius: 10px;
}
.rm-product-card-image img {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Popust bedz - desni gornji ugao. NOVO/PONOVO NA STANJU (rm-lifecycle-badges)
   vec zauzima levi gornji ugao (additional-info.css), nema sudara. */
.rm-discount-badge {
    position: absolute;
    z-index: 3;
    top: 12px;
    right: 12px;
    padding: 5px 8px;
    border-radius: 999px;
    color: #fff;
    background: #e51f45;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
}

/* Lista zelja - na slici, donji desni ugao (van reda sa cenom da se cena
   nikad ne skracuje). */
.rm-product-wish {
    position: absolute;
    z-index: 3;
    bottom: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e8f0;
    border-radius: 9px;
    background: #fff;
    color: #8992a8;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(10, 15, 45, .1);
    transition: color .15s ease, border-color .15s ease;
}
.rm-product-wish:hover,
.rm-product-wish.active {
    color: #e51f45;
    border-color: #f3c8d2;
}
.rm-product-wish i {
    font-size: 14px;
}

.rm-product-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 0 15px 15px;
}
.rm-product-stock {
    display: inline-flex;
    align-items: center;
    margin-bottom: 7px;
    color: #098b68;
    font-size: 11px;
    font-weight: 700;
}
.rm-product-stock i {
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #13b889;
}
.rm-product-stock--out {
    color: #8992a8;
}
.rm-product-stock--out i {
    background: #c2c8d6;
}
/* Naziv proizvoda - namerno BEZ skracivanja/elipse: model telefona (npr. "A55")
   je cesto na kraju naziva kod futrola/delova i ne sme se sakriti. Kartice u
   istom redu se automatski izjednacavaju po visini (flex red, align-items:stretch
   je podrazumevano). */
.rm-product-card h3 {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}
.rm-product-card h3 a {
    color: #131a31;
    text-decoration: none;
}
.rm-product-card h3 a:hover {
    color: #e51f45;
}
.rm-product-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f1f5;
}
/* Stara cena ide IZNAD nove (column-reverse - u markupu 'strong' je pre 'del')
   umesto pored nje - stedi vodoravni prostor pored dugmeta "Dodaj". Kartica na
   kategoriji je uza nego na pocetnoj (deli red sa filter sidebarom), zato ovde
   ide kraci price2() bez "sa PDV-om" (categoryproducts.php); flex-wrap iznad
   je dodatna zastita da dugme "Dodaj" padne u novi red umesto da se preklopi
   sa cenom ako bi neka buduca, izuzetno duga cena ipak ne stala u jedan red. */
.rm-product-price {
    display: flex;
    flex-direction: column-reverse;
    flex: 1 1 auto;
    gap: 0;
    min-width: 0;
}
.rm-product-price strong {
    font-size: 16px;
    font-weight: 700;
    color: #131a31;
    white-space: nowrap;
}
.rm-product-price del {
    font-size: 11px;
    color: #8992a8;
    white-space: nowrap;
}
.rm-product-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 13px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: #0a1235;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex: none;
    transition: background .15s ease;
}
.rm-product-add:hover {
    background: #e51f45;
}

/* ===== Traka: sortiranje / prikaz mreza-lista ===== */
.category-page .bg-gray-1 {
    background: #fff;
    border: 1px solid #e5e8f0;
    border-radius: 12px;
    padding: 8px 10px;
}
.category-page .nav-tab-shop .nav-link {
    border-radius: 8px;
    color: #657089;
}
.category-page .nav-tab-shop .nav-link.active {
    background: #0a1235;
    color: #fff;
}
.category-page #sortCategory,
.category-page #sortCategory2 {
    border-radius: 8px;
}

/* ===== Filteri - SVAKA grupa (Brend, Boja, ...) je SVOJA kartica =====
   .collection-filter-block je u markupu JEDAN omotac oko SVIH grupa zajedno -
   zato kartica ide na .collection-collapse-block (pojedinacna grupa), ne na
   .collection-filter-block (bio bi jedan veliki koviceg sa svim grupama
   unutra, ne odvojene kartice kao u dogovorenom predlogu). */
.category-page .collection-filter-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.category-page .collection-collapse-block {
    background: #fff;
    border: 1px solid #e5e8f0 !important;
    border-radius: 14px;
    padding: 16px 16px 14px;
    margin-bottom: 0 !important;
}
/* Stare Bootstrap utility klase (border-bottom/pb-4/mb-4) na promo/kategorije
   blokovima se ponistavaju gore preko !important da ne prave duplu liniju. */
.category-page .collection-filter-block > hr {
    display: none;
}
.category-page .collapse-block-title {
    font-size: 12.5px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #0a1235;
    margin-bottom: 10px !important;
}
.category-page .collection-filter-checkbox {
    padding: 7px 0;
    border-bottom: 1px solid #eef0f7;
}
.category-page .collection-filter-checkbox:last-child {
    border-bottom: 0;
}
.category-page .collection-filter-checkbox .custom-control-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #1a1f30;
}
.rm-filter-count {
    color: #8992a8;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

/* ===== Aktivni filteri - traka cipova iznad liste filtera ===== */
.rm-active-filters {
    background: #fff;
    border: 1px solid #e5e8f0;
    border-radius: 14px;
    padding: 16px 16px 14px;
}
.rm-filter-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.rm-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 11px;
    border: 1px solid #f3c8d2;
    border-radius: 999px;
    background: rgba(229, 31, 45, .08);
    color: #b81338;
    font-size: 11.5px;
    font-weight: 650;
    cursor: pointer;
}
.rm-filter-chip i {
    font-style: normal;
    font-size: 14px;
    line-height: 1;
}
.rm-filter-clear {
    display: inline-block;
    margin-top: 10px;
    color: #657089;
    font-size: 11.5px;
    text-decoration: underline;
}
.rm-filter-clear:hover {
    color: #e51f45;
}
.category-page .theme-card {
    background: #fff;
    border: 1px solid #e5e8f0;
    border-radius: 14px;
    padding: 16px !important;
}
.category-page .theme-card .title-border {
    font-size: 12.5px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #0a1235;
    border: 0 !important;
    padding: 0 !important;
    margin-bottom: 10px !important;
}

/* ===== Paginacija - brend boje umesto podrazumevane plave ===== */
.category-page .pagination .page-link {
    border-radius: 9px;
    margin: 0 3px;
    border: 1px solid #e5e8f0;
    color: #131a31;
}
.category-page .pagination .page-item.active .page-link {
    background: #0a1235;
    border-color: #0a1235;
    color: #fff;
}
.category-page .pagination .page-link:hover {
    border-color: #e51f45;
    color: #e51f45;
}
.category-page .product-pagination .page-link {
    border-radius: 9px;
}
.category-page .product-pagination .page-item.active .page-link {
    background: #0a1235;
    border-color: #0a1235;
}

/* ===== Naslov, kontrole i jedinstvena responsive paginacija ===== */
.rm-category-heading {
    gap: 16px;
}
.rm-category-count {
    flex: none;
    color: #657089;
}
.rm-category-description {
    max-width: 920px;
    margin: -4px 0 18px;
    color: #657089;
    font-size: 14px;
    line-height: 1.55;
}
.rm-category-mobile-controls {
    width: 100%;
    gap: 8px;
}
.rm-category-filter-button,
.rm-category-sort {
    min-height: 44px;
    border: 1px solid #dde2ec;
    border-radius: 10px;
    background: #fff;
    color: #0a1235;
    font-size: 13px;
    font-weight: 700;
}
.rm-category-filter-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 13px;
}
.rm-category-filter-button b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e51f45;
    color: #fff;
    font-size: 10px;
}
.rm-category-sort {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    padding: 8px 34px 8px 11px;
}
.rm-category-pagination-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
}
.rm-category-pagination-count {
    color: #657089;
    font-size: 13px;
}
.rm-category-pagination {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
}
.rm-category-pagination .page-link,
.rm-category-pagination .rm-page-ellipsis span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 6px 10px;
}
.rm-category-pagination .rm-page-ellipsis span {
    color: #8992a8;
}
.rm-category-pagination .disabled .page-link {
    color: #b5bccb;
    background: #f6f7fa;
    pointer-events: none;
}
.rm-mobile-filter-head,
.rm-category-filter-overlay {
    display: none;
}

@media (max-width: 1199px) {
    body.rm-category-filter-open {
        overflow: hidden;
    }
    .category-page #category-filters {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        display: block !important;
        width: min(360px, 88vw) !important;
        max-width: 360px !important;
        height: 100vh;
        height: 100dvh;
        padding: 0 14px 24px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        opacity: 1 !important;
        visibility: hidden !important;
        background: #f7f8fb !important;
        box-shadow: 18px 0 45px rgba(7, 18, 61, .18);
        transform: translate3d(-105%, 0, 0);
        transition: transform .24s ease, visibility .24s ease !important;
        z-index: 1105 !important;
        -webkit-overflow-scrolling: touch;
    }
    .category-page #category-filters.filters-shown {
        right: auto !important;
        visibility: visible !important;
        transform: translate3d(0, 0, 0);
    }
    .category-page #category-filters .collection-filter {
        min-height: 100%;
    }
    .rm-mobile-filter-head {
        position: sticky;
        top: 0;
        z-index: 5;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        margin: 0 -14px 14px;
        padding: max(14px, env(safe-area-inset-top)) 16px 14px;
        border-bottom: 1px solid #e4e7ef;
        background: rgba(255, 255, 255, .97);
    }
    .rm-mobile-filter-head div {
        display: flex;
        flex-direction: column;
    }
    .rm-mobile-filter-head small {
        color: #e51f45;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .09em;
        text-transform: uppercase;
    }
    .rm-mobile-filter-head strong {
        color: #0a1235;
        font-size: 18px;
    }
    .rm-mobile-filter-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        padding: 0;
        border: 1px solid #dde2ec;
        border-radius: 11px;
        background: #f7f8fb;
        color: #0a1235;
        font-size: 27px;
        line-height: 1;
    }
    .rm-category-filter-overlay {
        position: fixed;
        inset: 0;
        z-index: 1104;
        display: block !important;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        opacity: 0;
        visibility: hidden;
        background: rgba(5, 13, 45, .52);
        cursor: default;
        transition: opacity .24s ease, visibility .24s ease;
        pointer-events: none;
    }
    .rm-category-filter-overlay.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .rm-category-mobile-controls {
        display: flex !important;
    }
    .category-page .catmain {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 991px) {
    .category-product.rm-product-card {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    .rm-category-pagination-shell {
        align-items: flex-start;
        flex-direction: column;
    }
    .rm-category-pagination {
        align-self: center;
    }
}

@media (max-width: 575px) {
    .category-page > .bg-gray-13 .container,
    .category-page > .container {
        padding-right: 10px;
        padding-left: 10px;
    }
    .category-page .breadcrumb {
        margin-bottom: 10px !important;
        padding: 8px 0;
        font-size: 11.5px;
        white-space: nowrap;
    }
    .category-page .row.mb-8 {
        margin-right: -4px;
        margin-left: -4px;
        margin-bottom: 38px !important;
    }
    .category-page .catmain {
        padding-right: 4px;
        padding-left: 4px;
    }
    .subcategoryslider {
        height: 154px !important;
        margin: 0 -2px 8px !important;
        padding: 5px 0 30px !important;
    }
    .subcategoryslider .subcatitem {
        margin: 0 5px;
    }
    .subcategoryslider .catimage {
        height: 88px;
    }
    .subcategoryslider .catimage a,
    .subcategoryslider .catimage img {
        display: block;
        width: 100%;
        height: 100%;
    }
    .subcategoryslider .catimage img {
        object-fit: contain;
    }
    .subcategoryslider .catname {
        margin-top: 6px;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.2;
    }
    .subcategoryslider .catname a {
        color: #131a31;
    }
    .category-page .top-banner-content {
        margin-bottom: 15px !important;
        overflow: hidden;
        border-radius: 10px;
    }
    .category-page .top-banner-content br {
        display: none;
    }
    .rm-category-heading {
        display: block !important;
        margin-bottom: 10px !important;
    }
    .rm-category-heading h1 {
        margin-bottom: 3px !important;
        font-size: 23px !important;
        line-height: 1.18;
    }
    .rm-category-count {
        font-size: 12px !important;
    }
    .rm-category-description {
        margin: 0 0 13px;
        font-size: 13px;
        line-height: 1.45;
    }
    .category-page .rm-category-toolbar {
        margin-bottom: 4px;
        padding: 6px !important;
        border-radius: 11px;
    }
    .rm-category-mobile-controls {
        gap: 6px;
    }
    .rm-category-filter-button,
    .rm-category-sort {
        min-height: 43px;
        font-size: 12px;
    }
    .rm-category-filter-button {
        padding: 8px 11px;
    }
    .rm-category-sort {
        padding-left: 9px;
    }
    .category-page #pills-tabContent .tab-pane {
        padding-top: 8px !important;
    }
    .category-page .products-group {
        margin-right: -3px;
        margin-left: -3px;
    }
    .category-product.rm-product-card {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 3px !important;
        margin-bottom: 8px !important;
        border-radius: 11px;
    }
    .rm-product-card:hover {
        transform: none;
        box-shadow: none;
    }
    .rm-product-card-image {
        padding: 7px;
    }
    .rm-product-card-image .precolor {
        inset: 7px;
    }
    .rm-discount-badge {
        top: 7px;
        right: 7px;
        padding: 4px 6px;
        font-size: 8.5px;
    }
    .rm-product-wish {
        right: 7px;
        bottom: 7px;
        width: 29px;
        height: 29px;
        border-radius: 8px;
    }
    .rm-product-card-body {
        padding: 0 9px 9px;
    }
    .rm-product-stock {
        margin-bottom: 5px;
        font-size: 10px;
    }
    .rm-product-card h3 {
        margin-bottom: 10px;
        font-size: 12.5px;
        line-height: 1.32;
    }
    .rm-product-card-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
        padding-top: 8px;
    }
    .rm-product-price strong {
        font-size: 14px;
    }
    .rm-product-price del {
        font-size: 10px;
    }
    .rm-product-add {
        width: 100%;
        min-height: 35px;
        padding: 7px 8px;
        border-radius: 8px;
        font-size: 11px;
    }
    .rm-category-pagination-shell {
        gap: 10px;
        margin-top: 8px;
        padding-top: 12px !important;
    }
    .rm-category-pagination-count {
        width: 100%;
        text-align: center;
        font-size: 11.5px;
    }
    .rm-category-pagination .page-link,
    .rm-category-pagination .rm-page-ellipsis span {
        min-width: 38px;
        height: 38px;
        margin: 0 2px;
        padding: 5px 8px;
        border-radius: 9px;
        font-size: 13px;
    }
}

@media (max-width: 419px) {
    .rm-category-pagination .rm-page-boundary,
    .rm-category-pagination .rm-page-ellipsis {
        display: none;
    }
}

@media (max-width: 340px) {
    .category-product.rm-product-card {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }
}
