﻿/* --------- Reset & Base --------- */
.pm_page_wrapper * { box-sizing: border-box; }
body { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

/* --------- Page Layout --------- */
.pm_page_wrapper {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    min-height: 100vh;
    background: #f8f9ff;
}

/* Prevent flex overflow for main content */
.pm_main_content {
    flex: 1;
    position: relative;
    min-width: 0;
}

/* --------- Sidebar --------- */
.pm_sidebar {
    width: 240px;
    min-width: 240px;
    padding: 1.25rem;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    position: sticky;
    top: 1rem;
    height: fit-content;
    z-index: 10;
}
.pm_sidebar_title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eef2f7;
    color: #1f2937;
}

/* Filter items */
.pm_filter_item {
    background: #f8f9fa;
    padding: 0.75rem;
    margin-bottom: 0.625rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}
.pm_filter_item:hover {
    background: #e8f5ff;
    border-color: #d6ecff;
    transform: translateY(-1px);
}
.pm_filter_item i { color: #0b74ff; }

/* --------- Search Box --------- */
.pm_search_box { position: relative; margin-bottom: 1rem; }
.pm_search_box input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    background: #fff;
}
.pm_search_box input:focus {
    box-shadow: 0 0 0 3px rgba(11,116,255,0.08);
    border-color: #0b74ff;
}
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

/* --------- Active Filters Bar --------- */
.pm_active_filters {
    display: none; /* toggled by JS */
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    margin-bottom: 1rem;
    align-items: center;
    border: 1px solid #eef2f7;
}
.pm_filter_chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: #e6f4ff;
    color: #0b5ed7;
    border-radius: 999px;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
}
.pm_filter_chip:hover { filter: brightness(0.95); }
.clear-chip { background: #ffebee; color: #c62828; }
.search-chip { background: #fff3e0; color: #ef6c00; }

/* --------- Products Grid (FORCE 4 COLUMNS) --------- */
.pm_products_container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* ALWAYS 4 columns on desktop */
    gap: 1.5rem;
    align-items: stretch;
}

/* Adjust card width behavior */
.pm_product_card {
    background: #fff;
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid #e6e9ef;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    height: 100%
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.pm_product_card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    border-color: rgba(11, 116, 255, 0.12);
}

/* Image placeholder */
.pm_product_image_placeholder {
    width: 2.5rem;
    height: 2.5rem;
    background: #f1f5f9;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    color: #9aa5b1;
    font-size: 1.125rem;
}

/* Titles & meta */
.pm_product_title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
}
.pm_product_category {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    font-weight: 500;
}
.pm_mini_info {
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    color: #374151;
}

/* Status badges */
.pm_status_active, .pm_status_inactive {
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.75rem;
}
.pm_status_active { background: #dff4e6; color: #0f5132; }
.pm_status_inactive { background: #ffe6e9; color: #7a1120; }

/* Edit button */
.pm_btn_edit {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(180deg,#0b74ff,#0066d6);
    color: #fff;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    margin-top: 0.5rem;
    border: none;
}
.pm_btn_edit:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(11,116,255,0.12); }

/* --------- Modals --------- */
.pm_modal_overlay {
    display: none; /* shown by JS via display:flex */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.pm_modal_box {
    background: #fff;
    width: 100%;
    max-width: 36rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(2,6,23,0.2);
    overflow: hidden;
    animation: pm_fadeIn 180ms ease;
}
@keyframes pm_fadeIn { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.pm_modal_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef2f7;
}
.pm_modal_title { margin: 0; font-size: 1.125rem; font-weight: 700; display:flex; gap:0.5rem; align-items:center; }
.pm_modal_close { background:none; border:none; font-size:1.25rem; cursor:pointer; padding:0.25rem; border-radius:50%; }
.pm_modal_close:hover { background:#f1f5f9; color:#c62828; }

.pm_modal_search { padding: 0.75rem 1.25rem; }
.pm_modal_input {
    width:100%;
    padding:0.6rem 0.75rem 0.6rem 2.5rem;
    border-radius:0.5rem;
    border: 1px solid #d1d5db;
}
.pm_modal_search i { position: absolute; left: 2.3rem; top: 2.25rem; color:#6b7280; }

.pm_modal_content {
    padding: 0.75rem 1.25rem 1.25rem;
    max-height: 40vh;
    overflow-y: auto;
}
.pm_modal_item {
    display:flex;
    align-items:center;
    gap:0.75rem;
    padding:0.5rem 0;
    border-bottom:1px solid #f3f4f6;
}
.pm_modal_item label { flex: 1; cursor: pointer; margin: 0; }

.pm_modal_footer { padding: 0.75rem 1.25rem 1.25rem; text-align: right; }
.pm_btn_ok, .pm_btn_clear_all {
    padding: 0.6rem 1.1rem;
    background: #0b74ff;
    color: #fff;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
}
.pm_btn_clear_all { background: #d43d3d; width: 100%; justify-content:center; }

/* --------- Responsive - adjust columns --------- */
@media (max-width: 1200px) {
    .pm_products_container { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .pm_products_container { grid-template-columns: repeat(2, 1fr); }
    .pm_sidebar { position: static; width: 100%; min-width: 0; }
    .pm_page_wrapper { flex-direction: column; gap: 1rem; }
}
@media (max-width: 600px) {
    .pm_products_container { grid-template-columns: 1fr; }
    .pm_modal_box { max-width: 95%; }
}

/* Small tweaks */
.mb-3 { margin-bottom: 1rem; }
.text-muted { color: #6b7280; font-size: 0.95rem; }



.pm_product_image {
    width: 100%;
    height: 140px;            /* Adjust height */
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pm_product_image img {
    width: 100%;
    height: 100%;
    object-fit: contain;      /* Prevent stretching */
    padding: 6px;
}

.pm_no_image {
    text-align: center;
    color: #9aa5b1;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pm_no_image i {
    font-size: 1.5rem;
    color: #b3bcca;
}


.pm_product_card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 420px; /* adjust based on your design */
}

/* This ensures button stays at bottom */
.pm_card_body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pm_mini_info {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;  /* show max 4 lines */
    -webkit-box-orient: vertical;
}
.pm_add_product {
    margin-bottom: 1rem;
}

.pm_add_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;

    width: 100%;
    padding: .65rem .75rem;

    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;

    box-shadow: 0 6px 14px rgba(79,70,229,.25);
}

.pm_add_btn i {
    font-size: .9rem;
}

.pm_add_btn:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    color: #fff;
}
/* Add Product – same as filter items */
.pm_add_product_item {
    font-weight: 600;
}

/* Optional: slightly different hover to highlight action */
.pm_add_product_item:hover {
    background: rgba(79,70,229,0.08);
}

/* Optional: icon color consistency */
.pm_add_product_item i {
    font-size: 0.95rem;
}
