/*
 * Universal Product Card Styling — Fezamarket
 * Ensures consistent display across all pages: home, search, seller-center,
 * wishlist, related products, sponsored, etc.
 *
 * Loaded via templates/header.php after mobile-responsive.css.
 */

/* Base card layout — applies to all .product-card variants */
.product-card,
.feza-card,
.search-product-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.product-card:hover,
.feza-card:hover,
.search-product-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
    transform: translateY(-2px);
}

/* Image container — uses aspect-ratio so the box stays square,
 * with white padding background so PRODUCT IMAGES ARE NEVER CROPPED. */
.product-card .product-image,
.product-card .feza-card-img,
.feza-card .feza-card-img,
.search-product-card .product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #f3f4f6;
}

/* CRITICAL: `contain` (not `cover`) so the whole product is visible,
 * never cropped sideways or top/bottom. */
.product-card .product-image img,
.product-card .feza-card-img img,
.feza-card .feza-card-img img,
.search-product-card .product-image img,
img.product-thumb {
    max-width: 92%;
    max-height: 92%;
    width: auto;
    height: auto;
    object-fit: contain !important;
    display: block;
    transition: transform 0.25s ease;
}

.product-card:hover .product-image img,
.feza-card:hover .feza-card-img img,
.search-product-card:hover .product-image img {
    transform: scale(1.04);
}

/* Make the card clickable everywhere except action buttons */
.product-card,
.feza-card {
    cursor: pointer;
}

.product-card .product-actions,
.product-card .product-actions a,
.product-card .product-actions button,
.product-card a,
.feza-card a {
    cursor: pointer;
}

/* Body content */
.product-card .product-info,
.feza-card .feza-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-card .product-title,
.feza-card .feza-card-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
    color: #111827;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

.product-card .product-title a {
    color: #111827;
    text-decoration: none;
}

.product-card .product-title a:hover,
.product-card:hover .product-title {
    color: #0654ba;
}

.product-card .product-price,
.feza-card .feza-card-price,
.feza-card .feza-price-now {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.product-card .product-stock {
    font-size: 12px;
    color: #6b7280;
}

/* Status / featured / sponsored badges (top-right corner) */
.product-card .product-status {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.95);
    color: #111827;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.product-card .product-status.status-active { background: #d1fae5; color: #065f46; }
.product-card .product-status.status-draft { background: #fef3c7; color: #92400e; }
.product-card .product-status.status-inactive,
.product-card .product-status.status-archived { background: #fee2e2; color: #991b1b; }

/* Action buttons row */
.product-card .product-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.product-card .product-actions .btn,
.product-card .product-actions a.btn {
    flex: 1;
    text-align: center;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.product-card .product-actions .btn-outline {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
}

.product-card .product-actions .btn-outline:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.product-card .product-actions .btn:not(.btn-outline) {
    background: #0654ba;
    color: #fff;
    border: 1px solid #0654ba;
}

.product-card .product-actions .btn:not(.btn-outline):hover {
    background: #044a9f;
}

/* Grid containers — uniform column behavior across pages */
.products-grid,
.feza-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .products-grid,
    .feza-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .product-card .product-info,
    .feza-card .feza-card-body { padding: 10px; }
    .product-card .product-title,
    .feza-card .feza-card-title { font-size: 13px; }
}

@media (max-width: 480px) {
    .products-grid,
    .feza-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}
