/* General Mobile Header Styling */
.mobile-header {
    display: none; /* Default: hidden for larger screens */
    flex-direction: column;
    background-color: #232F3E; /* Amazon-like dark color */
    color: white;
    width: 100%;
    z-index: 1000;
    position: sticky;
    top: 0;
    left: 0;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0;
}

/* Top Bar */
.mobile-header .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 15px;
    background-color: #131A22; /* Darker background for top bar */
}

/* Dropdown Menu */
.menu-toggle-container {
    position: relative;
}

.mobile-header .header-top .menu-toggle {
    font-size: 24px;
    background-color: #232F3E;
    border: none;
    color: white;
    cursor: pointer;
}

.menu-toggle:hover {
    color: #febd69;
}

.mobile-header .header-top .logo img {
    height: 40px;
    max-width: 120px;
    object-fit: contain;
    margin-left: 10px; /* Adjust spacing */
}

.mobile-header .header-top .header-icons {
    display: flex;
    align-items: center;
    gap: 10px; /* Consistent spacing between icons */
}

/* Sign-in and Cart styles */
.mobile-header .header-top .header-icons .sign-in {
    font-size: 14px;
    color: white;
    text-decoration: none;
    font-weight: bold;
}

.mobile-header .header-top .header-icons .cart {
    position: relative;
    display: flex;
    align-items: center;
    color: #fff;
}

.cart {
    color: #fff;
}

.mobile-header .header-top .header-icons .cart .cart-count {
    position: absolute;
    top: -5px;
    right: -6px;
    background-color: red;
    color: white;
    font-size: 18px;
    padding: 15px 10px;
    border-radius: 50%;
}

/* Search Bar */
.mobile-header .search-bar {
    display: flex;
    align-items: center;
    background-color: white;
    margin: 10px 15px;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-header .search-bar select,
.mobile-header .search-bar input,
.mobile-header .search-bar button {
    border: none;
    padding: 8px;
    font-size: 14px;
    border-radius: 5px;
}

.mobile-header .search-bar select {
    flex: 1;
    background-color: #f3f3f3;
    color: #333;
}

.mobile-header .search-bar input {
    flex: 3;
    background-color: #fff;
    padding: 5px 10px;
}

.mobile-header .search-bar button {
    background-color: #FF9900;
    color: white;
    cursor: pointer;
    padding: auto;
}

/* Navigation Menu */
.mobile-header .menu-bar {
    display: flex;
    justify-content: space-around;
    background-color: #232F3E;
    color: white;
    padding: 10px 0;
    border-top: 1px solid #131A22;
}

.mobile-header .menu-bar a {
    text-decoration: none;
    color: white;
    font-size: 14px;
    text-align: center;
}

.mobile-header .menu-bar a:hover {
    color: #FF9900;
}

/* Adjustments for Proper Screen Fit */
.mobile-header .categories-section {
    margin-top: 10px;
    padding: 15px 10px;
    background-color: #fff; /* White background for contrast */
}

.mobile-header .categories-section h2 {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.mobile-header .category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    padding: 10px;
}

.mobile-header .category-card {
    background-color: #f3f3f3;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-header .category-card img {
    width: 100%;
    height: auto;
    max-width: 120px;
    margin-bottom: 5px;
}

.mobile-header .category-card h3 {
    font-size: 14px;
    color: #333;
    margin: 0;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .mobile-header {
        display: flex; /* Show mobile header */
    }

    .desktop-header {
        display: none; /* Hide desktop header */
    }
}

@media (max-width: 480px) {
    .mobile-header .header-top .logo img {
        height: 30px;
        max-width: 100px;
        margin-left: -60px;
    }
    .cart-link {
        color: #fff;
    }

    .mobile-header .search-bar select,
    .mobile-header .search-bar input,
    .mobile-header .search-bar button {
        font-size: 12px;
    }

    .mobile-header .menu-bar a {
        font-size: 12px;
        padding: 8px 0;
    }

    .mobile-header .category-card img {
        max-width: 100%;
    }
}

@media (min-width: 1025px) {
    .mobile-header {
        display: none; /* Hide mobile header for larger screens */
    }
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    background-color: #37475a;
    border: 1px solid #444;
    border-radius: 5px;
    width: 250px;
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;    
}

.menu-dropdown.visible {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    z-index: 1000;
}

.category-item {
    margin: 10px 0;
}

.subcategory-list {
    margin-left: 15px;
}

.search-section {
    display: flex;
    align-items: center;
}

.search-category {
    margin-right: 10px;
}

.search-input {
    padding: 5px;
    margin-right: 10px;
}

.search-btn {
    padding: 5px 10px;
}

/* Make the cart container the positioning context */
.mobile-header .header-top .header-icons .cart {
  position: relative;
  display: inline-flex;        /* tighter box so the badge sits correctly */
  align-items: center;
  gap: 16px;
  color: #fff;
}

/* Small, pill-like badge positioned in the corner */
.mobile-header .header-top .header-icons .cart .cart-count {
  position: absolute;
  top: 0;                      /* anchor to top-right of the cart box */
  right: 0;
  transform: translate(40%, -40%); /* nudge outwards like native badges */
  min-width: 18px;
  height: 18px;
  padding: 0 6px;              /* no giant padding */
  line-height: 18px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background-color: #e63946;
  color: #fff;
  box-shadow: 0 0 0 2px #131A22; /* halo to keep it visible on dark header */
  z-index: 2;
}

/* Make sure the icon has a bit of spacing */
.mobile-header .header-top .header-icons .cart i {
  font-size: 20px;
  margin-right: 4px;
}

/* Optional: slightly smaller on very narrow screens */
@media (max-width: 480px) {
  .mobile-header .header-top .header-icons .cart .cart-count {
    min-width: 26px;
    height: 26px;
    line-height: 26px;
    font-size: 13px;
    transform: translate(35%, -35%);
  }
}
