:root {
    --primary-color: #000000;
    --secondary-color: #ffffff;
    --accent-color: #add8e6;
    --text-color: #333333;
    --light-text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--primary-color);
    color: var(--light-text);
    text-align: center;
    position: relative;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    height: 102px;
}

.content-wrapper {
    margin-top: 0;
}

.contact-info {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.contact-info a {
    color: #FFF;
}

.search-container {
    padding: 1rem 1rem 0.5rem 1rem;
    background-color: var(--accent-color);
    position: relative;
    z-index: 90;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#search {
    width: 100%;
    padding: 0.7rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
}

.category-toggle {
    display: none;
}

.category-filter {
    display: flex;
    overflow-x: auto;
    padding: 0.5rem 0 0 0.5rem;
    gap: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: wrap;
    max-height: none;
    transition: none;
    justify-content: center;
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.category-btn {
    background-color: var(--primary-color);
    color: var(--light-text);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.category-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.category-btn.active {
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-weight: bold;
}

.inventory-container {
    padding: 1rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.product-card {
    background-color: var(--secondary-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    border: 1px solid #eee;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-image {
    width: 100%;
    object-fit: contain;
    background-color: #f8f8f8;
}

.product-info {
    padding: 0rem 0.8rem 0.8rem 0.8rem;
}

.product-name {
    font-weight: bold;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.product-details {
    font-size: 0.8rem;
    color: #666;
}

.product-details p {
    display: none;
}

.product-price {
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 0.3rem;
    font-size: 1.1rem;
}

.product-card .in-stock {
    color: #2e8b57;
    font-size: 0.8rem;
}

.product-card .low-stock {
    color: #ff8c00;
    font-size: 0.8rem;
}

.product-card .out-of-stock {
    color: #dc3545;
    font-size: 0.8rem;
}

footer {
    background-color: var(--primary-color);
    color: var(--light-text);
    text-align: center;
    padding: 1rem;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .category-filter {
        justify-content: center;
    }
    
    .category-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    .category-filter {
        justify-content: center;
    }
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .category-filter {
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* Loading spinner styles */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: #666;
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

.results-count {
    margin-top: 20px;
    color: #666;
    font-size: 0.9em;
    text-align: center;
    width: 100%;
    padding: 10px;
    border-top: 1px solid #eee;
}

.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: none;
    font-size: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-to-top:hover {
    background-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.scroll-to-top.visible {
    display: block;
}

/* Print styles */
@media print {
    /* Add page margins */
    @page {
        margin: 0.5in;
    }

    /* Hide unnecessary elements */
    .search-container,
    .category-filter,
    #scrollToTop,
    .product-image,
    .loading-container,
    .loading-spinner,
    .loading-text,
    .results-count {
        display: none !important;
    }

    /* Reset body and container styles for print */
    body {
        margin: 0;
        padding: 0px;
        font-size: 12px;
        background: white;
        font-family: Arial, sans-serif;
    }

    .content-wrapper {
        padding: 0;
        margin: 0;
    }

    header {
        height: auto !important;
    }

    /* Style the header for print */
    #site-header {
        text-align: center;
        background-color: #FFF !important;
        box-shadow: none !important;
    }

    #site-header h1 {
        margin: 0;
        font-size: 24px;
        font-weight: bold;
        color: #000;
    }

    .contact-info {
        font-size: 1rem;
        margin-top: 5px;
        color: #000 !important;
    }

    .contact-info a {
        text-decoration: none;
        color: black;
    }

    .content-wrapper::before {
        content: 'อัพเดทเว็บไซต์สต๊อกสินค้า / Updated Inventory Website: https://sabaisabaishop.com';
        display: block;
        width: fit-content;
        margin: 5px auto;
        font-size: 1rem;
    }

    /* Transform grid to table */
    .inventory-container {
        width: 800px;
        margin: 0 auto;
        padding: 0 !important;
        display: table;
    }

    .product-grid {
        display: table-row-group;
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 1.5in; /* Space for footer */
    }

    /* Add table headers */
    .product-grid::before {
        content: 'ชื่อสินค้า / Item Name\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0SKU\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0\a0ราคา / Price\a0\a0\a0\a0ปริมาณ / Quantity\a0\a0\a0ราคาทั้งหมด / Total Price';
        display: block;
        font-weight: bold;
        padding: 8px;
        border: 1px solid #000;
        margin-bottom: -1px;
        white-space: pre;
        font-family: monospace;
    }

    /* Style product cards as table rows */
    .product-card {
        display: flex !important;
        border-radius: 0 !important;
        border: 1px solid #000;
        page-break-inside: avoid;
        margin-bottom: -1px;
    }

    /* Style product info as cells */
    .product-info {
        display: flex !important;
        width: 800px;
        padding: 0;
    }

    .product-name {
        width: 320px;
        border-right: 1px solid #000;
        flex-shrink: 0;
        padding: 0 0 0 10px;
        font-weight: normal;
    }

    .product-details {
        width: 100px;
        padding: 8px;
        border-right: 1px solid #000;
        flex-shrink: 0;
    }

    .product-price {
        width: 120px;
        border-right: 1px solid #000;
        text-align: right;
        flex-shrink: 0;
        padding: 0 10px 0 0;
        font-weight: normal;
        font-size: 1rem;
    }

    /* Add empty cells for Quantity and Total Price */
    .product-info::after {
        content: '';
        width: 130px;
        border-right: 1px solid #000;
        flex-shrink: 0;
    }

    .product-info::before {
        content: '';
        width: 0 !important;
        padding: 0 !important;
        flex-shrink: 0;
    }

    /* Hide stock status */
    .in-stock, .out-of-stock {
        display: none !important;
    }

    /* Hide default footer */
    footer {
        display: none !important;
    }

    /* Remove any previous footer styles */
    .inventory-container::after {
        display: none !important;
    }

    /* Add print footer */
    .print-footer {
        position: fixed;
        left: 0.5in;
        right: 0.5in;
        border-top: 2px solid #000;
        padding-top: 8px;
        background: white;
    }

    .print-footer-content {
        display: flex;
        justify-content: space-between;
        font-family: monospace;
        font-weight: bold;
    }
}

/* Popup styles */
#popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.popup-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-popup {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    color: #666;
}

.close-popup:hover {
    color: #000;
}

.popup-body {
    line-height: 1.6;
}

.popup-body p {
    margin-bottom: 1em;
}

/* Make clickable images show pointer cursor */
.product-image.clickable {
    cursor: pointer;
}

.product-image.clickable:hover {
    opacity: 0.9;
}

/* Pagination controls */
.pagination-controls {
    margin: 20px 0;
    text-align: center;
    width: 100%;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.pagination-btn {
    background-color: var(--primary-color);
    color: var(--light-text);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Hide pagination in print */
@media print {
    .pagination-controls {
        display: none !important;
    }
} 