/* --- SHARED LAYOUT --- */
.content-area { 
    padding: 20px; 
    max-width: 1400px; 
    margin: 0 auto; 
    width: 100%;
}

.action-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 0 10px;
}

.action-header h3 { 
    font-size: 20px; 
}

/* --- BUTTONS --- */
.add-btn {
    background: var(--red);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    transition: 0.3s;
}

.add-btn:hover { 
    background: var(--bright-red); 
}

/* --- PRODUCT GRID --- */
.products-grid {
    display: grid;
    /* repeat(auto-fill, 280px) ensures uniform size and prevents hideous stretching */
    grid-template-columns: repeat(auto-fill, 280px);
    gap: 25px;
    justify-content: center; 
    position: relative;
    min-height: 400px;
}

/* --- PRODUCT CARD --- */
.product-card {
    position: relative; /* Essential for the stretched link */
    cursor: pointer;
    background: var(--dark-gray);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    width: 280px;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    border-color: var(--red);
}

.card-image-wrapper {
    width: 100%;
    height: 220px;
    background: #1a1a1a;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.5s ease;
}

.card-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* The "Magic" Link that covers the whole card */
.main-card-link::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1; /* Covers everything below it */
}
/* Ensure price/admin rows stay on top of the link if you need buttons there later */
.admin-prices, .add-to-cart-btn {
    position: relative;
    z-index: 2;
}

/* --- TEXT & LABELS --- */
.product-category {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--red);
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 12px;
    text-decoration: none;
    line-height: 1.4;
    display: block;
    min-height: 45px; /* Ensures alignment even with different title lengths */
}

.product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* --- PRICING --- */
.price-section { 
    margin-top: auto; 
}

.price-label { 
    font-size: 11px; 
    color: var(--text-muted); 
    display: block; 
    margin-bottom: 2px; 
}

.main-price { 
    font-size: 22px; 
    font-weight: 800; 
    color: var(--white); 
}

.admin-prices {
    background: rgba(206, 206, 206, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 11px;
}

.admin-price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.admin-price-row .val { 
    color: var(--white); 
    font-weight: 600; 
}

/* --- UTILITIES --- */
.loading-overlay {
    grid-column: 1 / -1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 100px 0;
}

.loading-overlay.active { 
    display: flex; 
}

.spinner {
    width: 40px; 
    height: 40px;
    border: 4px solid rgba(211, 47, 47, 0.2);
    border-top: 4px solid var(--red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { 
    100% { transform: rotate(360deg); } 
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
    .products-grid { 
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
        gap: 15px; 
    }
    .product-card { 
        width: 100%; 
    }
    .card-image-wrapper { 
        height: 160px; 
    }
    .product-title { 
        font-size: 14px; 
        min-height: auto; 
    }
    .main-price { 
        font-size: 18px; 
    }
    .action-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 10px; 
    }
}