:root {
    --primary-bg: #f4f4f9;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --accent-color: #3498db;
    --nav-hover-bg: #ecf0f1;
    --shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.dark-mode {
    --primary-bg: #121212;
    --header-bg: #1f1f1f;
    --card-bg: #282828;
    --text-color: #f0f0f0; /* Slightly brighter text for contrast */
    --accent-color: #e94560;
    --nav-hover-bg: #333333;
    --shadow: 0 5px 15px rgba(0,0,0,0.5);
}
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--primary-bg);
    color: var(--text-color);
}
body.nav-open { overflow: hidden; }
header {
    background-color: var(--header-bg);
    padding: 0 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 100;
}
header h1 { margin: 0; font-size: 1.8em; font-family: 'Pacifico', cursive; }

.dark-mode header h1 {
    color: #d43f3f; /* Slightly darker red */
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between theme toggle and hamburger */
}

#theme-toggle {
    width: 30px;
    height: 30px;
    border: 1px solid var(--text-color);
    cursor: pointer;
    border-radius: 4px;
    transition: border-color 0.3s ease, background 0.3s ease; /* Add background to transition */
    margin-left: 15px;
    color: transparent;
    font-size: 0;
    line-height: 0;
    padding: 0;

    /* Light mode: White top-left, black bottom-right (suggests switching to dark) */
    background: linear-gradient(to top right, #ffffff 50%, #000000 50%);
}

/* Dark mode: Black top-left, white bottom-right (suggests switching to light) */
.dark-mode #theme-toggle {
    border-color: var(--text-color);
    background: linear-gradient(to top right, #000000 50%, #ffffff 50%);
}

 

 



/* Desktop Navigation */
#main-nav { display: flex; height: 100%; justify-content: space-between; align-items: center; }
.nav-menu { list-style: none; margin: 0; padding: 0; display: flex; height: 100%; }
.nav-menu > li { position: relative; height: 100%; }
.nav-menu > li > a {
    display: flex; align-items: center; height: 100%; padding: 0 15px;
    text-decoration: none; color: var(--text-color); font-weight: 500; transition: background-color 0.3s ease;
}
.nav-menu > li:hover > a { background-color: var(--nav-hover-bg); }
.dropdown-content {
    visibility: hidden; opacity: 0; position: absolute; left: 0; top: 100%;
    background-color: var(--header-bg); min-width: 250px; box-shadow: var(--shadow);
    padding: 20px; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
    z-index: 100; display: flex; flex-direction: row; gap: 20px;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    /* Fixes for Overflow */
    max-width: calc(100vw - 40px);
    flex-wrap: wrap;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
/* Fix for right-aligned dropdowns going off-screen */
.nav-menu > li:nth-last-child(-n+3) .dropdown-content { left: auto; right: 0; }

.has-dropdown:hover .dropdown-content { visibility: visible; opacity: 1; transition-delay: 0s; }
.dropdown-column h6 a { text-decoration: none; color: var(--accent-color); }
.dropdown-column h6 { margin: 0 0 10px 0; font-size: 0.9em; text-transform: uppercase; letter-spacing: 1px; }
.dropdown-column ul { list-style: none; padding: 0; margin: 0; }
.dropdown-column ul li a { display: block; padding: 8px 12px; text-decoration: none; color: var(--text-color); border-radius: 4px; transition: background-color 0.3s ease; }
.dropdown-column ul li a:hover { background-color: var(--nav-hover-bg); }

.category-link.active-category {
    font-weight: 700;
    background-color: #dde1e2;
}

.dark-mode .category-link.active-category {
    background-color: var(--nav-hover-bg); /* Use dark mode nav hover background */
    color: var(--accent-color); /* Make text red for visibility */
}

/* Mobile Navigation */
#mobile-menu-toggle, #mobile-menu-close { display: none; background: none; border: none; font-size: 2em; cursor: pointer; }

/* Main Content */
main { padding: 20px; max-width: 1600px; margin: 0 auto; }
.initial-message { text-align: center; font-size: 1.2em; color: var(--text-color); padding: 40px; }
#product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.product-card { background-color: var(--card-bg); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 12px 20px rgba(0,0,0,0.12); }
.product-card img { width: 100%; height: 200px; object-fit: cover; display: block; }
.product-card .product-name { padding: 15px; margin: 0; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#pagination-controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 40px; padding-bottom: 20px; }
.page-btn { padding: 10px 15px; border: 1px solid var(--accent-color); background: transparent; color: var(--accent-color); cursor: pointer; border-radius: 4px; }
.page-btn.active, .page-btn:hover { background: var(--accent-color); color: white; }
.page-btn.disabled { background: var(--nav-hover-bg); color: var(--text-color); border-color: var(--nav-hover-bg); cursor: not-allowed; }

/* Modal Styles */
#modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); display: none; justify-content: center; align-items: center; z-index: 1000; }
#modal-content { background-color: var(--card-bg); padding: 20px; border-radius: 10px; display: flex; flex-direction: column; gap: 20px; width: 90%; max-width: 800px; max-height: 90vh; position: relative; }
#modal-close { position: absolute; top: 10px; right: 20px; font-size: 30px; font-weight: bold; cursor: pointer; }
#modal-gallery { display: flex; flex-direction: column; gap: 10px; }
#modal-main-image { width: 100%; height: auto; max-height: 60vh; object-fit: contain; border-radius: 5px; }
#modal-thumbnails { display: flex; gap: 10px; flex-wrap: wrap; overflow-y: auto; max-height: 100px; justify-content: center; }
#modal-thumbnails img { width: 60px; height: 60px; object-fit: cover; cursor: pointer; border-radius: 5px; opacity: 0.6; transition: opacity 0.3s ease; border: 2px solid transparent; }
#modal-thumbnails img:hover, #modal-thumbnails img.active { opacity: 1; border-color: var(--accent-color); }
#modal-info { text-align: center; }
#modal-title { margin: 10px 0 5px 0; }
#modal-id { font-family: monospace; background: var(--nav-hover-bg); color: var(--text-color); padding: 5px; border-radius: 4px; display: inline-block; }

/* Responsive Media Queries */
@media (max-width: 1200px) {
    header { padding: 0 15px; }
    #main-nav {
        position: fixed; top: 0; left: 0; width: 300px;
        background: var(--header-bg); box-shadow: 5px 0 15px rgba(0,0,0,0.1);
        transform: translateX(-100%); transition: transform 0.4s ease;
        flex-direction: column; height: 100%; overflow-y: auto; 
        padding-top: 60px; /* Pushes content below close button */
        box-sizing: border-box;
    }
    body.nav-open #main-nav { transform: translateX(0); }
    .nav-menu { flex-direction: column; height: auto; }
    .nav-menu > li { height: auto; border-bottom: 1px solid #eee; }
    .nav-menu > li > a { height: 60px; justify-content: space-between; }
    .nav-menu > li > a::after { content: '+'; font-size: 1.5em; }
    .has-dropdown.open > a::after { content: '−'; }
    .has-dropdown .dropdown-content { 
        display: none; position: static; box-shadow: none; 
        padding: 0 0 0 20px; min-width: unset; background: var(--nav-hover-bg);
        flex-direction: column;
        visibility: visible;
        opacity: 1;
    }
    .has-dropdown.open .dropdown-content { display: block; }
    .dropdown-column { margin-bottom: 0; padding: 10px 0; flex-basis: 100%; }
    #mobile-menu-toggle { display: block; }
    #mobile-menu-close { display: block; position: absolute; top: 10px; right: 15px; font-size: 2.5em; }
    #product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
    main { padding: 15px; }
    #modal-content { flex-direction: column; width: 95%; max-height: 95vh; }
    #modal-gallery, #modal-info { width: 100%; padding-left: 0; }
}

/* Footer Signature */
footer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: #95a5a6;
    font-size: 0.85em;
    z-index: 999;
}
footer p {
    margin: 0;
    font-style: italic;
}