body {
    margin: 0;
    font-family: Arial, sans-serif;
}
body.dark-mode {
    background-color: #121212;
    color: #ffffff;
}
.button-container .fa-shopping-cart {
    color: #ffffff;
    margin-right: 6px;
}
.button-container .fa-fire {
    color: #ff4500;
    filter: drop-shadow(0 0 3px #ffd700);
    margin-right: 6px;
}
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.4s ease;
}
#loading-bar-container {
    width: 60%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-top: 15px;
    overflow: hidden;
}
#loading-bar {
    width: 0;
    height: 100%;
    background: #007bff;
    transition: width 0.3s ease;
}
#theme-toggle {
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border-radius: 4px;
    margin: 15px auto;
    display: block;
    transition: background-color 0.3s ease;
}
#theme-toggle:hover {
    background-color: #45a049;
}
.search-container {
    width: 90%;
    max-width: 800px;
    margin: 15px auto;
    position: relative;
}
.search-container input[type="text"] {
    width: 100%;
    padding: 10px 35px 10px 15px;
    font-size: 14px;
    border: 2px solid #ccc;
    border-radius: 25px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}
.search-container input[type="text"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 6px rgba(0, 123, 255, 0.3);
    outline: none;
}
.search-close-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #999;
    display: none;
    padding: 0;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    z-index: 2;
}
.search-close-btn:hover {
    color: #333;
}
body.dark-mode .search-close-btn {
    color: #aaa;
}
body.dark-mode .search-close-btn:hover {
    color: #fff;
}
.products-container {
    display: grid;
    gap: 15px;
    margin: 12px auto;
    max-width: 1600px;
    width: calc(100% - 24px);
    padding: 0;
    justify-items: center;
    align-items: start;
}
.category-section {
    margin: 40px 12px;
    width: calc(100% - 24px);
    max-width: 1600px;
}
.product {
    border: 2px solid maroon;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 200px;
    height: auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}
body.dark-mode .product {
    background: #1e1e1e;
    border-color: #800000;
}
.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.product-image-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
    min-height: 100px;
    max-height: 200px;
}
.product-image-container a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-image-container img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 4px;
    display: block;
    transition: opacity 0.4s ease;
}
.product-image-container .primary-image {
    position: relative;
    z-index: 1;
}
.product-image-container .secondary-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.4s ease;
    pointer-events: none;
    object-fit: contain;
    object-position: center;
}
.product-image-container.has-secondary:hover .primary-image {
    opacity: 0;
}
.product-image-container.has-secondary:hover .secondary-image {
    opacity: 1;
}
.product-details {
    flex-grow: 1;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: auto;
}
.product h2 {
    font-size: 13px;
    color: #333;
    margin: 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.6em;
}
body.dark-mode .product h2 {
    color: #eee;
}
.product h2 a {
    color: inherit;
    text-decoration: none;
}
.product h2 a:hover {
    text-decoration: underline;
}
.product p {
    font-size: 13px;
    color: #555;
    margin: 0;
    font-weight: bold;
}
body.dark-mode .product p {
    color: #bbb;
}
.category-tag {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    font-size: 0.65rem;
    padding: 2px 10px;
    border-radius: 12px;
    margin: 2px 0 5px 0;
}

/* Badge - Bottom Left Corner of Image */
.badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 5;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    margin: 0;
    display: inline-block;
}
.out-of-stock {
    background-color: #e74c3c;
}
.to-be-shipped {
    background-color: #f39c12;
}
.in-stock {
    background-color: #2ecc71;
}

/* Hide badge in product details area since it's now on the image */
.product-details .badge {
    display: none;
}

.button-container {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
}
.button-container input[type="number"] {
    width: 45px;
    padding: 6px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #ccc;
    text-align: center;
}
body.dark-mode .button-container input[type="number"] {
    background: #333;
    color: #fff;
    border-color: #555;
}
.button-container button {
    flex: 1;
    padding: 6px;
    font-size: 11px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.button-container button:first-child {
    background-color: #007bff;
    color: white;
}
.button-container button:last-child {
    background-color: #28a745;
    color: white;
}
.button-container button:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
.button-container button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}
.category-header {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    margin: 0 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
    grid-column: 1 / -1;
    text-align: center;
}
body.dark-mode .category-header {
    color: #eee;
    border-bottom-color: #28a745;
}
#recently-viewed,
#recommended-products {
    margin: 40px 15px;
    grid-column: 1 / -1;
}
#recently-viewed h3,
#recommended-products h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #333;
    padding-bottom: 4px;
    border-bottom: 1px solid #ddd;
}
body.dark-mode #recently-viewed h3,
body.dark-mode #recommended-products h3 {
    color: #eee;
    border-bottom-color: #444;
}
#recommended-products {
    display: none;
}
.no-results-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 15px;
    font-size: 16px;
    color: #666;
    display: none;
}
body.dark-mode .no-results-message {
    color: #aaa;
}
.custom-alert {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: #e6f3ff;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10000;
    max-width: 90%;
    width: 260px;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: fadeInOut 3s ease-in-out forwards;
    pointer-events: none;
}
.custom-alert.show {
    opacity: 1;
}
.custom-alert-content {
    padding: 8px 12px;
    display: flex;
    justify-content: center;
    text-align: center;
}
.custom-alert-content p {
    margin: 0;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.dark-mode .custom-alert {
    background: #4a6b8a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
body.dark-mode .custom-alert-content p {
    color: #e6e6e6;
}
.custom-alert-success {
    border-left: 3px solid #28a745;
}
.custom-alert-error {
    border-left: 3px solid #e74c3c;
}
.custom-alert-warning {
    border-left: 3px solid #f39c12;
}
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-5px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-5px); }
}
.product-detail-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
body.dark-mode .product-detail-container {
    background: #1e1e1e;
    border-color: #333;
}

/* ============================================================
   WHATSAPP ICON - TOP RIGHT CORNER OF PRODUCT IMAGE
   ============================================================ */
.whatsapp-float {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: #25D366;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
    pointer-events: auto;
    cursor: pointer;
    line-height: 1;
    opacity: 0.95;
}

.whatsapp-float:hover {
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.5);
    color: #ffffff;
    background: #20b85a;
}

.whatsapp-float i {
    color: #ffffff;
    font-size: 18px;
}

body.dark-mode .whatsapp-float {
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   RESPONSIVE STYLES
   ============================================================ */
@media screen and (min-width: 1401px) {
    .products-container {
        grid-template-columns: repeat(7, 1fr);
        gap: 18px;
    }
    .product {
        max-width: 200px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 120px;
    }
}
@media screen and (min-width: 1201px) and (max-width: 1400px) {
    .products-container {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
    .product {
        max-width: 200px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 120px;
    }
}
@media screen and (min-width: 901px) and (max-width: 1200px) {
    .products-container {
        grid-template-columns: repeat(5, 1fr);
        gap: 15px;
    }
    .product {
        max-width: 200px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 120px;
    }
}
@media screen and (min-width: 769px) and (max-width: 900px) {
    .products-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
    .product {
        max-width: 200px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 120px;
    }
}
@media screen and (min-width: 601px) and (max-width: 768px) {
    .products-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
    .product {
        max-width: 200px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 120px;
    }
    .product h2 {
        font-size: 13px;
    }
}
@media screen and (min-width: 401px) and (max-width: 600px) {
    .category-section {
        margin: 30px 10px;
        width: calc(100% - 20px);
    }
    .products-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        width: 100%;
        margin: 0 auto;
    }
    .product {
        padding: 8px;
        max-width: 200px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 100px;
    }
    .product h2 {
        font-size: 12px;
        -webkit-line-clamp: 3;
        min-height: 3.9em;
    }
    .product p {
        font-size: 12px;
    }
    .button-container input[type="number"] {
        width: 40px;
        padding: 5px;
        font-size: 12px;
    }
    .button-container button {
        padding: 5px;
        font-size: 10px;
    }
    .search-container {
        width: 95%;
        margin: 12px auto;
    }
    .search-container input[type="text"] {
        padding: 8px 30px 8px 12px;
        font-size: 13px;
    }
    .search-close-btn {
        font-size: 14px;
        right: 8px;
        width: 14px;
        height: 14px;
        line-height: 14px;
    }
    .category-header {
        font-size: 20px;
        margin: 0 0 12px;
        padding-bottom: 6px;
    }
    #recently-viewed,
    #recommended-products {
        margin: 30px 12px;
    }
    .no-results-message {
        font-size: 14px;
        padding: 12px;
    }
    .badge {
        font-size: 9px;
        padding: 3px 7px;
        bottom: 6px;
        left: 6px;
    }
    .custom-alert {
        width: 240px;
    }
    .custom-alert-content p {
        font-size: 12px;
    }
    .whatsapp-float {
        width: 28px;
        height: 28px;
        font-size: 15px;
        top: 6px;
        right: 6px;
    }
    .whatsapp-float i {
        font-size: 15px;
    }
}
@media screen and (min-width: 321px) and (max-width: 400px) {
    .category-section {
        margin: 25px 8px;
        width: calc(100% - 16px);
    }
    .products-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        width: 100%;
        margin: 0 auto;
    }
    .product {
        padding: 6px;
        max-width: 200px;
        border-width: 2px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 90px;
    }
    .product h2 {
        font-size: 11px;
        -webkit-line-clamp: 3;
        min-height: 4.2em;
    }
    .product p {
        font-size: 11px;
    }
    .button-container input[type="number"] {
        width: 35px;
        padding: 4px;
        font-size: 11px;
    }
    .button-container button {
        padding: 4px;
        font-size: 9px;
    }
    .search-container {
        width: 98%;
        margin: 10px auto;
    }
    .search-container input[type="text"] {
        padding: 6px 25px 6px 10px;
        font-size: 12px;
    }
    .search-close-btn {
        font-size: 12px;
        right: 6px;
        width: 12px;
        height: 12px;
        line-height: 12px;
    }
    .category-header {
        font-size: 18px;
        margin: 0 0 10px;
        padding-bottom: 5px;
    }
    #recently-viewed,
    #recommended-products {
        margin: 25px 10px;
    }
    #recently-viewed h3,
    #recommended-products h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    .no-results-message {
        font-size: 13px;
        padding: 10px;
    }
    .badge {
        font-size: 8px;
        padding: 2px 6px;
        bottom: 5px;
        left: 5px;
    }
    .custom-alert {
        width: 200px;
    }
    .custom-alert-content p {
        font-size: 11px;
    }
    #loading-bar-container {
        width: 80%;
        height: 6px;
        margin-top: 8px;
    }
    #theme-toggle {
        padding: 5px 10px;
        font-size: 12px;
        margin: 10px auto;
    }
    .whatsapp-float {
        width: 24px;
        height: 24px;
        font-size: 13px;
        top: 5px;
        right: 5px;
        border-width: 1.5px;
    }
    .whatsapp-float i {
        font-size: 13px;
    }
}
@media screen and (min-width: 251px) and (max-width: 320px) {
    .category-section {
        margin: 20px 6px;
        width: calc(100% - 12px);
    }
    .products-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        width: 100%;
        margin: 0 auto;
    }
    .product {
        padding: 5px;
        max-width: 200px;
        border-width: 1.5px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 80px;
    }
    .product h2 {
        font-size: 10px;
        -webkit-line-clamp: 2;
        min-height: 2.6em;
    }
    .product p {
        font-size: 10px;
    }
    .button-container input[type="number"] {
        width: 30px;
        padding: 3px;
        font-size: 9px;
    }
    .button-container button {
        padding: 3px;
        font-size: 8px;
    }
    .search-container input[type="text"] {
        font-size: 11px;
        padding: 5px 20px 5px 8px;
    }
    .search-close-btn {
        font-size: 10px;
        width: 10px;
        height: 10px;
        line-height: 10px;
        right: 5px;
    }
    .category-header {
        font-size: 16px;
        margin: 0 0 8px;
        padding-bottom: 4px;
    }
    #recently-viewed h3,
    #recommended-products h3 {
        font-size: 13px;
    }
    .badge {
        font-size: 7px;
        padding: 2px 5px;
        bottom: 4px;
        left: 4px;
    }
    .custom-alert {
        width: 180px;
    }
    .custom-alert-content p {
        font-size: 10px;
    }
    .whatsapp-float {
        width: 22px;
        height: 22px;
        font-size: 12px;
        top: 4px;
        right: 4px;
        border-width: 1px;
    }
    .whatsapp-float i {
        font-size: 12px;
    }
}
@media screen and (max-width: 250px) {
    .category-section {
        margin: 15px 4px;
        width: calc(100% - 8px);
    }
    .products-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        width: 100%;
        margin: 0 auto;
    }
    .product {
        padding: 4px;
        max-width: 200px;
        border-width: 1px;
    }
    .product-image-container {
        max-height: 200px;
        min-height: 70px;
    }
    .product h2 {
        font-size: 8px;
        -webkit-line-clamp: 2;
        min-height: 2.2em;
    }
    .product p {
        font-size: 8px;
    }
    .category-tag {
        font-size: 0.5rem;
        padding: 1px 6px;
    }
    .badge {
        font-size: 6px;
        padding: 1px 4px;
        bottom: 3px;
        left: 3px;
    }
    .button-container {
        gap: 3px;
        padding-top: 4px;
    }
    .button-container input[type="number"] {
        width: 24px;
        padding: 2px;
        font-size: 8px;
    }
    .button-container button {
        padding: 2px;
        font-size: 7px;
    }
    .search-container input[type="text"] {
        font-size: 10px;
        padding: 4px 18px 4px 6px;
        border-radius: 20px;
    }
    .search-close-btn {
        font-size: 8px;
        width: 8px;
        height: 8px;
        line-height: 8px;
        right: 4px;
    }
    .category-header {
        font-size: 14px;
        margin: 0 0 6px;
        padding-bottom: 3px;
    }
    #recently-viewed h3,
    #recommended-products h3 {
        font-size: 11px;
        margin-bottom: 5px;
    }
    .no-results-message {
        font-size: 11px;
        padding: 8px;
    }
    .custom-alert {
        width: 150px;
    }
    .custom-alert-content p {
        font-size: 9px;
    }
    #loading-bar-container {
        width: 90%;
        height: 4px;
        margin-top: 5px;
    }
    #theme-toggle {
        padding: 4px 8px;
        font-size: 10px;
        margin: 8px auto;
    }
    .product-detail-container {
        padding: 10px;
        margin: 15px auto;
    }
    .whatsapp-float {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: 3px;
        right: 3px;
        border-width: 1px;
    }
    .whatsapp-float i {
        font-size: 10px;
    }
}
