/**
 * Catalog Grid Styles
 * Product grid and card layout
 * Premium design with shadows, gradients, and smooth animations
 */

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

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(16px, 2vw, 24px);
}

.catalog-card {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-secondary);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.catalog-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-light);
}

/* SEO-friendly link wrapper for card content */
.catalog-card__link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Image container with gradient overlay */
.catalog-card__image {
    aspect-ratio: 1;
    background-color: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Subtle gradient overlay at bottom for depth */
.catalog-card__image::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40%;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.04) 0%,
        transparent 100%
    );
    pointer-events: none;
}

html.dark .catalog-card__image::after {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.15) 0%,
        transparent 100%
    );
}

.catalog-card__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    transition: transform 0.25s ease;
}

.catalog-card:hover .catalog-card__image img {
    transform: scale(1.05);
}

/* Info section with better spacing */
.catalog-card__info {
    padding: 16px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.catalog-card__brand {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.catalog-card__name {
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    transition: color 0.15s ease;
}

.catalog-card:hover .catalog-card__name {
    color: var(--accent);
}

.catalog-card__specs {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 2px 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Footer with cleaner separation */
.catalog-card__footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px 16px;
    margin-top: auto;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(var(--bg-secondary-rgb), 0.5) 100%
    );
    position: relative;
}

/* Subtle top border replacement with gradient */
.catalog-card__footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--border) 20%,
        var(--border) 80%,
        transparent 100%
    );
}

.catalog-card__footer .btn-add-small {
    width: 100%;
}

/* Price - More prominent styling */
.catalog-card__price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.01em;
}

/* ============================================================================
   GRID VIEW - UNAVAILABLE PRODUCT STYLING
   ============================================================================ */

.catalog-card__price-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 40px; /* Reserve space for price + stock note */
}

.catalog-card__price--unavailable {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.125rem;
}

.catalog-card__stock {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
}

.catalog-card__stock--out {
    color: var(--warning);
}

.catalog-card__stock--unavailable {
    color: var(--error);
}

/* ============================================================================
   ADD BUTTON (shared between grid and table)
   Premium styling with subtle shadow
   ============================================================================ */

.btn-add-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 38px;
    padding: 0 16px;
    background-color: var(--accent);
    color: #000;
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(var(--accent-rgb), 0.2);
}

.btn-add-small:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--accent-rgb), 0.3);
}

.btn-add-small:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(var(--accent-rgb), 0.2);
}

/* ============================================================================
   REDUCED MOTION SUPPORT
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .catalog-card,
    .catalog-card__image img,
    .catalog-card__name,
    .btn-add-small {
        transition: none;
    }

    .catalog-card:hover {
        transform: none;
    }

    .catalog-card:hover .catalog-card__image img {
        transform: none;
    }

    .btn-add-small:hover,
    .btn-add-small:active {
        transform: none;
    }
}
