/* =========================
   RESET
========================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background:
        linear-gradient(
            135deg,
            #eef5ff,
            #ffffff
        );

    color: #333;
}


/* =========================
   ADMIN BUTTON
========================= */

.admin-link {

    position: fixed;

    top: 20px;

    right: 40px;

    z-index: 999;

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 12px 20px;

    background: #1769c2;

    color: white;

    text-decoration: none;

    border-radius: 10px;

    font-weight: bold;

    box-shadow:
        0 5px 15px
        rgba(0,0,0,0.18);

}


.admin-link:hover {

    background: #0d47a1;

}


/* =========================
   HERO
========================= */

.hero {

    text-align: center;

    padding: 35px 20px 25px;

}


.logo-box {

    display: flex;

    justify-content: center;

}


.logo {

    width: 100px;

    height: 100px;

    object-fit: contain;

}


.hero h1 {

    margin: 10px 0 8px;

    color: #1769c2;

    font-size: 30px;

}


.hero p {

    margin: 0;

    color: #777;

}


/* =========================
   CONTAINER
========================= */

.container {

    width: min(
        1200px,
        calc(100% - 40px)
    );

    margin: auto;

}


/* =========================
   STATUS CARD
========================= */

.status-card {

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 20px;

    padding: 15px 20px;

    margin-bottom: 15px;

    background: white;

    border-radius: 12px;

    box-shadow:
        0 5px 20px
        rgba(0,0,0,0.08);

}


/* =========================
   SEARCH
========================= */

.search-card {

    position: relative;

    padding: 15px;

    margin-bottom: 20px;

    background: white;

    border-radius: 12px;

    box-shadow:
        0 5px 20px
        rgba(0,0,0,0.08);

}


.search-input-wrap {

    display: flex;

    align-items: center;

    gap: 10px;

}


.search-input-wrap > i {

    color: #1769c2;

}


#code {

    flex: 1;

    min-width: 0;

    padding: 13px 15px;

    border: 1px solid #ddd;

    border-radius: 8px;

    outline: none;

    font-size: 16px;

}


#code:focus {

    border-color: #1769c2;

    box-shadow:
        0 0 0 3px
        rgba(23,105,194,0.12);

}


#searchBtn {

    padding: 13px 22px;

    border: none;

    border-radius: 8px;

    background: #1769c2;

    color: white;

    font-weight: bold;

    cursor: pointer;

}


#searchBtn:hover {

    background: #0d47a1;

}


/* =========================
   SUGGEST
========================= */

.suggest-box {

    position: absolute;

    left: 15px;

    right: 15px;

    top: 70px;

    z-index: 100;

    display: none;

    max-height: 350px;

    overflow-y: auto;

    background: white;

    border-radius: 10px;

    box-shadow:
        0 8px 25px
        rgba(0,0,0,0.18);

}


.suggest-item {

    padding: 12px 15px;

    cursor: pointer;

    border-bottom: 1px solid #eee;

}


.suggest-item:hover,

.suggest-item.active {

    background: #eef5ff;

}


.suggest-code {

    color: #1769c2;

    font-weight: bold;

}


.suggest-name {

    margin-top: 4px;

    color: #777;

    font-size: 14px;

}


/* =========================
   CONTENT
========================= */

.content-grid {

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        260px;

    gap: 20px;

}


.result-card,

.history-card {

    background: white;

    border-radius: 16px;

    padding: 20px;

    box-shadow:
        0 5px 20px
        rgba(0,0,0,0.08);

}


.result-card > h2,

.history-card > h2 {

    margin-top: 0;

    color: #1769c2;

}


/* =========================
   PRODUCT INFO
========================= */

.product-info {

    padding: 20px;

    background: white;

    border-radius: 14px;

    box-shadow:
        0 4px 15px
        rgba(0,0,0,0.08);

}


.product-header h2 {

    margin-top: 0;

    color: #1769c2;

}


.product-code {

    display: inline-block;

    padding: 6px 10px;

    background: #eef5ff;

    color: #1769c2;

    border-radius: 6px;

    font-weight: bold;

}


.product-grid {

    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 12px;

    margin-top: 20px;

}


.item {

    padding: 12px;

    background: #f7f9fc;

    border-radius: 8px;

}


.item b {

    display: block;

    margin-bottom: 5px;

    color: #1769c2;

}


/* =========================
   ACTION BUTTONS
========================= */

.action-buttons {

    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-top: 18px;

}


.action-buttons button {

    padding: 10px 15px;

    border: none;

    border-radius: 8px;

    background: #1769c2;

    color: white;

    cursor: pointer;

    font-weight: bold;

}


.action-buttons button:hover {

    background: #0d47a1;

}


/* =========================
   PRODUCT IMAGE GALLERY
========================= */

.product-gallery {

    width: 100%;

    margin-top: 25px;

    padding: 25px;

    background: white;

    border-radius: 18px;

}


.gallery-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 20px;

}


.gallery-header h3 {

    margin: 0;

    color: #1769c2;

    font-size: 22px;

}


.image-count {

    color: #777;

    font-size: 15px;

}


/* =========================
   MAIN IMAGE
========================= */

.gallery-main {

    position: relative;

    width: 100%;

    height: 600px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #f5f6f8;

    border-radius: 18px;

    overflow: hidden;

}


.main-image-wrapper {

    width: 100%;

    height: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 30px;

}


#galleryMainImage {

    display: block;

    width: auto;

    height: auto;

    max-width: 92%;

    max-height: 540px;

    object-fit: contain;

    border-radius: 16px;

    cursor: zoom-in;

}


#galleryMainImage:hover {

    transform: scale(1.02);

}


/* =========================
   GALLERY ARROWS
========================= */

.gallery-arrow {

    position: absolute;

    top: 50%;

    z-index: 5;

    width: 56px;

    height: 56px;

    transform: translateY(-50%);

    border: none;

    border-radius: 50%;

    background: white;

    color: #1769c2;

    font-size: 30px;

    cursor: pointer;

    box-shadow:
        0 5px 18px
        rgba(0,0,0,0.18);

}


.gallery-arrow:hover {

    background: #1769c2;

    color: white;

}


.gallery-prev {

    left: 20px;

}


.gallery-next {

    right: 20px;

}


/* =========================
   IMAGE NUMBER
========================= */

.image-number {

    position: absolute;

    top: 20px;

    right: 20px;

    padding: 8px 14px;

    border-radius: 20px;

    background: rgba(0,0,0,0.65);

    color: white;

    font-weight: bold;

}


/* =========================
   THUMBNAILS
========================= */

.gallery-thumbnails {

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 20px;

    margin-top: 25px;

    padding: 10px;

    max-height: 290px;

    overflow-y: auto;

}


.gallery-thumbnail {

    width: 100%;

    height: 135px;

    padding: 6px;

    border: 3px solid transparent;

    border-radius: 14px;

    background: white;

    cursor: pointer;

    box-shadow:
        0 3px 12px
        rgba(0,0,0,0.15);

}


.gallery-thumbnail:hover {

    transform: scale(1.03);

}


.gallery-thumbnail.active {

    border-color: #e53935;

    transform: scale(1.04);

}


.gallery-thumbnail img {

    width: 100%;

    height: 100%;

    object-fit: contain;

    border-radius: 10px;

}


/* =========================
   HISTORY
========================= */

.history-card {

    height: fit-content;

}


#historyList {

    max-height: 550px;

    overflow-y: auto;

}


.history-item {

    padding: 10px;

    margin-bottom: 8px;

    border-radius: 8px;

    background: #f7f9fc;

    cursor: pointer;

}


.history-item:hover {

    background: #eef5ff;

}


.clear-history {

    width: 100%;

    margin-top: 15px;

    padding: 10px;

    border: none;

    border-radius: 8px;

    background: #d32f2f;

    color: white;

    cursor: pointer;

}


/* =========================
   EMPTY / NOT FOUND
========================= */

.empty-result,

.not-found {

    padding: 60px 20px;

    text-align: center;

    color: #777;

}


.empty-result i {

    font-size: 40px;

    color: #1769c2;

}


/* =========================
   VIEWER
========================= */

.viewer {

    position: fixed;

    inset: 0;

    z-index: 9999;

    display: none;

    align-items: center;

    justify-content: center;

    padding: 40px;

    background:
        rgba(0,0,0,0.88);

}


#bigImage {

    max-width: 90vw;

    max-height: 90vh;

    object-fit: contain;

    border-radius: 10px;

}


#closeViewer {

    position: absolute;

    top: 25px;

    right: 35px;

    color: white;

    font-size: 36px;

    cursor: pointer;

}


/* =========================
   FOOTER
========================= */

.footer-status {

    display: flex;

    justify-content: center;

    gap: 50px;

    padding: 20px;

    margin-top: 25px;

    background: white;

    border-top: 1px solid #eee;

}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

    .content-grid {

        grid-template-columns: 1fr;

    }

    .history-card {

        order: 2;

    }

}


@media (max-width: 700px) {

    .admin-link {

        top: 10px;

        right: 10px;

        padding: 8px 12px;

    }


    .hero h1 {

        font-size: 22px;

    }


    .status-card {

        flex-direction: column;

        align-items: flex-start;

    }


    .search-input-wrap {

        flex-wrap: wrap;

    }


    #code {

        width: 100%;

        flex-basis: 100%;

    }


    #searchBtn {

        width: 100%;

    }


    .product-grid {

        grid-template-columns: 1fr;

    }


    .gallery-main {

        height: 420px;

    }


    #galleryMainImage {

        max-width: 88%;

        max-height: 360px;

    }


    .gallery-thumbnails {

        grid-template-columns:
            repeat(3, 1fr);

        gap: 12px;

    }


    .gallery-thumbnail {

        height: 100px;

    }


    .footer-status {

        flex-direction: column;

        align-items: center;

        gap: 10px;

    }

}