/* 📱 ZaniMart Store – Responsive Design */

/* Small Devices (≤600px) */
@media (max-width: 600px) {
  /* Header */
  header {
    flex-direction: row;
    justify-content: space-between;
    padding: 5px 10px;
  }

  header h1 {
    font-size: 1.2rem;
  }

  /* Hamburger Menu */
  .menu-toggle {
    display: block;
    font-size: 1.8rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(122, 120, 120, 0.281);
    cursor: pointer;
    border-radius: 8px;
  }

  nav ul {
    flex-direction: column;
    background: whitesmoke;
    position: absolute;
    top: 60px;
    right: 5px;
    width: 150px;
    text-align: center;
    padding: 5px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    display: none;
  }

  nav ul.active {
    display: flex;
  }

  nav ul li {
    margin: 6px 0;
  }

  nav ul li a {
    color: #111;
    font-weight: 600;
    background: transparent;
    padding: 10px 15px;
    display: inline-block;
  }

  /* Hero */
  .hero {
    background: var(surface);
    border-radius: 15px;
    color: white;
    text-align: center;
    padding: 10px;
  }

  .hero h2 {
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .hero p {
    line-height: 1.6;
    color: #e6e6e6;
    margin: 0 15px 15px;
  }

  .cart-container {
    top: 5px;
    right: 2px;
  }

  .cart-icon {
    font-size: 22px;
    padding: 6px;
  }

  .cart-count {
    font-size: 0.65rem;
    top: -5px;
    right: -5px;
  }

  /* Dropdown Menu - Mobile View */
  .dropdown-content {
    position: static;
    background: transparent;
    box-shadow: none;
    display: none;
    flex-direction: column;
    width: 100%;
    text-align: left;
  }

  .dropdown-content li a {
    padding: 8px 0;
  }

  .dropdown.active .dropdown-content {
    display: flex;
  }

  .cart-item { 
    flex-direction: column; 
    align-items: flex-start; 
  } 
  
  .cart-item img { 
    width: 70px; 
    height: 70px; 
  } 
  
  .quantity-controls button { 
    width: 20px; 
    height: 20px; 
  } 
  
  .cart-summary { 
    padding: 15px; 
  }

  /* Forms */
  .auth-container,
  .checkout-page {
    width: 90%;
    margin: 20px auto;
    padding: 25px 20px;
  }

  .checkout-page h2 {
    font-size: 1.5rem;
  }

  .checkout-page .btn {
    width: 100%;
    padding: 14px;
  }

  /* Footer */
  footer {
    font-size: 0.85rem;
    padding: 15px;
  }

  /* Sidebar & Banner Stack */
  .top-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
    align-items: stretch;
  }

  .categories {
    background: linear-gradient(180deg, rgba(250,250,250,0.6), rgba(0,0,0,0.01));
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 5px;
    height: 300px;
  }

  .categories a {
    display: inline-block;
    margin: 6px;
    padding: 6px 10px;
  }

  .top-selling {
    background: linear-gradient(180deg, rgba(250,250,250,0.6), rgba(0,0,0,0.01));
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 5px;
    width: 100%;
    height: 440px !important;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* ✅ Banner – 5px gap top & bottom */
  .banner-box {
    width: 100%;
    height: auto;
    text-align: center;
    margin: 5px 0;
  }

  .banner-box img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
    margin: 0;
  }

  .products-banner {
    width: 100%;
    height: 190px;
  }

  .products-banner img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
    margin: 0;
  }

  /* Product Grids */
  .products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    padding: 5px;
  }

  .top-selling-products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    padding: 5px;
    height: max-content;
    max-height: none;
    overflow: visible;
  }

  /* Search Bar */
  .search-bar {
    width: 90%;
    flex-direction: row;
    gap: 5px;
    padding: 5px 8px;
  }

  .search-bar input {
    font-size: 0.9rem;
    padding: 8px;
  }

  .search-bar button {
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .admin-container {
    width: 95%;
    margin: 1rem auto;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead tr {
    display: none; /* hide headers */
  }

  tr {
    margin-bottom: 1rem;
    border-bottom: 2px solid #ddd;
  }

  td {
    padding: 10px;
    text-align: right;
    position: relative;
    border: none;
    border-bottom: 1px solid #eee;
  }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 50%;
    padding-left: 15px;
    font-weight: bold;
    text-align: left;
    color: var(--subtext);
  }

  #resultsContainer {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
  }

  #resultsContainer h2 {
    font-size: 1.2rem;
  }
}


/* Medium Devices (601px–992px) */
@media (min-width: 601px) and (max-width: 992px) {
  header h1 {
    font-size: 1.4rem;
  }

  nav ul {
    gap: 5px;
  }

  footer {
    padding: 20px;
  }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .top-section {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
  }

  .categories,
  .banner-box,
  .top-selling {
    flex: 0 0 100%;
    max-width: 100%;
    margin: 0;
  }

  .banner-box img {
    width: 100%;
    height: auto;
  }

  .top-selling {
    height: 335px;
  }
}

/* Large Devices (≥993px) */
@media (min-width: 993px) {
  nav ul {
    display: flex !important;
  }

  .menu-toggle {
    display: none;
  }
}
