/* General Styles */
html {
    scroll-behavior: smooth; /* enable smooth scrolling */
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
}

/* Header Styles */
.header {
    background-color: #131921;
    padding: 10px 15px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    #position: fixed;
	position: sticky;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-sizing: border-box;
}



/* Make header children not overflow on narrow screens */
.header * {
    box-sizing: border-box;
    min-width: 0;
}

/* ---- BRAND (logo + manufacturer name) ---- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;                 /* keep desktop spacing like before */
    min-width: 0;
}
.brand a img {              /* AbdouExpress image logo */
    width: 150px;
    height: auto;
}
.brand > h1 {               /* WestNet text logo (inside .brand) */
    margin: 0;
    font-size: 24px;
    line-height: 1;
    flex: 0 0 auto;         /* prevent the h1 from consuming brand's flex space */
}
.manufacturer-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 22ch;        /* keep it tidy next to the logo */
}

/* Old logo rules kept (no harm) */
.header h1 {
    margin: 0;
    font-size: 24px;
    /* no flex here; .brand controls the flex space */
}
.header h1 img {
    width: 150px;
    height: auto;
}
.header > a:first-child {
    display: inline-flex;
    align-items: center;
    flex: 1; /* legacy support if header ever renders as <a> first-child */
}
.header > a:first-child img {
    max-width: 150px;
    height: auto;
}

/* Navigation Styles */
.categories-nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
}
.categories-nav li { margin: 0 10px; }
.categories-nav li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

/* Search Box Styles */
.search-box {
    display: flex;
    align-items: center;
    flex: 2;
    max-width: 300px;
    margin-right: 20px;
}
.search-box form {
    display: flex;
    align-items: center;
    width: 100%;
}
.search-box input[type="text"] {
    flex: 1;
    padding: 8px;
    font-size: 16px;
    border: none;
    border-radius: 4px 0 0 4px;
    color: black;
}
.search-box input[type="submit"] {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
}

/* Login Form Styles */
.login-form {
    display: flex;
    align-items: center;
    margin-left: 20px;
}
.login-form input[type="text"],
.login-form input[type="password"] {
    padding: 8px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    color: black;
    margin-right: 10px;
}
.login-form input[type="submit"],
.login-form a.logout-btn {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
}

/* Create Account Button Styling */
.create-account-btn {
    display: inline-block;
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
}
.create-account-btn:hover { background-color: #0056b3; }

/* Cart Icon Styles */
.cart-icon {
    margin-right: 20px;
    position: relative;
}
.cart-icon img {
    width: 30px;
    height: auto;
}
#cart-item-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: red;
    color: white;
    border-radius: 50%;
    padding: 5px 10px;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
}

/* Dropdown Form Styles */
.header .form-group {
    margin-left: 20px;
    position: relative;
}
.header select.form-control {
    padding: 8px;
    font-size: 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    appearance: none;
}

/* --------- MOBILE HEADER ONLY (desktop unchanged) --------- */
@media (max-width: 768px) {
    body { padding-top: 0; } /* sticky header reserves space */
    .header {
        position: sticky;
        top: 0;
        padding: 6px 10px;
        gap: 8px;
        justify-content: flex-start;
    }

    /* Order rows: 1) Brand+Cart  2) Search  3) Login  4) Category */
    .brand {
        order: 1;
        flex: 1 1 auto;
        gap: 6px;
    }
    .brand a img { width: 110px; }  /* smaller mobile logo */
    .brand > h1 { font-size: 16px; }
    .manufacturer-name {
        font-size: 12.5px;
        max-width: 40vw;           /* room-aware, truncates nicely */
        opacity: 0.95;
    }

    .cart-icon {
        order: 2;
        margin: 0 0 0 auto;
        display: flex;
        align-items: center;
        flex: 0 0 auto;
    }
    .cart-icon img { width: 25px; }
    #cart-item-count {
        top: -6px;
        right: -6px;
        padding: 3px 6px;
        font-size: 12px;
    }

    .search-box {
        order: 3;
        width: 100%;
        max-width: none;
        margin: 0;
        flex: 1 1 100%;
    }
    .search-box input[type="text"],
    .search-box input[type="submit"] { font-size: 14px; }

    .login-form {
        order: 4;
        flex: 1 1 100%;
        margin: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .login-form input[type="text"],
    .login-form input[type="password"] {
        font-size: 14px;
        width: calc(50% - 3px);
        margin: 0;
        min-width: 140px;
    }
    .login-form input[type="submit"],
    .create-account-btn {
        font-size: 14px;
        width: calc(50% - 3px);
        margin: 0;
    }

    .header .form-group {
        order: 5;
        flex: 1 1 100%;
        margin: 0;
        width: 100%;
    }
    .header .form-group .form-control {
        width: 100%;
        font-size: 14px;
    }
}

/* Product Container Styles */
.product-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    justify-content: center;
    padding-top: 50px;
}

.product {
    background-color: #fff;
    border-radius: 1px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: black;
}
.product:hover { transform: scale(1.05); }
.product img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}
.product-details { text-align: center; padding: 10px; }
.product-details h3 { margin-top: 0; font-size: 1.2rem; }
.product-details p  { margin-bottom: 10px; }

/* Add to Cart Button Styles */
.add-to-cart-button {
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    margin-top: 5px;
}
.add-to-cart-button:hover { background-color: #0056b3; }

/* Recent Products Styles */
.recent-products {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}
.recent-product { position: relative; max-width: 300px; }
.recent-product img { width: 100%; border-radius: 8px; }

.product-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}
.recent-product:hover .product-overlay { opacity: 1; }

/* Error message styling for login */
.error {
    color: #ff9797;
    background-color: #500;
    padding: 5px;
    border-radius: 4px;
    margin-top: 5px;
}
