/* General resets and typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Colour palette definitions for a warm, inviting LED aesthetic.  Modify these variables to adjust the overall look of the website. */
:root {
    --primary-color: #ff8c00;
    --primary-hover: #e67a00;
    --secondary-color: #0a192f;
    --background-color: #fff8f1;
    --card-background: #ffffff;
    --text-color: #333333;
    --muted-text: #666666;
}

/* Dark theme variables. When the root element has data-theme="dark" this
   section overrides the default colours. */
[data-theme="dark"] {
    --primary-color: #ffae00;
    --primary-hover: #d27f00;
    --secondary-color: #050c17;
    --background-color: #0a192f;
    --card-background: #11294f;
    --text-color: #f0f0f0;
    --muted-text: #b5b5b5;
}

/* Theme toggle button in the navigation bar */
.theme-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    /* Push the toggle to the far right within the nav’s flex container */
    margin-left: auto;
}

/* Admin authentication overlay */
#admin-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-box {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-width: 320px;
    width: 100%;
}
.auth-box h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-align: center;
}
.auth-box input[type="password"] {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.auth-box button {
    width: 100%;
    padding: 0.6rem;
    border: none;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}
.auth-box button:hover {
    background-color: var(--primary-hover);
}
.auth-box #auth-error {
    color: red;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    display: none;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--background-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    scroll-behavior: smooth;
}

/* Navigation */
header {
    background: var(--card-background);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    align-items: center;
    /* Remove space-between so items don't spread across the entire width */
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    gap: 1rem;
}

nav .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

nav .nav-links {
    list-style: none;
    display: flex;
    gap: 1rem;
    /* Push the links to the right of the logo/menu button */
    margin-left: 2rem;
}

nav .nav-links li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s ease;
}

nav .nav-links li a:hover {
    color: var(--primary-color);
}

/* Hamburger menu button shown on small screens */
.menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    nav .nav-links {
        display: none;
    }
    .menu-btn {
        display: block;
    }
}

/* Hero section */
.hero {
    background-image: linear-gradient(rgba(10, 25, 47, 0.6), rgba(255, 140, 0, 0.6)), url('images/hero.jpg');
    background-size: cover;
    background-position: center;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 0 1rem;
}

.hero h1 {
    font-size: 2.7rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.15rem;
    max-width: 700px;
    margin: 0 auto 2rem auto;
}

.hero .cta {
    background: var(--primary-color);
    color: #fff;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
}

.hero .cta:hover {
    background: var(--primary-hover);
}

/* Features section */
.features {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature {
    background: var(--card-background);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.feature h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--muted-text);
}

/* Category cards on home */
.categories {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.category-card {
    background: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.category-card .card-body {
    padding: 1rem;
}

.category-card h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.category-card p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--muted-text);
}

.category-card a {
    align-self: flex-start;
    text-decoration: none;
    background: var(--primary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.category-card a:hover {
    background: var(--primary-hover);
}

/* Product pages */
.products {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-card .product-body {
    padding: 1rem;
}

.product-card h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.product-card p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--muted-text);
}

.product-card .price {
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
}

.product-card .btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.product-card .btn:hover {
    background: var(--primary-hover);
}

/* About section */
.about {
    max-width: 1000px;
    margin: 0 auto 3rem auto;
    padding: 0 1rem;
    text-align: center;
}

.about h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.about p {
    font-size: 1rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    color: var(--muted-text);
}

/* Footer */
footer {
    background: var(--secondary-color);
    color: #ffffff;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
}

footer p {
    font-size: 0.9rem;
}

/* Cart page */
.cart-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 80px 1fr 100px;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.cart-item-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-details h5 {
    margin-bottom: 0.3rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.cart-item-details p {
    color: var(--muted-text);
    font-size: 0.8rem;
}

.quantity-input {
    width: 60px;
    padding: 0.3rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

.cart-item-total {
    font-weight: bold;
}

.cart-item-remove .btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.cart-item-remove .btn:hover {
    background: var(--primary-hover);
}

.cart-summary-list {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.cart-summary-list .summary-row,
.cart-summary-list .summary-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.cart-summary-list .summary-total {
    font-weight: bold;
    margin-top: 1rem;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
}

.suggestion-card {
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.suggestion-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.suggestion-card h5 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.suggestion-card p {
    font-size: 0.8rem;
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}

.suggestion-card .price {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.suggestion-card .btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.suggestion-card .btn:hover {
    background: var(--primary-hover);
}

/* Checkout page */
.checkout-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

.checkout-item-name {
    color: var(--primary-color);
}

.checkout-item-total {
    font-weight: bold;
}

.shipping-options {
    background: var(--card-background);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.shipping-options label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.shipping-options input[type="radio"] {
    margin-right: 0.5rem;
}

.checkout-summary {
    background: var(--card-background);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.checkout-summary .summary-row,
.checkout-summary .summary-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.checkout-summary .summary-total {
    font-weight: bold;
    margin-top: 1rem;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
}

#confirm-order-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

#confirm-order-btn:hover {
    background: var(--primary-hover);
}

/* Loading screen overlay */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.4s ease;
}

#loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Fade‑in animation classes */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}

/* Overlay menu styling */
#menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 47, 0.95);
    color: #ffffff;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1500;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

#menu-overlay.open {
    transform: translateX(0);
}

#menu-overlay ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#menu-overlay li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

#menu-overlay li a:hover {
    color: var(--primary-color);
}

#close-menu {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    align-self: flex-end;
    cursor: pointer;
}