/* Hide VirtueMart debug messages but keep important alerts */
#system-message-container .alert-info:has(.vmdebug),
.vmdebug {
    display: none !important;
}

/* Hide noscript debug content */
noscript .vmdebug {
    display: none !important;
}

/* ========================================
   VirtueMart Toolbar - Hide Unwanted Buttons
   ======================================== */

/* Hide by task attribute */
joomla-toolbar-button[task="massxref_cats"],
joomla-toolbar-button[task="massxref_sgrps"],
joomla-toolbar-button[task="createchild"],
joomla-toolbar-button[task="cloneproductwithchildren"],
joomla-toolbar-button[task="addrating"] {
    display: none !important;
}

/* ========================================
   VirtueMart Side Menu - Hide Tools Section
   Tools is the 5th/last menu section
   ======================================== */

/* Hide the last uk-parent in both menus (Tools section) */
.vmuikit-menu .uk-nav.uk-nav-default > li.uk-parent:nth-child(5) {
    display: none !important;
}

/* ========================================
   Toolbar Layout Improvements
   ======================================== */

.toolbar-box {
    margin-bottom: 15px !important;
}

#toolbar {
    flex-wrap: wrap !important;
    gap: 5px !important;
}

/* ========================================
   My Account Page - Hide Admin Interface Button
   ======================================== */

/* Hide "Access Administration Interface" button */
a[title="Access Administration Interface"] {
    display: none !important;
}

/* ========================================
   Category Grid - Homepage Styling
   ======================================== */

/* Category tile container */
.category-view .row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

/* Individual category tile */
.category-view .category {
    flex: 0 0 calc(24% - 6px);
    max-width: calc(24% - 6px);
    box-sizing: border-box;
}

.category-view .category .spacer {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    height: 205px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.category-view .category .spacer:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Category title */
.category-view .category h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    line-height: 1.3;
    text-align: center;
}

/* Category title with product count */
.category-view .category .category-title-line {
    display: inline;
    white-space: nowrap;
}

.category-view .category .category-product-count {
    font-weight: 400;
    color: #666;
    margin-left: 3px;
}

.category-view .category h2 a {
    color: #333;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Category icon/image */
.category-view .category .browseCategoryImage {
    width: 130px !important;
    height: 130px !important;
    object-fit: contain;
}

/* Remove the br between title and image, reorder with flexbox */
.category-view .category h2 a br {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .category-view .category {
        flex: 0 0 calc(33.333% - 10px);
        max-width: calc(33.333% - 10px);
    }
}

@media (max-width: 768px) {
    .category-view .category {
        flex: 0 0 calc(50% - 8px);
        max-width: calc(50% - 8px);
    }
    .category-view .category .spacer {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .category-view .category {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ========================================
   Product list (front market) — compact images + counter fix
   ======================================== */

/* Shrink product-list images to match the compact category icons */
.vm-product-grid .browseProductImage {
    width: 150px !important;
    height: 150px !important;
    object-fit: contain;
    margin: 0 auto;
}

/* Keep the "Results 1-6 of 6" counter on one line (it sits in a narrow column) */
.display-number {
    white-space: nowrap;
}

/* Product grid columns — match the 4/3/2/1 category grid layout */
.vm-product-grid .product { flex: 0 0 25% !important; max-width: 25% !important; }
@media (max-width: 992px) { .vm-product-grid .product { flex: 0 0 33.333% !important; max-width: 33.333% !important; } }
@media (max-width: 768px) { .vm-product-grid .product { flex: 0 0 50% !important; max-width: 50% !important; } }
@media (max-width: 480px) { .vm-product-grid .product { flex: 0 0 100% !important; max-width: 100% !important; } }

/* ========================================
   Product Edit Form - Hide Unnecessary Fields
   ======================================== */

/* Hide Product SKU field */
.uk-clearfix:has(#product_sku) {
    display: none !important;
}

/* Hide Manufacturer field */
.uk-clearfix:has(#virtuemart_manufacturer_id) {
    display: none !important;
}

/* Hide On Featured checkbox */
.uk-clearfix:has(#product_special) {
    display: none !important;
}

/* Hide Discontinued checkbox */
.uk-clearfix:has(#product_discontinued) {
    display: none !important;
}

/* Hide GTIN (EAN, ISBN) field */
.uk-clearfix:has(#product_gtin) {
    display: none !important;
}

/* Hide Product Details Page layout dropdown */
.uk-clearfix:has(#layout) {
    display: none !important;
}

/* Hide Shopper Group field */
.uk-clearfix:has(select[name="virtuemart_shoppergroup_id[]"]) {
    display: none !important;
}

/* Hide Product Alias (slug) field */
.uk-clearfix:has(#slug) {
    display: none !important;
}

/* Hide MPN field */
.uk-clearfix:has(#product_mpn) {
    display: none !important;
}

/* Hide URL field */
.uk-clearfix:has(#product_url) {
    display: none !important;
}

/* Hide Child Products section (Product Parent ID field) */
.uk-clearfix:has(#product_parent_id) {
    display: none !important;
}

/* Hide the entire Child Product accordion/section if it exists */
li:has(a[href="#tabProductParent"]),
#tabProductParent {
    display: none !important;
}

/* Hide Force canonical category */
.uk-clearfix:has(#product_canon_category_id) {
    display: none !important;
}

/* Widen Categories selector */
#categories,
#categories + .chosen-container,
.uk-clearfix:has(#categories) .uk-form-controls,
select[name="categories[]"],
select[name="categories[]"] + .chosen-container {
    width: 100% !important;
    min-width: 300px !important;
}

/* ========================================
   Meta Information Section - Hide Entire Card
   ======================================== */

/* Hide the entire Meta Information card (has code icon) */
.uk-card:has([uk-icon*="icon: code"]) {
    display: none !important;
}

/* ========================================
   Product Status Section - Hide Most Fields
   ======================================== */

/* Hide In Stock */
.uk-clearfix:has(#product_in_stock) {
    display: none !important;
}

/* Hide Low Stock Notification */
.uk-clearfix:has(#low_stock_notification) {
    display: none !important;
}

/* Hide Out of Stock action dropdown */
.uk-clearfix:has(#product_stockhandle) {
    display: none !important;
}

/* Hide Availability text/image fields */
.uk-clearfix:has(#product_availability) {
    display: none !important;
}

/* Hide Booked/ordered */
.uk-clearfix:has(#product_ordered) {
    display: none !important;
}

/* Hide Purchase Quantity Steps */
.uk-clearfix:has(#step_order_level) {
    display: none !important;
}

/* Hide Minimum Purchase Quantity */
.uk-clearfix:has(#min_order_level) {
    display: none !important;
}

/* Hide Maximum Purchase Quantity */
.uk-clearfix:has(#max_order_level) {
    display: none !important;
}

/* ========================================
   Child Product Section - Hide Entire Card
   ======================================== */

/* Hide the entire Child Product card (has tree icon) */
.uk-card:has([uk-icon*="tree"]) {
    display: none !important;
}

/* ========================================
   Email to Shoppers Section - Hide Entire Card
   ======================================== */

/* Hide the entire Email to Shoppers card (has mail icon) */
.uk-card:has([uk-icon*="mail"]) {
    display: none !important;
}

/* ========================================
   Pricing Section - Simplify for Yardsale
   Keep only: Cost price input and Final price input
   ======================================== */

/* Hide Shopper Group column in pricing table */
table.productPriceTable td:has(select[name="mprices[virtuemart_shoppergroup_id][]"]) {
    display: none !important;
}

/* Hide the vertical divider before Shopper Group */
table.productPriceTable td[style*="background: #d5d5d5"] {
    display: none !important;
}

/* Hide Base price row (readonly, not needed for yardsale) */
table.productPriceTable tr:has(input[name="mprices[basePrice][]"]) {
    display: none !important;
}

/* Hide Final price row - sellers only need Cost price */
table.productPriceTable tr:has(input[name="mprices[salesPrice][]"]) {
    display: none !important;
}

/* Hide Override row */
table.productPriceTable tr:has(input[name^="mprices[override]"]) {
    display: none !important;
}

/* Hide Calculate Cost checkbox and label in Final price row */
table.productPriceTable td:has(input[name^="mprices[use_desired_price]"]) {
    display: none !important;
}

/* Hide Tax Affecting column (empty after hiding Base price row anyway) */
table.productPriceTable td:has(span[uk-tooltip*="Tax Affecting"]) {
    display: none !important;
}

/* ========================================
   Internal Note Section - Hide
   ======================================== */

/* Hide Internal note card (has lock icon) */
.uk-card:has([uk-icon*="lock"]) {
    display: none !important;
}

/* ========================================
   Image Information Section - Hide Fields
   Keep only: File Title, Displayed image subtitle
   ======================================== */

/* Hide File published checkbox */
.uk-clearfix:has(#media\\[media_published\\]),
.uk-clearfix:has(input[name="media[media_published]"]),
.uk-clearfix:has(input[id*="media_published"]),
.uk-clearfix:has(label[for*="media_published"]) {
    display: none !important;
}

/* Hide "is image" checkbox */
.uk-clearfix:has(#media\\[is_image\\]) {
    display: none !important;
}

/* Hide Image Alt-Text */
.uk-clearfix:has(input[name="media[file_meta]"]) {
    display: none !important;
}

/* Hide Image Class */
.uk-clearfix:has(input[name="media[file_class]"]) {
    display: none !important;
}

/* Hide Used url */
.uk-clearfix:has(input[name="media[file_url]"]) {
    display: none !important;
}

/* Hide Used thumb url */
.uk-clearfix:has(#file_url_thumb) {
    display: none !important;
}

/* Hide Role/Displayable radio buttons - target by name patterns */
.uk-clearfix:has(input[type="radio"][name*="media_roles"]),
.uk-clearfix:has(input[type="radio"][name*="roles"]) {
    display: none !important;
}

/* Hide Storing location/type (readonly input with value product) */
.uk-clearfix:has(input[readonly][value="product"]) {
    display: none !important;
}

/* Hide Languages select */
.uk-clearfix:has(#mediaactive_languages) {
    display: none !important;
}

/* Hide Vendor in image section (has readonly span) */
.uk-clearfix:has(span.inputbox[readonly]) {
    display: none !important;
}

/* ========================================
   Hide Writeable Path Status Messages
   ======================================== */

/* Hide the server path writeable status alert */
.uk-alert-primary:has(.vmquote) {
    display: none !important;
}

/* Hide availability image selector and preview */
#imagelib,
select#image {
    display: none !important;
}

/* ========================================
   BATCH 1: Product Name, Images Search, Related
   ======================================== */

/* Make Product Information grid single column layout */
.uk-card:has(#product_name) .uk-card-body > div[uk-grid] {
    display: block !important;
}

.uk-card:has(#product_name) .uk-card-body > div[uk-grid] > div {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
}

/* Match Product Name input width to Categories selector */
#product_name {
    width: 100% !important;
    min-width: 300px !important;
    box-sizing: border-box !important;
}

.uk-clearfix:has(#product_name) .uk-form-controls {
    width: 100% !important;
}

/* Hide Images search container (keep Upload File and Image Information) */
.vmuikit-js-images {
    display: none !important;
}

/* Hide Related Categories container */
.uk-card:has([uk-icon*="category"]) {
    display: none !important;
}

/* Hide Related Products container */
.uk-card:has([uk-icon*="product"]) {
    display: none !important;
}

/* ========================================
   BATCH 2: Fixes
   ======================================== */

/* Hide Help button */
.button-help {
    display: none !important;
}

/* Make ALL form labels consistent - normal weight, gray */
.uk-card .uk-form-label,
.uk-card:has(#product_name) .uk-form-label,
.uk-card:has(#published) .uk-form-label,
.uk-clearfix .uk-form-label,
.productPriceTable td:first-child,
.productPriceTable td:first-child div {
    font-weight: 400 !important;
    color: #666 !important;
    font-size: 14px !important;
    text-align: left !important;
}

/* Consistent vertical spacing for ALL fields in Product Information section */
.uk-card:has(#product_name) .uk-clearfix,
.uk-card:has(#published) .uk-clearfix {
    margin-bottom: 10px !important;
    margin-top: 0 !important;
    padding: 0 !important;
}

/* Hide Vendor row - multiple selectors for reliability */
.uk-clearfix:has(span.inputbox[readonly]:not([id])),
.uk-clearfix:has(span.inputbox[readonly]) {
    display: none !important;
}

/* Collapse grid gaps in Product Information */
.uk-card:has(#product_name) .uk-card-body [uk-grid] {
    margin-top: 0 !important;
    gap: 0 !important;
}

.uk-card:has(#product_name) .uk-card-body [uk-grid] > div {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.uk-card:has(#product_name) .uk-card-body .uk-card {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
}

/* Remove extra padding/margin from the card containers */
.uk-card:has(#product_name),
.uk-card:has(#published) {
    padding: 0 !important;
}

.uk-card:has(#product_name) > .uk-card,
.uk-card:has(#published) > .uk-card {
    margin: 0 !important;
    padding: 0 !important;
}

/* Match Item Price header to other section headers */
.uk-card:has(#mainPriceTable) > .uk-card-header {
    background: transparent !important;
    border-bottom: none !important;
    padding: 15px 20px 10px !important;
}

.uk-card:has(#mainPriceTable) > .uk-card-header .uk-card-title {
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    color: #333 !important;
}

/* Hide entire Action when out of stock container */
div.uk-margin:has(#product_stockhandle) {
    display: none !important;
}

/* Hide entire Availability container */
div.uk-margin:has(#product_availability) {
    display: none !important;
}

/* ========================================
   Replace Pricing Title with "Item Price"
   ======================================== */

/* Hide the original pricing title text but keep layout */
.uk-card:has(#mainPriceTable) > .uk-card-header .uk-card-title .uk-width-expand > div {
    font-size: 0 !important;
}

/* Keep the icon visible */
.uk-card:has(#mainPriceTable) > .uk-card-header .uk-card-title .uk-width-expand > div > span[uk-icon] {
    font-size: 1.2rem !important;
}

/* Add replacement text - match .uk-card-title exactly */
.uk-card:has(#mainPriceTable) > .uk-card-header .uk-card-title .uk-width-expand > div::after {
    content: "Item Price";
    font-size: 1.2rem !important;
    font-weight: normal !important;
    line-height: 1.3 !important;
}

/* Add help text above "Add new price" button */
.uk-card:has(#mainPriceTable) .uk-card-footer > div::before {
    content: "Click ADD NEW PRICE to include both USD and EUR prices.";
    display: block;
    margin-bottom: 10px;
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
}

/* Hide 'is image' row - backup selector */
.uk-clearfix:has(input[name="media[is_image]"]) {
    display: none !important;
}

/* Hide Role/Displayable row - backup selector */
.uk-clearfix:has(input[name="media[media_roles]"]) {
    display: none !important;
}

/* Additional Role hiding - target the fieldset or parent containing radio buttons in Image Info */
.uk-card:has(#file_title) .uk-clearfix:has(input[type="radio"]) {
    display: none !important;
}

/* ========================================
   Registration Form - Compact & Centered Layout
   ======================================== */

/* Center the registration form and limit width */
form#adminForm.form-validate {
    max-width: 600px;
    margin: 0 auto;
}

/* Make the table take full width of container */
form#adminForm table.adminForm.user-details {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

/* Style table rows */
form#adminForm table.adminForm.user-details tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

/* Labels - full width above input */
form#adminForm table.adminForm.user-details td.key {
    width: 100%;
    padding: 0 0 4px 0;
}

form#adminForm table.adminForm.user-details td.key label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

/* Input cells - full width */
form#adminForm table.adminForm.user-details td:not(.key) {
    width: 100%;
    padding: 0;
}

/* Make inputs full width */
form#adminForm table.adminForm.user-details input.form-control,
form#adminForm table.adminForm.user-details textarea.form-control,
form#adminForm table.adminForm.user-details select.form-select {
    width: 100%;
    max-width: 100%;
}

/* Center the Register/Cancel buttons */
form#adminForm .d-flex.align-items-center.gap-3 {
    justify-content: center;
    margin-top: 20px;
}

/* Style the Register as Seller box */
.register-seller-option {
    max-width: 600px;
    margin: 20px auto !important;
}

/* Center the login form section too */
form#com-form-login {
    max-width: 600px;
    margin: 0 auto 30px auto;
}

/* Center page headings */
form#adminForm ~ h2,
h1 + form#com-form-login ~ h2 {
    text-align: center;
}
