/* CSS Reset & Overrides */
:root { --wws-blue: #005da3; --wws-text: #333; --wws-gray: #f4f4f4; --wws-border: #e6e6e6; }

html, body { height: 100%; overflow: hidden; margin: 0; padding: 0; font-family: "Open Sans", Helvetica, Arial, sans-serif; color: var(--wws-text); }
.c4q_layout { display: flex; height: 100vh; width: 100%; max-width: 100%; background: #fff; }

/* Sidebar */
.c4q_sidebar { width: 320px; flex-shrink: 0; height: 100%; overflow-y: auto; padding: 20px 25px 40px 20px; border-right: 1px solid var(--wws-border); box-sizing: border-box; background: #fff; overscroll-behavior: contain; }

/* Content */
.c4q_content { flex: 1; height: 100%; overflow-y: auto; overflow-x: hidden; padding: 20px 30px; box-sizing: border-box; background: #fdfdfd; }

.c4q_sidebar::-webkit-scrollbar, .c4q_content::-webkit-scrollbar { width: 6px; }
.c4q_sidebar::-webkit-scrollbar-track, .c4q_content::-webkit-scrollbar-track { background: #f1f1f1; }
.c4q_sidebar::-webkit-scrollbar-thumb, .c4q_content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* Filters */
.c4q_filter_group { border-bottom: 1px solid var(--wws-border); padding-bottom: 25px; margin-bottom: 25px; }
.c4q_filter_title { font-size: 0.95rem; font-weight: 700; text-transform: uppercase; margin-bottom: 15px; color: #000; letter-spacing: 0.5px; }
.c4q_filter_input { width: 100%; box-sizing: border-box; padding: 10px; margin-bottom: 15px; border: 1px solid #ddd; font-size: 0.9rem; border-radius: 4px; }

/* Price inputs */
.c4q_price_inputs { display: flex; gap: 10px; align-items: center; }
.c4q_price_inputs input { width: 50%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; }

/* Tree */
.c4q_tree_ul { list-style: none; padding: 0; margin: 0; }
.level-1 { padding-left: 20px; } .level-2 { padding-left: 20px; } .level-3 { padding-left: 20px; }
.c4q_tree_link { display: flex; justify-content: space-between; align-items: center; padding: 12px 5px; cursor: pointer; color: #555; font-size: 0.95rem; border-bottom: 1px solid #f9f9f9; user-select: none; }
.c4q_tree_link:hover { color: var(--wws-blue); background-color: #fcfcfc; }
.c4q_tree_link.active > .c4q_link_text { color: var(--wws-blue); font-weight: 700; }
.c4q_count { font-size: 0.8em; color: #aaa; font-weight: normal; margin-left: 5px; }
.c4q_chevron { font-size: 0.7rem; color: #999; transition: transform 0.3s; margin-left: 15px; padding: 5px; }
.c4q_tree_link.open .c4q_chevron { transform: rotate(180deg); }
.c4q_submenu_wrapper { display: none; overflow: hidden; }
.c4q_submenu_wrapper.open { display: block; }

/* Lists */
.c4q_filter_list { list-style: none; padding: 0; margin: 0; max-height: 250px; overflow-y: auto; }
.c4q_filter_item { margin-bottom: 4px; padding: 8px 5px; font-size: 0.95rem; color: #555; cursor: pointer; display: flex; align-items: center; border-radius: 4px; transition: background 0.1s; }
.c4q_filter_item:hover { color: var(--wws-blue); background: #f9f9f9; }
.c4q_filter_item.hidden, .c4q_filter_item.search-hidden { display: none; }
.c4q_checkbox { width: 18px; height: 18px; border: 1px solid #ccc; border-radius: 3px; margin-right: 12px; display: inline-block; position: relative; flex-shrink: 0; background:#fff; }
.c4q_filter_item.checked .c4q_checkbox { background: var(--wws-blue); border-color: var(--wws-blue); }
.c4q_filter_item.checked .c4q_checkbox::after { content: '✓'; color: #fff; font-size: 14px; position: absolute; top: -2px; left: 3px; }

/* Grid Styles - Override !important */
.ps_main_grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; gap: 15px !important; padding-bottom: 40px; }
.ps_product { width: auto !important; margin: 0 !important; background: #fff; display: flex; flex-direction: column; position: relative; border: 1px solid transparent !important; transition: box-shadow 0.2s; border-radius: 4px; padding-bottom: 10px; overflow: hidden; box-shadow: none !important; }
.ps_product:hover { box-shadow: 0 5px 15px rgba(0,0,0,0.1) !important; border-color: #eee !important; }
.ps_product.hidden-logic, .ps_product.hidden-page { display: none !important; }
.ps_product_image_block { height: 180px !important; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; cursor: pointer; position: relative; padding: 10px; background: #fff; border: none !important; box-shadow: none !important; }
.ps_product_image { max-width: 100% !important; max-height: 100% !important; width: auto !important; height: auto !important; object-fit: contain; transition: transform 0.3s; border: none !important; box-shadow: none !important; }
.ps_product:hover .ps_product_image { transform: scale(1.05); }

.c4q_card_body { flex: 1; display: flex; flex-direction: column; padding: 0 10px; }
.c4q_brand_name { font-size: 0.75rem; text-transform: uppercase; color: #999; letter-spacing: 1px; margin-bottom: 5px; font-weight: 600; }
.ps_product_label { font-size: 0.95rem; font-weight: 600; color: #333; margin: 0 0 5px 0; cursor: pointer; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; height: 2.6em; }
.ps_product:hover .ps_product_label { color: var(--wws-blue); }
.c4q_stars { color: #f4b400; font-size: 0.75rem; margin-bottom: 5px; }
.c4q_stock_info { font-size: 0.75rem; color: #777; margin-bottom: 10px; display: flex; align-items: center; }

.c4q_price_row { margin-top: auto; margin-bottom: 15px; }
.c4q_price { font-size: 1.2rem; font-weight: 700; color: #000; }

/* FIX: Promenjeno ime klase u c4q_btn_add da izbegnemo konflikt sa starim JS */
.c4q_btn_add { width: 100%; background: #fff; color: var(--wws-blue); border: 1px solid var(--wws-blue); padding: 8px; text-transform: uppercase; font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; border-radius: 4px;}
.c4q_btn_add:hover { background: var(--wws-blue); color: #fff; }

.c4q_qty { width: 40px; padding: 5px; text-align: center; border: 1px solid #ccc; margin-right: 5px; display: none; border-radius: 4px; }
.ps_product:hover .c4q_qty { display: inline-block; }

/* Toolbar */
.c4q_toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 20px; padding: 12px 15px; background: #f8f9fa; border: 1px solid #eee; border-radius: 6px; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.c4q_tb_left { display: flex; gap: 15px; align-items: center; flex: 1; }
.c4q_tb_right { display: flex; gap: 15px; align-items: center; }
.c4q_control { padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; color: #444; }
.c4q_pagination { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: #555; }
.c4q_btn_page { padding: 6px 12px; border: 1px solid #ccc; background: #fff; border-radius: 4px; cursor: pointer; color: #555; }
.c4q_btn_page:hover:not(:disabled) { background: #eee; color: var(--wws-blue); border-color: #bbb; }
.c4q_btn_page:disabled { opacity: 0.5; cursor: default; background: #f0f0f0; }
.c4q_page_input { width: 40px; text-align: center; padding: 6px; border: 1px solid #ccc; border-radius: 4px; }
.c4q_result_info { font-size: 0.85rem; color: #777; white-space: nowrap; }

.c4q_stock_toggle_label { font-size: 0.85rem; color: #444; display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; margin-left: 10px; }

.c4q_mobile_toggle { display: none; }
@media (max-width: 900px) {
    html, body { overflow: auto; }
    .c4q_layout { display: block; height: auto; padding: 10px; }
    .c4q_content, .c4q_sidebar { height: auto; overflow: visible; padding: 0; border: none; width: 100%;}
    .c4q_sidebar { position: fixed; top: 0; left: -100%; width: 300px; height: 100vh; background: #fff; z-index: 1000; padding: 30px 20px 50px 20px; transition: 0.3s; overflow-y: auto; box-shadow: 2px 0 10px rgba(0,0,0,0.2); }
    .c4q_sidebar.open { left: 0; }
    .c4q_mobile_toggle { display: block; width: 100%; padding: 12px; margin-bottom: 15px; background: var(--wws-blue); color: #fff; border:none; text-transform:uppercase; font-weight:bold; border-radius: 4px;}
    .ps_main_grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .c4q_toolbar { position: static; flex-direction: column; align-items: stretch; }
    .c4q_tb_left, .c4q_tb_right { flex-direction: column; width: 100%; }
    .c4q_draft_selector { width: 100%; } .c4q_control { width: 100%; max-width: none; }
    .c4q_pagination { justify-content: space-between; width: 100%; }
}

/* MODAL LAYOUT */
.c4q_modal_overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; justify-content: center; align-items: center; }
.c4q_modal_content { 
    background: #fff; width: 95%; max-width: 1100px; 
    padding: 0; border-radius: 8px; position:relative; max-height: 90vh; overflow-y: auto; 
    display: flex; flex-direction: column; overflow-x: hidden;
}
.c4q_modal_close { 
    position:absolute; right:15px; top:10px; font-size:2rem; cursor:pointer; background:none; border:none; z-index: 10; color: #555;
}

.c4q_modal_body {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

/* LEFT SIDE (VISUALS & ACTIONS) */
.c4q_modal_col_left {
    flex: 0 0 380px;
    border-right: 1px solid #eee;
    padding: 40px 30px;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.c4q_modal_brand { 
    font-size: 0.9rem; font-weight: 800; color: #999; 
    text-transform: uppercase; letter-spacing: 2px; margin-bottom: 10px; 
}
.c4q_modal_img_wrap {
    width: 100%; height: 320px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; margin-bottom: 25px;
}
.c4q_modal_img { max-width: 100%; max-height: 100%; object-fit: contain; }

.c4q_modal_title { font-size: 1.4rem; color: #222; margin: 0 0 5px 0; line-height: 1.3; }
.c4q_modal_ref { color: #777; font-family: monospace; font-size: 0.95rem; margin-bottom: 15px; }

.c4q_modal_price_box {
    margin-top: auto; width: 100%; border-top: 1px solid #eee; padding-top: 20px;
}
.c4q_modal_price { font-size: 2.2rem; font-weight: 700; color: var(--wws-blue); margin-bottom: 5px; }
.c4q_modal_tax_label { font-size: 0.8rem; color: #999; margin-bottom: 15px; }

.c4q_modal_actions { display: flex; gap: 10px; justify-content: center; width: 100%; }
.c4q_modal_actions input { width: 70px; text-align: center; font-size: 1.2rem; border: 1px solid #ccc; border-radius: 4px; }
.c4q_modal_actions button { flex: 1; padding: 12px; font-size: 1rem; border-radius: 4px; }

/* RIGHT SIDE (DETAILS) */
.c4q_modal_col_right {
    flex: 1;
    padding: 40px;
    background: #fff;
}

.c4q_section_title { 
    font-size: 0.95rem; border-bottom: 2px solid #f0f0f0; padding-bottom: 8px; margin-bottom: 15px; margin-top: 10px;
    color: #333; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}

/* Info Grid */
.c4q_info_grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px;
}
.c4q_info_item { display: flex; flex-direction: column; }
.c4q_info_label { font-size: 0.75rem; color: #999; text-transform: uppercase; margin-bottom: 3px; }
.c4q_info_val { font-size: 0.95rem; font-weight: 600; color: #333; }

.c4q_desc_box { font-size: 0.95rem; line-height: 1.6; color: #555; margin-bottom: 25px; }
.c4q_specs_box { font-size: 0.9rem; color: #444; background: #f9f9f9; padding: 15px; border-radius: 6px; border: 1px solid #eee; margin-bottom: 25px; }

/* Tags / Badges */
.c4q_tag_cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.c4q_tag { 
    background: #f0f4f8; color: #4a5568; 
    padding: 5px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 600;
    border: 1px solid #e2e8f0;
}
.c4q_tag_sys { background: #ebf8ff; color: #2b6cb0; border-color: #bee3f8; }

/* Mobile */
@media (max-width: 900px) {
    .c4q_modal_body { flex-direction: column; }
    .c4q_modal_col_left { flex: auto; width: 100%; border-right: none; border-bottom: 1px solid #eee; padding: 20px; }
    .c4q_modal_col_right { padding: 20px; }
    .c4q_info_grid { grid-template-columns: 1fr; gap: 10px; }
}