/**
 * WooFood Base Template Styles
 * Common styles shared across all menu layout templates
 *
 * @package WooFood
 * @version 1.0.0
 */

/* Reset and Base Styles */
.woofood-menu-container {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0;
}

.woofood-menu-container *,
.woofood-menu-container *:before,
.woofood-menu-container *:after {
    box-sizing: inherit;
}

/* Products Grid Base Styles */
.woofood-products-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
    width: 100%;
}

.woofood-columns-1 { grid-template-columns: 1fr; }
.woofood-columns-2 { grid-template-columns: repeat(2, 1fr); }
.woofood-columns-3 { grid-template-columns: repeat(3, 1fr); }
.woofood-columns-4 { grid-template-columns: repeat(4, 1fr); }
.woofood-columns-5 { grid-template-columns: repeat(5, 1fr); }
.woofood-columns-6 { grid-template-columns: repeat(6, 1fr); }

/* Product Card Base Styles */
.woofood-product-card {
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.woofood-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #cc0000;
}

.woofood-product-card.out-of-stock {
    opacity: 0.7;
}

.woofood-product-image {
    position: relative;
    overflow: hidden;
    background: #f8f8f8;
    padding-bottom: 60%; /* Aspect ratio */
}

.woofood-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.woofood-product-card:hover .woofood-product-image img {
    transform: scale(1.05);
}

.woofood-product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.woofood-out-of-stock {
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    background: rgba(204, 0, 0, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
}

.woofood-product-details {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.woofood-product-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
}

.woofood-product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.woofood-product-title a:hover {
    color: #cc0000;
}

.woofood-product-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    flex: 1;
}

.woofood-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.woofood-product-price {
    font-weight: bold;
    color: #cc0000;
    font-size: 16px;
}

.woofood-product-price .woocommerce-Price-amount {
    font-weight: inherit;
}

.woofood-add-to-cart {
    background: #cc0000;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.woofood-add-to-cart:hover {
    background: #aa0000;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.woofood-add-to-cart.disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.woofood-add-to-cart.disabled:hover {
    background: #ccc;
    transform: none;
}

/* Loading States */
.woofood-loading-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.woofood-loading-spinner {
    margin: 0 auto 20px;
    width: 40px;
    height: 40px;
}

.woofood-spinner {
    animation: woofood-spin 1s linear infinite;
}

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

.woofood-loading-text {
    margin: 0;
    font-size: 16px;
}

/* Error States */
.woofood-error-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #cc0000;
}

.woofood-error-text {
    margin: 0 0 20px 0;
    font-size: 16px;
}

.woofood-retry-button {
    background: #cc0000;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.woofood-retry-button:hover {
    background: #aa0000;
}

/* No Products State */
.woofood-no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.woofood-no-products p {
    margin: 0;
    font-size: 16px;
}

/* Screen Reader Only */
.woofood-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.woofood-sr-live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
    .woofood-columns-6 { grid-template-columns: repeat(4, 1fr); }
    .woofood-columns-5 { grid-template-columns: repeat(4, 1fr); }
}

@media screen and (max-width: 992px) {
    .woofood-columns-6,
    .woofood-columns-5,
    .woofood-columns-4 { grid-template-columns: repeat(3, 1fr); }
}

@media screen and (max-width: 768px) {
    .woofood-products-grid {
        gap: 15px;
    }
    
    .woofood-columns-6,
    .woofood-columns-5,
    .woofood-columns-4,
    .woofood-columns-3 { grid-template-columns: repeat(2, 1fr); }
    
    .woofood-product-details {
        padding: 12px;
    }
    
    .woofood-product-title {
        font-size: 15px;
    }
    
    .woofood-product-description {
        font-size: 13px;
        margin-bottom: 12px;
    }
    
    .woofood-add-to-cart {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .woofood-products-grid {
        gap: 10px;
    }
    
    .woofood-columns-6,
    .woofood-columns-5,
    .woofood-columns-4,
    .woofood-columns-3,
    .woofood-columns-2 { grid-template-columns: 1fr; }
    
    .woofood-product-footer {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .woofood-add-to-cart {
        width: 100%;
        text-align: center;
    }
}

/* High DPI / Retina Display Support */
@media only screen and (-webkit-min-device-pixel-ratio: 2),
       only screen and (min--moz-device-pixel-ratio: 2),
       only screen and (-o-min-device-pixel-ratio: 2/1),
       only screen and (min-device-pixel-ratio: 2),
       only screen and (min-resolution: 192dpi),
       only screen and (min-resolution: 2dppx) {
    .woofood-product-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .woofood-add-to-cart,
    .woofood-loading-spinner {
        display: none !important;
    }
    
    .woofood-product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .woofood-product-title a {
        color: #000 !important;
        text-decoration: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .woofood-product-card {
        background: #2a2a2a;
        border-color: #444;
        color: #e1e1e1;
    }
    
    .woofood-product-title a {
        color: #e1e1e1;
    }
    
    .woofood-product-title a:hover {
        color: #ff4444;
    }
    
    .woofood-product-description {
        color: #ccc;
    }
    
    .woofood-loading-placeholder,
    .woofood-no-products {
        color: #ccc;
    }
    
    .woofood-product-image {
        background: #1a1a1a;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .woofood-product-card,
    .woofood-product-image img,
    .woofood-add-to-cart,
    .woofood-product-title a {
        transition: none;
    }
    
    .woofood-product-card:hover {
        transform: none;
    }
    
    .woofood-product-card:hover .woofood-product-image img {
        transform: none;
    }
    
    .woofood-spinner {
        animation: none;
    }
}
