/* =============== KHANDESIGNTECH - FULLY RESPONSIVE ROYAL BLUE THEME =============== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  background: #F1F1F1;
  color: #0f172a;
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
}

/* =============== NAVBAR =============== */
#navbar {
  background: #FFFFFF;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 3%;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 2px solid #4169E1;
  width: 100%;
  min-height: 60px;
  box-shadow: 0 2px 10px rgba(65,105,225,0.1);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.logo {
  width: auto;
  height: 35px; /* Chhota logo */
  max-height: 35px;
  object-fit: contain;
}

.brand-name {
  font-size: 1rem;
  font-weight: 800;
  color: #2009ec;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.nav-links a {
  color: #0f172a;
  text-decoration: none;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: all 0.3s;
  font-size: 0.8rem;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: #FFFFFF;
  background: #4169E1;
}

.menu-icon {
  display: none;
  font-size: 1.4rem;
  color: #4169E1;
  cursor: pointer;
}

/* Navbar User Menu - IMPROVED */
.nav-right {
  display: flex;
  align-items: center;
  margin-left: 5px;
  flex-shrink: 0;
}

#guestMenu {
  display: flex;
  gap: 4px;
}

#userMenu {
  display: none;
  align-items: center;
  gap: 6px;
}

/* Username ke upar "Hi," display */
.user-greeting {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.greeting-text {
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 400;
}

#welcomeUsername {
  color: #0f172a;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #4169E1;
  color: #4169E1;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.75rem;
  transition: all 0.3s;
  white-space: nowrap;
}

.btn-outline:hover {
  background: #4169E1;
  color: white;
}

.btn-primary {
  background: #4169E1;
  border: none;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.75rem;
  white-space: nowrap;
}

.btn-logout {
  background: transparent;
  border: 1px solid #dc2626;
  color: #dc2626;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  white-space: nowrap;
}

.btn-logout:hover {
  background: #dc2626;
  color: white;
}

/* =============== MOBILE MENU (max-width: 768px) =============== */
@media screen and (max-width: 768px) {
  #navbar {
    padding: 0.3rem 2%;
    min-height: 55px;
  }
  
  .logo {
    height: 30px;
  }
  
  .brand-name {
    font-size: 0.9rem;
  }
  
  .nav-links {
    position: fixed;
    top: 55px;
    left: -100%;
    width: 75%;
    max-width: 250px;
    height: calc(100vh - 55px);
    background: #FFFFFF;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    transition: left 0.3s ease;
    z-index: 999;
    border-right: 2px solid #4169E1;
    padding: 0.8rem 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
  }
  
  .nav-links.active {
    left: 0;
  }
  
  .nav-links a {
    width: 100%;
    text-align: left;
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #F1F1F1;
    white-space: normal;
  }
  
  .nav-links a:last-child {
    border-bottom: none;
  }
  
  .menu-icon {
    display: block;
    font-size: 1.3rem;
  }
  
  .nav-right {
    margin-left: 3px;
  }
  
  #guestMenu {
    gap: 3px;
  }
  
  .btn-outline, .btn-primary {
    padding: 3px 6px;
    font-size: 0.7rem;
  }
  
  #userMenu {
    gap: 4px;
  }
  
  .greeting-text {
    font-size: 0.55rem;
  }
  
  #welcomeUsername {
    font-size: 0.7rem;
  }
  
  .btn-logout {
    padding: 2px 5px;
    font-size: 0.6rem;
  }
}

/* =============== SMALL MOBILE (max-width: 480px) =============== */
@media screen and (max-width: 480px) {
  #navbar {
    padding: 0.2rem 1.5%;
  }
  
  .logo {
    height: 28px;
  }
  
  .brand-name {
    font-size: 0.8rem;
  }
  
  .nav-links {
    width: 80%;
    top: 52px;
    height: calc(100vh - 52px);
  }
  
  .nav-links a {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
  
  .nav-right {
    margin-left: 2px;
  }
  
  #guestMenu {
    gap: 2px;
  }
  
  .btn-outline, .btn-primary {
    padding: 2px 5px;
    font-size: 0.65rem;
  }
  
  .btn-logout {
    padding: 2px 4px;
    font-size: 0.55rem;
  }
  
  .greeting-text {
    font-size: 0.5rem;
  }
  
  #welcomeUsername {
    font-size: 0.65rem;
  }
}

/* =============== HERO SECTION =============== */
.hero {
  min-height: 80vh;
  background: #F1F1F1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 4%;
  width: 100%;
}

.hero-content {
  max-width: 900px;
  width: 100%;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 900;
  margin-bottom: 1rem;
  line-height: 1.2;
  text-transform: uppercase;
  color: #0f172a;
  word-wrap: break-word;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  margin-bottom: 1.5rem;
  color: #0f172a;
}

.hero p i {
  color: #4169E1;
  margin-right: 0.5rem;
}

.btn-primary.hero-btn {
  padding: 0.8rem 1.8rem;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  margin-bottom: 1.5rem;
}

.hero-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  border: 2px solid #4169E1;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
}

.feature i {
  color: #4169E1;
  font-size: 1rem;
}

.feature span {
  color: #0f172a;
  font-weight: 600;
}

/* =============== CATEGORY GRID =============== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
  max-width: 1400px;
  margin: 80px auto 3rem;
  padding: 0 4%;
  width: 100%;
}

.category-card {
  background: white;
  border: 2px solid #f1f1f1;
  border-radius: 16px;
  padding: 1.8rem 1.2rem;
  text-align: center;
  transition: all 0.3s;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  height: 100%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.category-card:hover {
  transform: translateY(-5px);
  border-color: #4169E1;
  box-shadow: 0 15px 30px rgba(65,105,225,0.15);
}

.category-count {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #062657;
  color: #4169E1;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
}

.category-icon {
  font-size: 2.2rem;
  color: #4169E1;
  margin-bottom: 1rem;
}

.category-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.category-desc {
  color: #0f172a;
  font-size: 0.85rem;
}

/* =============== PRODUCT GRID =============== */
/* =============== CATEGORY GRID =============== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
  max-width: 1400px;
  margin: 80px auto 3rem;
  padding: 0 4%;
  width: 100%;
}

.category-card {
  background: white;
  border: 2px solid #f1f1f1;
  border-radius: 16px;
  padding: 1.8rem 1.2rem;
  text-align: center;
  transition: all 0.3s;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  height: 100%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.category-card:hover {
  transform: translateY(-5px);
  border-color: #4169E1;
  box-shadow: 0 15px 30px rgba(65,105,225,0.15);
}

.category-count {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #062657;
  color: #4169E1;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
}

.category-icon {
  font-size: 2.2rem;
  color: #4169E1;
  margin-bottom: 1rem;
}

.category-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.category-desc {
  color: #0f172a;
  font-size: 0.85rem;
}

/* =============== PRODUCT GRID =============== */
.products-container {
  max-width: 1400px;
  margin: 80px auto 3rem;
  padding: 0 4%;
  width: 100%;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
  width: 100%;
}

.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #0c98df;
  transition: all 0.3s;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: #e14141;
  box-shadow: 0 10px 25px rgba(65,105,225,0.15);
}

.product-image {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3b4f64;
  border-bottom: 1px solid #F1F1F1;
  padding: 5px;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #4169E1;
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  z-index: 2;
}

.product-info {
  padding: 0.8rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.4rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  margin-bottom: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.current-price {
  font-size: 1rem;
  font-weight: 800;
  color: #4169E1;
}

.original-price {
  font-size: 0.75rem;
  color: #64748b;
  text-decoration: line-through;
}

.discount {
  color: #4169E1;
  font-size: 0.65rem;
  font-weight: 700;
}

.product-description {
  color: #0f172a;
  font-size: 0.75rem;
  margin-bottom: 0.6rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.buy-now-btn {
  width: 100%;
  padding: 0.5rem;
  background: #4169E1;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: auto;
}

.buy-now-btn i {
  font-size: 0.75rem;
}

.buy-now-btn:hover {
  background: white;
  color: #4169E1;
  border: 1px solid #4169E1;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(65,105,225,0.2);
}

/* =============== CATEGORY HEADER =============== */
.category-header {
  text-align: center;
  padding: 15px 4%;
  background: white;
  border-bottom: 2px solid #4169E1;
  width: 100%;
  margin-top: 0;
}

.category-header h1 {
  color: #0f172a;
  font-size: clamp(1.3rem, 4vw, 2rem);
  margin-bottom: 0.2rem;
}

.category-header p {
  color: #0f172a;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* =============== LOADING =============== */
.loading {
  text-align: center;
  padding: 2rem;
  grid-column: 1 / -1;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #F1F1F1;
  border-top: 4px solid #4169E1;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =============== REST OF THE CSS REMAINS SAME =============== */
/* (product-card, product-image, etc. - jo pehle tha waisa hi rakho) */

/* =============== RESPONSIVE BREAKPOINTS =============== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media screen and (min-width: 1025px) and (max-width: 1280px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media screen and (min-width: 1281px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .category-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}