/* =========================
   CATALOG.CSS
   Safe overrides for catalog.html
   Depends on shop.css for card/grid/modal visuals.
   ========================= */

/* Page shell: keep catalog inside viewport without changing card visuals */
.catalog-page .catalog-container {
    width: 100%;
    max-width: 1476px;
    margin: 0 auto;
    padding-inline: clamp(16px, 4vw, 40px);
    box-sizing: border-box;
    overflow-x: hidden;
}

.catalog-page .catalog-layout,
.catalog-page .catalog-content {
    width: 100%;
    min-width: 0;
}

/* Header action alignment */
.catalog-page .catalog-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

/* Download Catalog Button */
.catalog-page .btn-download-catalog {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--primary-color, var(--color-accent, #1a1a1a));
    color: var(--bg-color, #ffffff);
    padding: 8px 16px;
    border: 1px solid var(--primary-color, var(--color-accent, #1a1a1a));
    border-radius: 4px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.catalog-page .btn-download-catalog:hover {
    background-color: transparent;
    color: var(--primary-color, var(--color-accent, #1a1a1a));
    transform: translateY(-2px);
}

.catalog-page .btn-download-catalog svg {
    flex-shrink: 0;
}

/* Sidebar spacing */
.catalog-page .sidebar-section {
    margin-bottom: 32px;
}

.catalog-page .sidebar-heading {
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.62rem;
    font-weight: 400;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #aaa;
    margin-bottom: 14px;
}

/* Optional class you can toggle from JS when a filter is active */
.catalog-page .sidebar-section.is-active .sidebar-heading::after {
    content: '•';
    display: inline-block;
    margin-left: 6px;
    font-size: 0.65rem;
    color: #111;
    vertical-align: middle;
}

/* Hidden native selects remain available to JS */
.catalog-page #categoryFilter,
.catalog-page #sizeFilter {
    width: 100%;
}

/* Custom dropdown */
.catalog-page .custom-dropdown {
    position: relative;
    width: 100%;
    user-select: none;
}

.catalog-page .cd-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #ddd;
    border-radius: 0;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.72rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #111;
    cursor: pointer;
    text-align: left;
    outline: none;
    transition: border-color 0.2s ease;
}

.catalog-page .cd-trigger:hover,
.catalog-page .custom-dropdown.open .cd-trigger {
    border-bottom-color: #111;
}

.catalog-page .cd-arrow {
    flex-shrink: 0;
    color: #111;
    transition: transform 0.2s ease;
}

.catalog-page .custom-dropdown.open .cd-arrow {
    transform: rotate(180deg);
}

.catalog-page .cd-list {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    width: 100%;
    z-index: 200;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-top: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

.catalog-page .custom-dropdown.open .cd-list {
    display: block;
}

.catalog-page .cd-option {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 16px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.78rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: #555;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.catalog-page .cd-option:hover {
    background: #f8f8f8;
    color: #111;
}

.catalog-page .cd-option.active {
    color: #111;
    font-weight: 500;
}

.catalog-page .cd-option.active::before {
    content: '—';
    margin-right: 2px;
    font-size: 0.6rem;
    opacity: 0.5;
}

.catalog-page .cd-hint {
    font-size: 0.68rem;
    color: #bbb;
    font-weight: 300;
    letter-spacing: 0;
}

.catalog-page .cd-option.active .cd-hint {
    color: #999;
}

/* Search bar width only; visual styling lives in shop.css */
.catalog-page .catalog-search-wrapper .shop-search-bar {
    max-width: 100%;
}

/* Button icon alignment only; base button visuals live in shop.css */
.catalog-page .btn-grid-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.catalog-page .btn-grid-action .btn-icon,
.catalog-page .btn-grid-action svg,
.catalog-page .btn-grid-action img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.catalog-page .icon-eye {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}

/* Infinite scroll states only; does not modify product-card/image visuals */
.catalog-page .catalog-loader,
.catalog-page .catalog-empty-state {
    text-align: center;
    padding: 32px 0;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #999;
}

.catalog-page .catalog-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.catalog-page .catalog-loader__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: #111;
    border-radius: 50%;
    animation: catalog-spin 0.7s linear infinite;
}

@keyframes catalog-spin {
    to { transform: rotate(360deg); }
}

.catalog-page .catalog-empty-state {
    text-transform: none;
    letter-spacing: normal;
    padding: 48px 20px 56px;
    max-width: 400px;
    margin: 0 auto;
}

.catalog-page .catalog-empty-state__title {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 1.25rem;
    color: #222;
    margin: 0 0 10px;
}

.catalog-page .catalog-empty-state__desc {
    font-size: 0.9rem;
    line-height: 1.55;
    color: #666;
    margin: 0 0 20px;
}

.catalog-page .catalog-empty-state__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    border: 1px solid #111;
    background: #111;
    color: #fff;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.2s, color 0.2s;
}

.catalog-page .catalog-empty-state__btn:hover,
.catalog-page .catalog-empty-state__btn:focus-visible {
    background: #fff;
    color: #111;
    outline: none;
}

.catalog-page .catalog-skeleton-card {
    pointer-events: none;
}

.catalog-page .catalog-skeleton-info {
    padding: 12px 4px 4px;
}

.catalog-page .catalog-skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
    background-size: 200% 100%;
    animation: shop-skeleton-shimmer 1.4s ease-in-out infinite;
}

.catalog-page .catalog-skeleton-line--title {
    width: 75%;
    height: 14px;
    margin-bottom: 10px;
}

.catalog-page .catalog-skeleton-line--price {
    width: 40%;
}

.catalog-page .catalog-sentinel {
    width: 100%;
    height: 1px;
}

/* Responsive catalog wrapper only */
@media (max-width: 900px) {
    .catalog-page .catalog-container {
        max-width: none;
        margin: 0;
        padding-inline: 16px;
    }

    .catalog-page .catalog-header-actions {
        align-items: flex-start;
    }

    .catalog-page .btn-download-catalog {
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .catalog-page .catalog-search-wrapper {
        top: 72px;
        padding-bottom: 12px;
    }

    .catalog-filters-toggle {
        display: inline-flex;
    }

    .catalog-page .catalog-layout .catalog-sidebar {
        display: none;
        margin-bottom: 0;
    }

    .catalog-page .catalog-layout.is-filters-open .catalog-sidebar {
        display: block;
        margin-bottom: 24px;
        padding: 16px;
        border: 1px solid #e8e8e8;
        border-radius: 8px;
        background: #fafafa;
    }

    .catalog-page .catalog-layout {
        display: block;
    }

    .catalog-page .catalog-sidebar {
        width: 100%;
        margin-bottom: 24px;
    }

    .catalog-page .catalog-sidebar .sidebar-section,
    .catalog-page .filter-dropdown {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .catalog-page .catalog-header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .catalog-page .btn-download-catalog {
        width: 100%;
    }
}

.catalog-content .product-title a {
    color: inherit;
    text-decoration: none;
}

.catalog-content .product-title a:hover {
    color: inherit;
    text-decoration: none;
}

.catalog-content .btn-grid-action:disabled {
    opacity: 0.45;
    cursor: default;
}

/* API catalog cards — show price on mobile for faster purchase decisions */
.catalog-page .catalog-card-price {
    display: block;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    margin: 2px 0 0;
    color: #444;
}

.catalog-page .catalog-card-price--consult {
    font-style: italic;
    color: #666;
}

.catalog-page .catalog-price-hint {
    display: block;
    font-size: 0.72rem;
    color: #888;
    margin: 2px 0 8px;
    letter-spacing: 0.02em;
}

/* Search row + availability chip */
.catalog-page .catalog-search-wrapper {
    position: sticky;
    top: 88px;
    z-index: 60;
    background: #fff;
    padding: 8px 0 16px;
    margin-bottom: 8px;
}

.catalog-page .catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 8px;
}

.catalog-page .catalog-toolbar .shop-search-bar {
    flex: 1 1 280px;
    min-width: 0;
}

.catalog-page .catalog-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.catalog-page .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    white-space: nowrap;
}

.catalog-page .filter-chip:has(input:checked) {
    border-color: #166534;
    background: #f0faf4;
    color: #166534;
}

.catalog-page .filter-chip input {
    accent-color: #166534;
}

.catalog-filters-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    white-space: nowrap;
}

.catalog-filters-toggle:hover,
.catalog-filters-toggle:focus-visible {
    border-color: #111;
    outline: none;
}

.catalog-filters-toggle[aria-expanded="true"] {
    border-color: #111;
    background: #fafafa;
}

.catalog-filters-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
}

.catalog-page .search-results-count {
    font-size: 0.78rem;
    color: #888;
    white-space: nowrap;
}

/* Grid surface + card frames */
.catalog-page .catalog-content {
    background: linear-gradient(180deg, #fafaf9 0%, #fff 120px);
    border-top: 1px solid #e8e8e6;
    padding-top: 8px;
}

.catalog-page .catalog-content .products-grid {
    gap: clamp(14px, 2.5vw, 24px);
    padding: 20px 0 48px;
}

.catalog-page .catalog-content .product-card {
    border: 1px solid #e5e5e3;
    border-radius: 6px;
    background: #fff;
    margin-bottom: 0;
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 6px 20px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.3s ease,
        border-color 0.3s ease;
    transition-delay: var(--reveal-delay, 0ms);
}

.catalog-page .catalog-content .product-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.catalog-page .catalog-content .product-card:hover {
    transform: translateY(-3px);
    border-color: #d4d4d0;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.06),
        0 14px 32px rgba(0, 0, 0, 0.09);
}

.catalog-page .catalog-content .product-card.is-visible:hover {
    transform: translateY(-3px);
}

.catalog-page .catalog-content .product-image {
    border-bottom: 1px solid #ececea;
}

.catalog-page .catalog-content .product-info {
    padding: 12px 14px 0;
    text-align: center;
}

.catalog-page .catalog-content .product-actions-grid {
    display: flex;
    margin: 12px -14px 0;
    width: calc(100% + 28px);
    border-top: 1px solid #ececea;
    padding-top: 0;
}

.catalog-page .catalog-content .btn-grid-details {
    border-right: 1px solid #ececea;
}

.catalog-page .catalog-content .btn-grid-action {
    padding: 12px 8px;
    font-size: 0.68rem;
}

@media (prefers-reduced-motion: reduce) {
    .catalog-page .catalog-content .product-card {
        opacity: 1;
        transform: none;
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }

    .catalog-page .catalog-content .product-card:hover,
    .catalog-page .catalog-content .product-card.is-visible:hover {
        transform: none;
    }
}

.catalog-page .product-card-status {
    margin-bottom: 6px;
}

.catalog-page .product-status-badge {
    display: inline-block;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 2px;
    line-height: 1.3;
}

.catalog-page .product-status-badge--available {
    display: none;
}

.catalog-page .product-card-status:empty {
    display: none;
    margin: 0;
}

.catalog-page .product-status-badge--sold {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

/* Sold label below image, not over the artwork */
.catalog-page .product-card.sold::after {
    display: none;
}

.catalog-page .product-card.sold .catalog-card-price,
.catalog-page .product-card.sold .catalog-price-hint {
    display: none;
}

.catalog-page .product-card.sold .product-image img {
    filter: grayscale(0.25);
    opacity: 0.9;
}

.catalog-page .product-card.sold .product-actions-grid--solo .btn-grid-details {
    flex: 1;
    width: 100%;
    border-right: none;
}

/* Show full artwork in a consistent frame */
.catalog-page .catalog-content .product-image {
    aspect-ratio: 4 / 5;
    min-height: 0;
    max-height: none;
    background: #f3f3f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-page .catalog-content .product-image img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

@media (max-width: 768px) {
    .catalog-page .catalog-content .products-grid {
        gap: 10px;
        padding-bottom: 32px;
    }

    .catalog-page .catalog-content .product-card {
        border-radius: 4px;
    }

    .catalog-page .catalog-content .product-info {
        padding: 10px 10px 0;
    }

    .catalog-page .catalog-content .product-actions-grid {
        margin: 10px -10px 0;
        width: calc(100% + 20px);
    }

    .catalog-page .catalog-content .product-image {
        aspect-ratio: 1 / 1;
    }

    .catalog-page .catalog-content .btn-grid-action {
        padding: 10px 4px;
        font-size: 0.58rem;
        letter-spacing: 0.04em;
    }
}

.catalog-page .btn-grid-sold {
    opacity: 0.45;
    cursor: not-allowed;
}
