/* --- Base Styles --- */
body {
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  color: #222;
  background: #f5f7fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  transition: all 0.2s;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
}

/* --- Slider and Banner --- */
.slider-banner, .swiper {
  width: 100%;
  height: 20rem; /* h-80 */
  position: relative;
}

.swiper-slide {
  display: flex;
  align-items: center;
  position: relative;
  height: 20rem;
}

.swiper-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}

.swiper-pagination-bullet-active {
  background: #1e40af !important;
}

/* --- Form Controls --- */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  color: #374151;
  background: #ffffff;
  transition: all 0.2s;
  outline: none;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* --- Labels --- */
label, .form-label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
  display: block;
  font-size: 0.9375rem;
}

/* --- Buttons --- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: white;
  font-weight: 500;
  border: none;
  border-radius: 0.5rem;
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.5;
}

button:hover, .btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

button:active, .btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #f3f4f6;
  color: #4b5563;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
}

/* --- Card & Product Card --- */
.card, .box, .product-card {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.product-card {
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-4px);
}

.product-card h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0.5rem 0;
  color: #1f2937;
}

.product-card .price {
  color: #2563eb;
  font-weight: 700;
  font-size: 1.125rem;
}

/* --- Sidebar --- */
.sidebar {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.sidebar a {
  color: #4b5563;
  font-weight: 500;
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  margin: 0.125rem 0;
  transition: all 0.2s;
}

.sidebar a:hover {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.sidebar a.active, .sidebar a.current {
  background: #2563eb;
  color: white;
}

.sidebar a i, .sidebar a svg {
  margin-right: 0.5rem;
}

/* --- Feature Boxes --- */
.feature-box {
  transition: all 0.3s ease;
  border-radius: 0.5rem;
  overflow: hidden;
}

.feature-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* --- Admin Panel --- */
.admin-sidebar {
  background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
  min-height: 100vh;
}

.admin-card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.3s;
}

.admin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* --- Mobile Menu & Sidebar --- */
@media (max-width: 767px) {
  /* Fixed position for mobile sidebar */
  .mobile-sidebar-open {
    overflow: hidden;
  }
  
  .mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: flex;
  }
  
  .mobile-sidebar-content {
    background: white;
    width: 85%;
    max-width: 320px;
    height: 100%;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
    padding: 1rem;
    display: flex;
    flex-direction: column;
  }
  
  .mobile-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
  }
}

/* --- Custom Utilities --- */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
  .swiper, .slider-banner {
    height: 15rem;
  }
  
  .swiper-slide {
    height: 15rem;
  }
  
  .slider-banner .banner-text {
    max-width: 80%;
  }
  
  .slider-banner .banner-text h2 {
    font-size: 1.5rem;
  }
  
  .product-card .price {
    font-size: 1rem;
  }
  
  /* Fix for mobile sidebar behavior */
  #categories-sidebar,
  #homepage-sidebar {
    transition: all 0.3s ease-in-out;
  }
  
  /* Ensure proper spacing on mobile */
  .container, .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 640px) {
  .swiper, .slider-banner {
    height: 12rem;
  }
  
  .swiper-slide {
    height: 12rem;
  }
  
  .slider-banner .banner-text {
    max-width: 90%;
    padding: 1rem;
  }
  
  .slider-banner .banner-text h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
  }
  
  .slider-banner .banner-text p {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }
  
  /* Adjust grid columns for small screens */
  .grid-cols-2 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  /* Make buttons more touchable on mobile */
  button, .btn {
    min-height: 2.75rem;
  }
}

/* Fix for Safari and iOS devices */
@supports (-webkit-touch-callout: none) {
  .min-h-screen {
    min-height: -webkit-fill-available;
  }
  
  .h-screen {
    height: -webkit-fill-available;
  }
}
