/*
Theme Name: Food Specifications Pro v5.3 CORRECTED
Description: Professional WordPress theme for creating detailed food product specifications with corrected packaging calculations using Weight per Pack × Number of Bags
Version: 5.3.0
Author: Naturafrost
Text Domain: food-specifications
Features: Corrected packaging calculations, Weight per Pack × Number of Bags logic, Larger product images, French number formatting, Gross weight management for unit/carton/pallet, Scientific notation for bacteriology
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Food Specification Styles */
.food-spec-container {
    background: white;
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Specification Header Table */
.food-spec-container table:first-of-type {
    border: 2px solid #000 !important;
}

/* Specification Sections */
.spec-section {
    margin-bottom: 0;
    page-break-inside: avoid;
}

.spec-section h2 {
    background: #94c120;
    color: white;
    margin: 0;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    border: 1px solid #000;
    border-top: none;
    letter-spacing: 0.5px;
}

/* Print Optimized */
@media print {
    .food-spec-container {
        max-width: 100%;
        margin: 0;
        padding: 10mm;
        box-shadow: none;
    }
    
    .spec-section h2 {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    table { page-break-inside: avoid; }
    .spec-section { page-break-inside: avoid; }
}

/* Header */
.site-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 10px 0;  /* Reduced from 20px */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.site-title {
    text-align: center;
    font-size: 2.5em;
    margin: 0;
    font-weight: 300;
}

.site-title a {
    color: white;
    text-decoration: none;
}

/* Navigation */
.main-navigation {
    background-color: #34495e;
    padding: 15px 0;
}

.nav-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: #7CB342;
}

/* Food Specifications */
.food-spec-container {
    background: white;
    margin: 30px auto;
    padding: 0;
    max-width: 1000px;
}

.spec-section {
    margin: 0 0 2px 0;
    border: none;
    overflow: hidden;
}

.spec-section-header {
    background: #94c120;
    color: black;
    padding: 10px 20px;
    font-weight: bold;
    font-size: 1em;
    margin: 0;
    border: 1px solid #7CB342;
}

.spec-section-content {
    padding: 20px;
    border: 1px solid #ddd;
    border-top: none;
    background: white;
}

.product-info-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.product-info-label {
    background-color: #f8f9fa;
    font-weight: bold;
    padding: 12px 15px;
    color: #2c3e50;
}

.product-info-value {
    padding: 12px 15px;
    background-color: white;
}

/* Tables */
.characteristics-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.characteristics-table th {
    background: #7CB342;
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: bold;
}

.characteristics-table td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: #7CB342;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #689F38;
    color: white;
}

.btn-secondary {
    background-color: #34495e;
}

/* Cards */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.spec-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.spec-card:hover {
    transform: translateY(-5px);
}

.spec-card h3 a {
    text-decoration: none;
    color: #2c3e50;
}

.spec-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
    font-size: 0.9em;
}

/* Footer */
.site-footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
}

/* Responsive */
@media (max-width: 768px) {
    .product-info-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 10px;
    }
    
    .food-spec-container {
        padding: 20px;
        margin: 15px;
    }
}

/* Print */
@media print {
    /* CRITICAL: Force removal of browser headers/footers */
    @page {
        size: A4 portrait;
        margin: 0mm;  /* Zero margin to completely remove browser headers/footers */
    }
    
    /* Hide all navigation and non-essential elements */
    .site-header, 
    .main-navigation, 
    .site-footer, 
    .spec-actions,
    header,
    footer,
    nav,
    button,
    .btn {
        display: none !important;
    }
    
    /* Optimize container for printing with internal margins */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }
    
    .food-spec-container {
        margin: 0 !important;
        padding: 5mm 7mm !important;
        box-shadow: none !important;
        max-width: 100% !important;
    }
    
    /* Ensure white background */
    body {
        background: white !important;
    }
    
    /* ALL sections have uniform borders */
    .spec-section {
        border: 2px solid #000 !important;
        margin-bottom: 2px !important;
        page-break-inside: avoid !important;
    }
    
    .spec-section h2 {
        border: none !important;
    }
    
    /* Uniform table borders - VISIBLE AND THICK */
    table {
        border: 2px solid #000 !important;
        border-collapse: collapse !important;
    }
    
    th, td {
        border: 1px solid #333 !important;
        padding: 6px !important;
    }
    
    thead tr {
        background: #f5f5f5 !important;
        border: 2px solid #000 !important;
    }
    
    /* Prevent page breaks inside tables */
    table {
        page-break-inside: avoid;
    }
    
    /* Ensure colors print correctly */
    .spec-section h2,
    th[style*="background"],
    td[style*="background"],
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    /* Ensure header table has proper border */
    .food-spec-container > table:first-of-type {
        border: 2px solid #000 !important;
        margin-bottom: 3mm !important;
    }
}
