* {
    box-sizing: border-box;
}

body {
    margin: 0;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #f4f6f8;
    color: #222;
}


/* =========================
   HEADER
========================= */

.header {
    background: #09254b;
    color: white;

    padding: 40px 20px;

    text-align: center;
}

.header h1 {
    margin: 0 0 10px;

    font-size: 32px;
}

.header p {
    margin: 0;

    opacity: 0.9;
}


/* =========================
   CONTAINER
========================= */

.container {
    width: min(1200px, 94%);

    margin: 35px auto;
}


/* =========================
   SEARCH
========================= */

.search-section {
    background: white;

    padding: 25px;

    border-radius: 12px;

    box-shadow:
        0 3px 15px rgba(0, 0, 0, 0.08);

    margin-bottom: 30px;
}

.search-box {
    display: flex;

    gap: 15px;
}

.search-box input,
.barcode-box input {

    flex: 1;

    min-width: 0;

    padding: 13px 15px;

    border: 1px solid #ccc;

    border-radius: 7px;

    font-size: 16px;

    outline: none;
}

.search-box input:focus,
.barcode-box input:focus {
    border-color: #5C77FF;
}


button {
    border: none;

    border-radius: 7px;

    padding: 12px 20px;

    background: #2563eb;

    color: white;

    font-size: 15px;

    cursor: pointer;

    transition:
        background 0.2s,
        transform 0.1s;
}

button:hover {
    background: #D91717;
    transform: scale(1.05);
}

button:active {
    transform: scale(0.98);
}


.barcode-box {

    display: flex;

    align-items: center;

    gap: 15px;

    margin-top: 15px;

    font-size: 14px;

    color: #555;
}

.barcode-box input {
    max-width: 300px;
}


/* =========================
   MESSAGES
========================= */

.message {

    padding: 15px 20px;

    border-radius: 8px;

    margin-bottom: 25px;

    background: white;
}

.message.error {
    background: #ffe5e5;

    color: #a00000;
}

.message.info {
    background: #e8f0ff;

    color: #173d85;
}

.hidden {
    display: none !important;
}


/* =========================
   RESULTS
========================= */

.section-title {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 20px;
}

.section-title h2 {
    margin: 0;
}

#resultCount {
    color: #666;

    font-size: 14px;
}


.products-grid {

    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(250px, 1fr));

    gap: 20px;
}


/* =========================
   PRODUCT CARD
========================= */

.product-card {

    background: white;

    border-radius: 12px;

    overflow: hidden;

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.08);

    cursor: pointer;

    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.product-card:hover {

    transform: translateY(-4px);

    box-shadow:
        0 7px 20px rgba(0, 0, 0, 0.14);
}


.product-image {

    width: 100%;

    height: 220px;

    object-fit: contain;

    background: #fafafa;

    display: block;
}


.no-image {

    width: 100%;

    height: 220px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #eee;

    color: #888;

    font-size: 15px;
}


.product-card-content {

    padding: 18px;
}

.product-card h3 {

    margin: 0 0 8px;

    font-size: 18px;

    line-height: 1.3;
}

.brand {

    color: #666;

    margin-bottom: 12px;

    font-size: 14px;
}


/* =========================
   NUTRI SCORE
========================= */

.nutriscore {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    width: 42px;

    height: 30px;

    border-radius: 5px;

    color: white;

    font-weight: bold;

    text-transform: uppercase;
}

.nutriscore-a {
    background: #038141;
}

.nutriscore-b {
    background: #85bb2f;
}

.nutriscore-c {
    background: #fecb02;

    color: #222;
}

.nutriscore-d {
    background: #ee8100;
}

.nutriscore-e {
    background: #e63e11;
}

.nutriscore-unknown {
    background: #999;
}


/* =========================
   PRODUCT DETAILS
========================= */

.product-section {

    background: white;

    border-radius: 12px;

    padding: 25px;

    box-shadow:
        0 3px 15px rgba(0, 0, 0, 0.08);
}


.back-button {

    background: #555;

    margin-bottom: 25px;
}

.back-button:hover {
    background: #333;
}


.product-header {

    display: grid;

    grid-template-columns:
        350px 1fr;

    gap: 40px;

    margin-bottom: 35px;
}


.product-main-image {

    width: 100%;

    height: 350px;

    object-fit: contain;

    background: #fafafa;

    border-radius: 10px;
}


.product-title h2 {

    font-size: 32px;

    margin-top: 0;

    margin-bottom: 10px;
}

.product-brand {

    font-size: 18px;

    color: #666;

    margin-bottom: 20px;
}


.product-tags {

    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-top: 20px;
}


.tag {

    padding: 7px 12px;

    border-radius: 20px;

    background: #edf1f7;

    color: #333;

    font-size: 13px;
}


/* =========================
   PAGINATION
========================= */

.pagination {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 20px;

    margin-top: 35px;

    padding: 20px 0;
}

.pagination button {

    min-width: 120px;

    padding: 10px 18px;
}

.pagination button:disabled {

    opacity: 0.45;

    cursor: not-allowed;
}

#pageInfo {

    min-width: 120px;

    text-align: center;

    font-weight: bold;

    color: #444;
}

/* =========================
   NUTRITION
========================= */

.nutrition-section {

    margin-top: 30px;
}

.nutrition-section h3 {

    font-size: 22px;

    margin-bottom: 15px;
}


.nutrition-table {

    width: 100%;

    border-collapse: collapse;

    background: #fafafa;

    border-radius: 8px;

    overflow: hidden;
}

.nutrition-table th,
.nutrition-table td {

    padding: 13px 15px;

    border-bottom: 1px solid #ddd;

    text-align: left;
}

.nutrition-table th {

    background: #09254b;

    color: white;
}

.nutrition-table tr:last-child td {
    border-bottom: none;
}


/* =========================
   INGREDIENTS
========================= */

.info-section {

    margin-top: 30px;
}

.info-section h3 {

    margin-bottom: 10px;

    font-size: 22px;
}

.ingredients {

    line-height: 1.7;

    color: #444;
}


/* =========================
   FOOTER
========================= */

footer {

    text-align: center;

    padding: 0px 30px 30px 30px;

    color: #777;

    font-size: 14px;
}

footer a {
    color: #405de6;

    text-decoration: none;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 750px) {

    .search-box,
    .barcode-box {

        flex-direction: column;

        align-items: stretch;
    }

    button:hover {
        transform: scale(1.02);
    }

    .barcode-box input {
        max-width: none;
    }

    .product-header {

        grid-template-columns: 1fr;

        gap: 25px;
    }

    .product-main-image {

        height: 280px;
    }

    .product-title h2 {

        font-size: 26px;
    }
}