/* =============================================================
   === FINALNI SREĐENI CSS ZA KATALOG I PROIZVODE (iLearn) ===
   ============================================================= */
body, .super_container, .main_content {
    font-family: 'Poppins', sans-serif !important;
}

/* Glavni kontejneri - Uklonjene sve margine da bude poravnato sa headerom! */
.super_container { 
    width: 100%; 
    overflow: hidden; 
    background-color: #ffffff; 
}
/* Podešavanje širine da bude u ravnini sa headerom (od logoa do korpe) */
.product_section_container {
    max-width: 1220px !important; /* Tačna širina Vašeg headera */
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-top: 0 !important; 
    padding-top: 0 !important; 
    padding-bottom: 60px; 
}

/* =============================================================
   === BOOTSTRAP KOLONE I SIDEBAR ===
   ============================================================= */
.col-lg-2 { flex: 0 0 15% !important; max-width: 15% !important; }
.col-lg-10 { flex: 0 0 85% !important; max-width: 85% !important; }

.sidebar { background: #ffffff; padding-right: 15px; }
.sidebar_section { margin-bottom: 25px; }
.sidebar_title h5 { font-size: 15px; font-weight: 700; color: #1e1e1e; text-transform: uppercase; margin-bottom: 12px; border-bottom: 2px solid #e5e5e5; padding-bottom: 6px; }
.sidebar_categories { list-style: none; padding: 0; margin: 0; }
/* Sabijanje razmaka i visine redova u sidebaru sa oblastima */
.sidebar_categories li {
    margin-bottom: 8px !important;
    line-height: normal !important;
}

.sidebar_categories li a {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    line-height: 1.3 !important;
}
.sidebar_categories li a:hover, .sidebar_categories li.active > a { color: #fe4c50; font-weight: 600; }

/* Sabijanje razmaka unutar podoblasti */
.subcategories_list {
    margin-top: 4px !important;
    margin-bottom: 10px !important;
    padding-left: 12px !important;
}

.subcategories_list li {
    margin-bottom: 5px !important;
}

.subcategories_list li a {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    line-height: 1.25 !important;
}
.subcategories_list li a:hover { color: #fe4c50; }

.checkboxes { list-style: none; padding: 0; margin: 0; }
.checkboxes li { font-size: 13px; color: #51545f; margin-bottom: 6px; cursor: pointer; }
.checkboxes li span:hover { color: #fe4c50; }

/* =============================================================
   === GLAVNI SADRŽAJ I NOVO SORTIRANJE ===
   ============================================================= */
.main_content { width: 100% !important; float: none !important; }
.products_iso { width: 100% !important; }

/* Čist i elegantan kontejner za sortiranje bez kutije */
.product_sorting_header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: transparent; 
    padding: 0 0 15px 0; 
    border-bottom: 1px solid #eaeaea; 
    margin-bottom: 25px; 
}

/* Ukupan broj izdanja (leva strana) */
.total-products-count {
    font-size: 14px;
    color: #777;
    font-weight: 500;
}
.total-products-count span {
    font-weight: 700;
    color: #333;
}

/* Dropdown za sortiranje (desna strana) */
.sort-dropdown-container {
    display: flex;
    align-items: center;
}
.elegant-sort-select { 
    width: 170px !important; 
    display: inline-block !important; 
    height: 38px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    padding: 0 10px; 
    font-size: 13.5px;
    color: #444;
    background-color: #fcfcfc;
    cursor: pointer;
    transition: all 0.2s ease;
}
.elegant-sort-select:hover, .elegant-sort-select:focus {
    border-color: #bbb;
    outline: none;
    box-shadow: none;
}


/* Grid za proizvode - Tačno 4 kolone */
.product-grid { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 20px !important; margin-bottom: 40px; width: 100% !important; }

/* =============================================================
   === KARTICA PROIZVODA ===
   ============================================================= */
.product-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 8px; 
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Ne dozvoljavamo vještačko guranje prostora */
    height: 100%;
    position: relative;
    overflow: hidden;
    width: 100% !important;
    max-width: 100% !important;
    transition: box-shadow 0.3s ease;
}
.product-item:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.12); }

/* Okvir slike - Bez sivih ivica, savršen kvadrat (1:1), contain zadržava srazmeru knjige */
.product_image {
    position: relative;
    text-align: center;
    width: 100%;
    aspect-ratio: 1 / 1; 
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: transparent; 
    border-radius: 2px;
    overflow: hidden;
    margin: 0 0 10px 0;
    padding: 0; 
}
.product_image img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; /* Prikazuje cijelu knjigu bez sječenja */
}

/* Stikeri tačno na samoj ivici slike (NOVO je mint zelena boja #00b894) */
.stiker-novo { position: absolute; top: 0; left: 0; z-index: 3; background: #10B981; color: #fff; font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 0 0 4px 0; letter-spacing: 0.3px; }
.stiker-popust { position: absolute; top: 0; right: 0; z-index: 3; background: #FE4C50; color: #fff; font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 0 0 0 4px; letter-spacing: 0.3px; }
.stiker-pretplata { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 3; background: #3B82F6; color: #fff; font-size: 9px; font-weight: 700; padding: 4px 6px; border-radius: 0 0 4px 4px; }

/* Pečat rasprodato */
.rasprodato-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 3; display: flex; align-items: center; justify-content: center; pointer-events: none; background: rgba(255,255,255,0.6); }
.rasprodato-tekst-pecat { color: #7a7a7a; font-size: 13px; font-weight: 700; text-transform: uppercase; padding: 4px 10px; border: 2px solid #7a7a7a; transform: rotate(-15deg); background-color: rgba(255, 255, 255, 0.95); }
.slika-rasprodato { filter: grayscale(100%); opacity: 0.7; }

/* Područje sa nazivom i cenom */
.product-info-area { 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; /* Fiksira sadržaj ispod slike bez rupetine */
    flex-grow: 1; 
    padding: 0 4px 12px 4px; 
}

/* Fiksirana visina naslova - garantuje 3 reda teksta */
.product_name { 
    margin: 4px 0 6px 0; 
    text-align: center; 
    height: 52px; 
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.product_name a { 
    font-size: 13px; 
    font-weight: 600; 
    line-height: 1.35; 
    color: #1e1e1e; 
    text-decoration: none; 
    display: -webkit-box; 
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

/* Cijene i popusti */
.price-container { 
    text-align: center; 
    margin-top: 0; 
}
.product_price { font-size: 15px; font-weight: 700; color: #fe4c50; margin-bottom: 2px; }
.old-price { font-size: 12px; color: #999; text-decoration: line-through; margin-left: 5px; font-weight: 400; }
.najniza-cena { font-size: 10.5px; color: #555; margin-top: 0; font-weight: 600; letter-spacing: -0.4px; white-space: nowrap; overflow: visible; }

/* Rollover dugme za korpu (iskace iz dna na prelazu misem) */
.red_button.add_to_cart_button_dodajukorpu, .btn-rasprodato {
    position: absolute;
    bottom: -50px;
    left: 0;
    width: 100%;
    background: #ff5252 !important;
    color: #fff !important;
    border: none !important;
    text-align: center;
    padding: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border-radius: 0 0 4px 4px;
    transition: bottom 0.25s ease-in-out;
    z-index: 10;
    text-transform: uppercase;
}
.product-item:hover .red_button.add_to_cart_button_dodajukorpu,
.product-item:hover .btn-rasprodato {
    bottom: 0;
}
.btn-rasprodato {
    background: #d1d1d1 !important;
    cursor: not-allowed !important;
}

/* =============================================================
   === Dugme Učitaj još i Responzivnost ===
   ============================================================= */
.il-btn-load-more {
    background: #f8f9fa !important;
    color: #333333 !important;
    border: 1px solid #e5e5e5 !important;
    padding: 12px 40px !important;
    border-radius: 4px !important; /* Blagi, klasični kutevi */
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
}

.il-btn-load-more:hover {
    background: #ffffff !important;
    color: #fe4c50 !important;
    border-color: #fe4c50 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
}

@media (max-width: 1200px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
@media (max-width: 992px) { 
    .col-lg-2 { display: none !important; } 
    .col-lg-10 { flex: 0 0 100% !important; max-width: 100% !important; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } 
}
@media (max-width: 576px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Stil za linkove u sidebaru sa blago povećanim fontom */
.il-subcat-link {
    font-size: 12.5px !important; /* Povećano za nijansu za optimalnu čitljivost */
    color: #555 !important;
    font-weight: 400 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    transition: all 0.15s ease !important;
}

/* Ikonica knjige ispred svake stavke */
.il-subcat-link i.fa-book {
    font-size: 11px !important;
    opacity: 0.5 !important;
    color: inherit !important;
    transition: opacity 0.15s ease !important;
}

/* Hover efekat */
.il-subcat-link:hover {
    color: #fe4c50 !important;
    transform: translateX(3px) !important;
}

.il-subcat-link:hover i.fa-book {
    opacity: 1 !important;
    color: #fe4c50 !important;
}

/* Aktivna/izabrana stavka */
.il-subcat-link.active-subcat {
    color: #fe4c50 !important;
    font-weight: 700 !important;
}

.il-subcat-link.active-subcat i.fa-book {
    opacity: 1 !important;
    color: #fe4c50 !important;
}

/* Stil za iLearn SVG logo u sidebaru */
.il-subcat-svg {
    width: 15px !important;
    height: 15px !important;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0 !important; /* OVO JE KLJUČNO - Sprečava smanjivanje ikonice */
    transition: all 0.15s ease !important;
}

/* Inicijalno sivo stanje dok nije izabran ili hoverovan */
.il-subcat-link:not(:hover):not(.active-subcat) .il-subcat-svg .cls-1 {
    fill: #777 !important;
    stroke: #fff !important;
    stroke-width: 2.5px !important;
}

.il-subcat-link:not(:hover):not(.active-subcat) .il-subcat-svg {
    opacity: 0.7;
}

/* Kada je hover ili aktivan - prelazi u crvenu boju (#fe4c50) u harmoniji sa tekstom */
.il-subcat-link:hover .il-subcat-svg .cls-1,
.il-subcat-link.active-subcat .il-subcat-svg .cls-1 {
    fill: #fe4c50 !important;
    stroke: #fff !important;
    stroke-width: 2px !important;
}

.il-subcat-link:hover .il-subcat-svg,
.il-subcat-link.active-subcat .il-subcat-svg {
    opacity: 1;
}

/* =============================================================
   === MOBILNA NAVIGACIJA (OBLASTI I FILTERI DUGMAD) ===
   ============================================================= */
.mobile-filters-container {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
}

.mobile-filter-btn {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    padding: 12px 0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.mobile-filter-btn:focus, .mobile-filter-btn:active {
    outline: none;
    background: #f8f9fa;
}

/* =============================================================
   === SIDE DRAWERS (FIOKE ZA MOBILNE) ===
   ============================================================= */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    z-index: 999998 !important; /* Ekstremno visok z-index */
    display: none;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    max-width: 85%;
    height: 100vh;
    background: #ffffff;
    z-index: 999999 !important; /* Ekstremno visok z-index da ide preko svega! */
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 25px rgba(0,0,0,0.25);
}

.mobile-drawer.open {
    left: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.drawer-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.close-drawer {
    cursor: pointer;
    font-size: 20px;
    color: #999;
}

.drawer-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    
    /* Sakrivanje scrollbara za Firefox */
    scrollbar-width: none; 
    /* Sakrivanje scrollbara za starije IE/Edge */
    -ms-overflow-style: none; 
}

/* Sakrivanje scrollbara za Chrome, Safari i noviji Edge */
.drawer-content::-webkit-scrollbar {
    display: none;
}

/* Na desktopu sakrivamo mobilnu dugmad */
@media (min-width: 993px) {
    .d-lg-none {
        display: none !important;
    }
}

/* Na mobilnom podešavamo header za sortiranje i UKLANJAMO sav prazan prostor */
@media (max-width: 992px) {
    /* Kontejner za padajući izbornik i broj izdanja */
    .product_sorting_header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px !important;
        margin-bottom: 5px !important; /* Drastično smanjeno s 25px na samo 5px */
        padding-bottom: 10px !important;
    }
    
    .sort-dropdown-container {
        width: 100%;
    }
    
    .elegant-sort-select {
        width: 100% !important;
    }

    /* Osiguravamo da grid proizvoda nema skrivene praznine iznad */
    .product-grid {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Poništavamo naslijeđene margine kontejnera iz stare teme */
    .products_iso {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Smanjujemo razmak ispod dugmadi Oblasti i Filteri */
    .mobile-filters-container {
        margin-bottom: 15px !important;
    }
}
/* =============================================================
   ULTIMATIVNO ČIŠĆENJE PRAZNOG PROSTORA IZNAD KNJIGA
   ============================================================= */

/* Prisilno gaženje starih margina iz Bootstrap teme za sve ekrane */
#product-grid, 
.product-grid,
.products_iso {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

@media (max-width: 992px) {
    /* Dodatno zatezanje headera na mobilnom */
    .product_sorting_header {
        margin-bottom: 10px !important;
        padding-bottom: 10px !important;
    }
    
    /* Za svaki slučaj ubijamo gornju marginu i na samoj kartici proizvoda ako postoji */
    .product-item {
        margin-top: 0 !important;
    }
}

/* ==========================================================================
   SAVRŠEN DVOSMERNI KLIZAČ NA JEDNOJ LINIJI
   ========================================================================== */
.range-slider-container {
    position: relative;
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
}

.range-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    z-index: 1;
}

.range-input {
    position: absolute;
    width: 100%;
    height: 6px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
}

/* Onemogućavamo podrazumevanu pozadinu linije kod inputa da se ne bi duplirale */
.range-input::-webkit-slider-runnable-track {
    background: none;
    border: none;
}

.range-input::-moz-range-track {
    background: none;
    border: none;
}

/* Stilizovanje paljenja/kružića za Webkit (Chrome, Safari, Edge) */
.range-input::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #FE4C50;
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid #ffffff;
    transition: transform 0.15s ease;
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Stilizovanje paljenja/kružića za Firefox */
.range-input::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #FE4C50;
    pointer-events: auto;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sidebar_section a[href*="reset_filters"]:hover {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
}

/* ==========================================================================
   FIKS ZA MOBILNI PRIKAZ: TAČNO 2 KNJIGE U REDU NA SVIM TELEFONIMA
   ========================================================================== */
@media (max-width: 767px) {
    #product-grid,
    .product-grid,
    .products_iso .product-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        height: auto !important;
        width: 100% !important;
    }

    .product-grid .product-item,
    .product-item {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 6px !important;
        float: none !important;
        box-sizing: border-box !important;
    }

    /* Blago prilagođavanje teksta da 2 kartice stanu savršeno */
    .product_name {
        height: 46px !important;
        margin: 2px 0 4px 0 !important;
    }

    .product_name a {
        font-size: 11.5px !important;
        line-height: 1.3 !important;
    }

    .product_price {
        font-size: 13.5px !important;
    }

    .old-price {
        font-size: 11px !important;
        display: inline-block;
    }

    .najniza-cena {
        white-space: normal !important;
        line-height: 1.2 !important;
        font-size: 9.5px !important;
        letter-spacing: -0.2px !important;
    }
}