/* Nimart Green & white theme */
:root{
  --nimart-green: #008751;
  --nimart-dark-green: #006641;
  --bg: #ffffff;
  --muted: #6b7280;
  --card-shadow: 0 4px 12px rgba(3,15,12,0.08);
  --radius: 8px;
  --max-width: 1100px;
  --container-padding: 16px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:#0b1220;line-height:1.4}
.container{
  max-width:var(--max-width);
  margin:0 auto;
  padding:0 var(--container-padding);
}

/* Professional Loader */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--nimart-green);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: white;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.logo-container {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.loader-logo {
  width: 80px;
  height: 72px;
  animation: professionalRotate 2s linear infinite;
}

.loader p {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.5px;
}

.dot {
  animation: dotPing 1.4s infinite ease-in-out;
  opacity: 0;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes professionalRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes dotPing {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.loader.hidden {
  display: none;
}

/* Header - Fixed spacing */
.site-header{
  background: var(--nimart-green);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 8px 0;
}
.header-inner{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
}
.logo{
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logo-image {
  height: 32px;
  width: auto;
}
.search-area{
  flex: 1;
  min-width: 0;
}
.search-container{
  display: flex;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.search-container input{
  flex: 1;
  padding: 10px 12px;
  border: none;
  outline: none;
  font-size: 14px;
  min-width: 0;
}
.search-button{
  background: var(--nimart-green);
  color: white;
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}
.search-button:hover{
  background: var(--nimart-dark-green);
}
.location-select{
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.location-select select{
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 13px;
  min-width: 110px;
}
.location-select select option {
  background: white;
  color: #333;
}

/* Categories - Compact Design */
.categories{
  padding: 20px 0 15px;
}
.categories h2{
  color: var(--nimart-green);
  margin-bottom: 12px;
  font-size: 18px;
}
.categories-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}
.category-card{
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 8px;
  border-radius: 8px;
  border: 1px solid #eef2f4;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.category-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,135,81,0.1);
  border-color: var(--nimart-green);
}
.category-card .icon{
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(0,135,81,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--nimart-green);
  margin-bottom: 8px;
  font-size: 14px;
}
.cat-name {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  line-height: 1.2;
}

/* Stores carousel - Compact */
.top-stores{
  padding: 15px 0;
}
.top-stores h2{
  color: var(--nimart-green);
  margin-bottom: 12px;
  font-size: 18px;
}
.stores-carousel{
  display: flex;
  gap: 12px;
  overflow: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.stores-carousel::-webkit-scrollbar {
  display: none;
}
.store-pill{
  min-width: 140px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #eef2f4;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.store-pill:hover{
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,135,81,0.1);
  border-color: var(--nimart-green);
}
.store-pill img{
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}
.store-name{
  font-weight: 500;
  font-size: 13px;
  color: #333;
}

/* Products grid - Clean */
.top-products{
  padding: 15px 0 30px;
}
.top-products h2{
  color: var(--nimart-green);
  margin-bottom: 5px;
  font-size: 18px;
}
.section-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.showing-info{
  color: var(--muted);
  font-size: 13px;
}
.products-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
}
.card{
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--card-shadow);
  border: 1px solid #f3f6f7;
  transition: all 0.2s ease;
}
.card:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,135,81,0.12);
}
.card img{
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 10px;
}
.card h3{
  font-size: 14px;
  margin: 6px 0;
  line-height: 1.3;
  color: #333;
  font-weight: 500;
}
.card .price{
  font-weight: 600;
  color: var(--nimart-green);
  font-size: 16px;
  margin: 6px 0;
}
.card .meta{
  font-size: 12px;
  color: var(--muted);
  margin: 3px 0;
}
.card .actions{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 6px;
}
.card button{
  background: var(--nimart-green);
  color: #fff;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  flex: 1;
  transition: background 0.2s;
  font-weight: 500;
}
.card button:hover{
  background: var(--nimart-dark-green);
}
.card button:last-child{
  background: #fff;
  color: var(--nimart-green);
  border: 1px solid var(--nimart-green);
}
.card button:last-child:hover{
  background: var(--nimart-green);
  color: white;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7,10,10,0.7);
  z-index: 1000;
  padding: 20px;
}
.modal.hidden{
  display: none;
}
.modal-content{
  background: #fff;
  border-radius: 12px;
  width: min(800px,95%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-close{
  background: none;
  border: none;
  font-size: 20px;
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
  color: var(--muted);
  z-index: 1;
}
.modal-close:hover{
  color: #333;
}

/* Footer */
.site-footer{
  padding: 20px 0;
  border-top: 1px solid #eef2f4;
  margin-top: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Loading state for products */
.products-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px){
  .container {
    padding: 0 12px;
  }
  
  /* Header adjustments for mobile */
  .header-inner{
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
  }
  
  .logo {
    flex: 0 0 auto;
  }
  
  .logo-image {
    height: 28px;
  }
  
  .search-area {
    order: 3;
    flex: 1 0 100%;
    margin-top: 8px;
  }
  
  .search-container input {
    padding: 8px 10px;
    font-size: 14px;
  }
  
  .search-button {
    padding: 8px 12px;
  }
  
  /* Location selector */
  .location-select {
    order: 2;
    flex: 1;
    justify-content: flex-end;
  }
  
  .location-select select {
    min-width: 100px;
    font-size: 12px;
    padding: 6px 8px;
  }
  
  /* Categories - 4 columns on mobile */
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  
  .category-card {
    padding: 12px 6px;
  }
  
  .category-card .icon {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  .cat-name {
    font-size: 11px;
  }
  
  /* Products - 2 columns on mobile */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .card {
    padding: 10px;
  }
  
  .card img {
    height: 120px;
  }
  
  .card h3 {
    font-size: 13px;
  }
  
  .card .price {
    font-size: 14px;
  }
  
  .card .actions {
    flex-direction: column;
    gap: 5px;
  }
  
  .card button {
    width: 100%;
    font-size: 11px;
    padding: 6px 8px;
  }
  
  /* Section headers */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .categories h2,
  .top-stores h2,
  .top-products h2 {
    font-size: 16px;
  }
  
  .store-pill {
    min-width: 120px;
    padding: 10px;
  }
  
  .store-pill img {
    width: 30px;
    height: 30px;
  }
  
  .store-name {
    font-size: 12px;
  }
}

@media (max-width: 480px){
  .container {
    padding: 0 10px;
  }
  
  .logo-image {
    height: 26px;
  }
  
  .location-select select {
    min-width: 90px;
    font-size: 11px;
    padding: 5px 6px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  
  .category-card {
    padding: 10px 4px;
  }
  
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .card {
    padding: 8px;
  }
  
  .card img {
    height: 110px;
  }
  
  .loader-logo {
    width: 60px;
    height: 54px;
  }
  
  .loader p {
    font-size: 14px;
  }
}

/* Very small screens */
@media (max-width: 360px){
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
  }
  
  .location-select select {
    min-width: 80px;
    font-size: 10px;
  }
}