/* =========================================================
   list.css — unified styles for list page (logged in + out)
   ========================================================= */

/* =========================================================
   TYPE FILTER DROPDOWN
   ========================================================= */

.toolbar-type-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.toolbar-type-label {
    font-size: 14px;
    color: #111;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
}

.type-filter-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
    padding: 6px 0;
}

.type-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    font-size: 13px;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

.type-filter-option:hover {
    background: #fafafa;
}

.type-filter-option input[type="checkbox"] {
    accent-color: #d4af37;
    flex-shrink: 0;
    cursor: pointer;
}

/* =========================================================
   PAGINATION
   ========================================================= */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    font-size: 12px;
    flex-wrap: nowrap;
}

.pagination a,
.pagination span.current,
.pagination .dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 32px;
    padding: 0 14px;
    line-height: 1;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    text-decoration: none;
    box-sizing: border-box;
}

.pagination span.current {
    background: #000;
    color: #fff;
    cursor: default;
}

.pagination a:hover {
    background: #f5f5f5;
}

.pagination .nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #000;
    background: #fff;
    text-decoration: none;
    position: relative;
}

.pagination .nav::before {
    content: "";
    width: 8px;
    height: 8px;
    border-top: 1.5px solid #000;
    border-right: 1.5px solid #000;
    display: block;
}

.pagination .nav.prev::before {
    transform: rotate(-135deg) translateX(-2px) translateY(1px);
}

.pagination .nav.next::before {
    transform: rotate(45deg) translateX(-1px) translateY(1px);
}

.pagination .goto {
    margin-left: 30px;
}

.pagination .goto input {
    height: 30px;
    min-width: 32px;
    padding: 0 8px;
    border: 1px solid #000;
    background: #fff;
    font-size: 12px;
    color: #000;
    line-height: 28px;
}

.pagination .goto button {
    height: 32px;
    min-width: 32px;
    padding: 0 8px;
    border: 1px solid #000;
    background: #000;
    font-size: 12px;
    color: #fff;
    line-height: 28px;
}

.pagination .goto input[type="number"]::-webkit-inner-spin-button,
.pagination .goto input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pagination .goto input[type="number"] {
    -moz-appearance: textfield;
}

/* =========================================================
   LAYOUT
   ========================================================= */

.catalog-columns {
    display: flex;
    align-items: flex-start;
    gap: 30px;
}

.catalog-sidebar {
    width: 260px;
    flex-shrink: 0;
    box-sizing: border-box;
    font-family: "PT Sans", Helvetica Neue, Arial, sans-serif;
    font-size: 13px;
    color: #555;
}

.catalog-main {
    flex: 1 1 auto;
    min-width: 0;
}

.catalog-products-wrapper {
    width: 100%;
}

.catalog-pagination {
    margin-top: 25px;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.catalog-sidebar .category-block {
    margin-bottom: 25px;
}

.catalog-sidebar .category-block h3 {
    margin: 0 0 10px;
    font-size: 23px;
    font-weight: 200;
    text-transform: uppercase;
    color: #000;
}

.catalog-sidebar .filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.catalog-sidebar .filter-list li {
    margin: 5px 0 !important;
}

.catalog-sidebar .filter-list li a {
    font-size: 14px;
    color: #555;
    padding-left: 2px;
    line-height: 1.4;
    text-decoration: none;
}

.catalog-sidebar .filter-list a:hover {
    text-decoration: none;
}

.catalog-sidebar .filter-list li.active > .category-row > a {
    font-weight: 600;
}

.catalog-sidebar .filter-list li.active .category-children a {
    font-weight: normal !important;
}

.catalog-sidebar .category-tree {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    scroll-behavior: smooth;
}

/* =========================================================
   CATEGORY TREE
   ========================================================= */

.category-tree,
.category-tree ul,
.category-children {
    list-style: none !important;
    padding-left: 0 !important;
    border: none !important;
}

.category-tree,
.category-tree > li {
    margin: 0 !important;
}

.category-item {
    list-style: none !important;
    border: none !important;
    position: relative;
    display: block;
}

.category-row {
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
	padding-right: 10px !important;
}

.category-item .category-row a {
    display: block;
    flex: 1;
    min-width: 0;
    padding-right: 16px;
    word-break: break-word;
    color: #000;
    text-decoration: none;
}

.category-item .category-row a:hover {
    text-decoration: none;
}

.category-children {
    display: none;
    margin-left: 16px !important;
    padding-left: 8px;
    border-left: 1px solid #e5e5e5;
}

.category-item.expanded > .category-children {
    display: block;
}

.category-count {
    display: inline-block;
    margin-left: 6px;
    padding: 0 4px;
    font-size: 11px;
    font-weight: normal;
    line-height: 16px;
    color: #b5b5b5;
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: 3px;
    vertical-align: middle;
    white-space: nowrap;
}

.category-toggle {
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    user-select: none;
    position: relative !important;
    align-self: center !important;
    vertical-align: middle !important;
    margin-left: auto !important;
    top: 0 !important;
    transform: none !important;
}

.category-toggle::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
    top: 3px;
    left: 3px;
    transform-origin: center;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.category-item.expanded > .category-row .category-toggle::before {
    transform: rotate(225deg) translateX(-3px) translateY(-3px);
    border-right: 2px solid #d4af37;
    border-bottom: 2px solid #d4af37;
}

/* =========================================================
   TOOLBAR
   ========================================================= */

.catalog-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 0;
    margin-bottom: 10px;
    font-size: 14px;
    color: #111;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    justify-content: space-between;
}

.toolbar-view {
    display: flex;
    gap: 6px;
}

.toolbar-view a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: #222;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}

.toolbar-view a:not(.active) {
    background: #f2f2f2;
    color: #000;
}

.toolbar-items {
    white-space: nowrap;
    color: #111;
}

.toolbar-limit,
.toolbar-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.toolbar-select {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* =========================================================
   CUSTOM SELECT DROPDOWNS
   ========================================================= */

.custom-select-wrap {
    position: relative;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
}

.custom-select-val {
    border: none;
    border-bottom: 1px solid #d6d6d6;
    padding-left: 8px;
    padding-right: 4px;
    font-size: 14px;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    color: #111;
    background: transparent;
    white-space: nowrap;
    display: inline-block;
    line-height: 1.6;
}

/* Per page selector — narrow, just needs to fit "20", "50" etc */
#perpage-val {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
}

/* Sort selector — medium width */
#sort-val {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

/* Type filter — wider to fit type names */
#type-filter-btn {
    width: 210px !important;
    min-width: 210px !important;
    max-width: 210px !important;
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 1px solid #d6d6d6;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 1000;
    min-width: 100%;
    width: max-content;
    padding: 4px 0;
}

.custom-select-option {
    padding: 6px 16px;
    font-size: 14px;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

.custom-select-option:hover {
    background: #fafafa;
    color: #000;
}

.custom-select-option.selected {
    font-weight: 600;
    color: #000;
}

/* Type filter uses same custom-select-dropdown */
.type-filter-dropdown.custom-select-dropdown {
    min-width: 130px;
    max-height: 300px;
    overflow-y: auto;
}

.type-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px;
    font-size: 13px;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

.type-filter-option:hover { background: #fafafa; }

.type-filter-option input[type="checkbox"] {
    accent-color: #d4af37;
    flex-shrink: 0;
    cursor: pointer;
}

.type-filter-close {
    padding: 6px 16px;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    border-top: 1px solid #eee;
    margin-top: 4px;
    text-align: right;
}

.type-filter-close:hover { color: #333; }

.toolbar-select-arrow {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: -14px;
    margin-right: 8px;
    pointer-events: none;
    position: relative;
    top: -1px;
}

.toolbar-select-arrow::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-right: 2px solid #777;
    border-bottom: 2px solid #777;
    top: 1px;
    left: 1px;
    transform-origin: center;
    transform: rotate(45deg);
}

.type-filter-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    background: #fff;
    border: 1px solid #d6d6d6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 1000;
    min-width: 130px;
    width: max-content;
    max-height: 300px;
    overflow-y: auto;
    padding: 6px 0;
}

.sort-dir {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 6px;
    position: relative;
    text-decoration: none;
    color: #777;
    cursor: pointer;
    font-size: 0;
}

.sort-dir::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 7px;
    background: #777;
    left: 50%;
    transform: translateX(-50%);
}

.sort-dir::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    left: 50%;
    transform: translateX(-50%);
}

.sort-dir[data-dir="asc"]::before { top: 14px; }
.sort-dir[data-dir="asc"]::after {
    top: 8px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #777;
}

.sort-dir[data-dir="desc"]::before { top: 10px; }
.sort-dir[data-dir="desc"]::after {
    top: 17px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #777;
}

/* =========================================================
   CATALOG LIST ITEMS
   ========================================================= */

.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 40px;
    width: 100%;
}

.catalog-list-item {
    display: block;
}

.catalog-list-link {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 5px !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    position: relative;
    z-index: 1;
    text-decoration: none !important;
    color: inherit !important;
}

a.catalog-list-link:hover {
    text-decoration: none !important;
    color: inherit !important;
}

.catalog-list-image {
    flex: 0 0 calc(30% - 10px) !important;
    width: calc(30% - 10px) !important;
    min-width: calc(30% - 10px) !important;
    box-sizing: border-box !important;
    padding: 16px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.catalog-list-image img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: contain;
    max-width: 100%;
}

.catalog-list-image img[src$="/media/no_image.png"] {
    transform: scale(0.6);
    transform-origin: center center;
    opacity: 0.75;
}

.catalog-list-info {
    flex: 0 0 calc(40% - 10px) !important;
    width: calc(40% - 10px) !important;
    min-width: calc(40% - 10px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    padding-left: 5px;
    pointer-events: none !important;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    font-size: 15px;
    color: #555;
    text-align: center;
    align-items: center;
}

.info-text-wrapper {
    pointer-events: none !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

/* =========================================================
   COLLECTOR ACTION BUTTONS (logged-in)
   ========================================================= */

.collector-actions-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    gap: 4px !important;
    margin-top: auto;
    pointer-events: auto !important;
    position: relative;
    z-index: 10 !important;
}

.collector-actions-grid button {
    flex: 0 0 calc(50% - 2px) !important;
    width: calc(50% - 2px) !important;
    min-height: 35px !important;
    font-size: 11px !important;
    padding: 4px 2px !important;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    color: #888888 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Collection button active */
.collector-actions-grid button.active-coll {
    background-color: #e8f5e9 !important;
    border: none !important;
    color: #2e7d32 !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.collector-actions-grid button.active-coll::before {
    content: '⚙';
    font-size: 18px;
    color: #2e7d32;
    line-height: 1;
    flex-shrink: 0;
}

.btn-wish.active-wish {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
    border: none !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.btn-wish.active-wish::before {
    content: '⚙';
    font-size: 18px;
    color: #0c5460;
    line-height: 1;
    flex-shrink: 0;
}

.btn-swap.active-swap {
    background-color: #fef5e7 !important;
    color: #e67e22 !important;
    border: none !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.btn-swap.active-swap::before {
    content: '⚙';
    font-size: 18px;
    color: #e67e22;
    line-height: 1;
    flex-shrink: 0;
}

/* Favourites */
.btn-fav {
    background-color: #f8f9fa;
    color: #666;
}

.btn-fav.active-fav {
    background-color: #fff0f5 !important;
    color: #e91e63 !important;
    border: none !important;
}

/* Guest buttons (logged-out) */
.btn-guest {
    cursor: not-allowed !important;
    opacity: 0.45;
    pointer-events: auto !important;
    position: relative;
}

.btn-guest[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
}

/* =========================================================
   COLLECTION MODAL (logged-in only)
   ========================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: #fff;
    padding: 25px 35px;
    width: 420px;
    max-width: 95%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    font-family: "PT Sans", Helvetica Neue, Arial, sans-serif;
    border-top: none !important;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    color: #000;
}

.close-x {
    position: absolute;
    top: 24px;
    right: 12px;
    color: #777;
    font-size: 24px;
    cursor: pointer !important;
}

.close-x:hover { color: #000; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.field { margin-bottom: 12px; }

.field label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #777 !important;
    margin-bottom: 4px;
    font-weight: normal !important;
}

.field input, .field select, .field textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
    height: 35px;
}

.field textarea { height: auto; }

.field input:focus, .field select:focus {
    border-color: #d4af37;
    outline: none;
}

.image-ribbon-thumbs {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.image-thumb-slot {
    width: 80px;
    height: 80px;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    background: #f9f9f9;
    color: #aaa;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.image-thumb-slot:hover {
    border-color: #d4af37;
    background: #fff;
    color: #d4af37;
}

.modal-actions-container {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    gap: 5px !important;
}

.modal-actions-container button {
    width: 100% !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10px !important;
    font-weight: bold !important;
    text-transform: uppercase;
    cursor: pointer !important;
    border: none !important;
}

#btn-remove-item {
    background: #fff0f0 !important;
    color: #d9534f !important;
    border: 1px solid #f5c6cb !important;
}

#btn-cancel-modal {
    background: #eee !important;
    color: #000 !important;
}

.btn-save {
    background: #000 !important;
    color: #fff !important;
}

.image-and-actions-row {
    display: flex !important;
    gap: 15px !important;
    margin-top: 15px !important;
    align-items: stretch !important;
}

.delete-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff0000;
    color: #ffffff;
    border: 1px solid #cc0000;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.delete-thumb:hover { background: #cc0000; }
.delete-thumb i { font-size: 14px; pointer-events: none; }

#add-collection-form select,
#wishlist-form select,
#swap-form select {
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 12px !important;
    padding-right: 25px !important;
    border: 1px solid #ddd;
    color: #333 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    cursor: pointer;
}

#add-collection-form input[type="text"],
#add-collection-form input[type="number"],
#add-collection-form textarea,
#wishlist-form input,
#wishlist-form textarea,
#swap-form input,
#swap-form textarea {
    background-color: #ffffff !important;
    border: 1px solid #ddd;
    color: #333 !important;
    box-shadow: none !important;
    padding: 8px;
}

#add-collection-form input:focus,
#add-collection-form select:focus,
#add-collection-form textarea:focus {
    border-color: #d4af37 !important;
    outline: none;
}

#modal-grading-house,
input[name="grading_serial"] { flex: 2 !important; min-width: 0; }

input[name="grading_grade"] { flex: 1 !important; min-width: 0; }

.btn-wish-save {
    background-color: #3498db !important;
    color: #fff !important;
    border: none !important;
    padding: 10px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: bold;
}

.btn-wish-remove,
.btn-swap-remove {
    background-color: #fff0f0 !important;
    color: #d9534f !important;
    border: 1px solid #f5c6cb !important;
    padding: 10px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: bold;
    width: 100%;
    display: none;
}

.btn-swap-save {
    background: #e67e22 !important;
    color: #fff !important;
}

/* Saving overlay */
#saving-overlay p {
    margin-top: 15px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================================
   GRID VIEW
   ========================================================= */

.catalog-view-grid .catalog-list { display: none; }

/* =========================================================
   NO-IMAGE PLACEHOLDER
   ========================================================= */

.catalog-list-image img[src$="/media/no_image.png"] {
    transform: scale(0.6);
    transform-origin: center center;
    opacity: 0.75;
}

.pagination-goto {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 20px;
    font-size: 12px;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
    flex-shrink: 0;
    white-space: nowrap;
}

.pagination-goto input {
    height: 32px;
    padding: 0 6px;
    border: 1px solid #000;
    font-size: 12px;
    text-align: center;
}

.pagination-goto button {
    height: 32px;
    padding: 0 10px;
    border: 1px solid #000;
    background: #000;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}