/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
}

body {
  background: #f8f9fb;
  color: #333;
  line-height: 1.6;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #003366;
  color: white;
  padding: 10px 20px;
}
/* Reset default link styles globally */
a {
  color: inherit;
  text-decoration: none;
}

/* Optional: Underline on hover for clarity */
a:hover {
  color: inherit;
  text-decoration: underline;
}


.top-bar .logo {
  font-weight: bold;
  font-size: 1.4rem;
}

.top-bar nav ul {
  display: flex;
  list-style: none;
  gap: 15px;
}

.top-bar nav ul li a,
.user-links a {
  color: white;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.top-bar nav ul li a:hover,
.user-links a:hover {
  color: #ffcc00;
}

.user-links {
  display: flex;
  gap: 15px;
}

/* Category Drawer */
.category-drawer {
  background: #fff;
  padding: 10px;
  width: 240px;
  border-right: 1px solid #ccc;
  position: fixed;
  top: 55px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 5;
}

.drawer-toggle {
  background: #003366;
  color: white;
  padding: 10px;
  border: none;
  width: 100%;
  text-align: left;
  font-weight: bold;
  cursor: pointer;
}

.category-list {
  margin-top: 15px;
  list-style: none;
  padding-left: 0;
}

.category-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 5px;
  border-bottom: 1px solid #eee;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.category-list li:hover {
  background: #f0f0f0;
}

/* Main Content */
.main-content {
  margin-left: 260px;
  padding: 20px;
}

.product-page {
  display: block;
}

.product-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 2rem 0;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0,0,0,0.05);
}

.product-image {
  flex: 1;
  min-width: 300px;
  text-align: center;
}

.product-image img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.product-info {
  flex: 2;
  min-width: 300px;
}

.product-info h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #003366;
}

.product-info p {
  margin-bottom: 10px;
}
#product-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: flex-start;
}

.product-item {
  flex: 1 1 calc(25% - 20px);
  max-width: calc(25% - 20px);
  min-width: 200px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  transition: transform 0.2s ease;
}

.product-item:hover {
  transform: translateY(-4px);
}

/* Fix product image size */
.product-item img {
  width: 100%;
  height: 180px; /* Fixed height for uniform layout */
  object-fit: contain;
  margin-bottom: 10px;
}

/* Fix product title length and prevent layout shift */
.product-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  text-align: center;
  margin: auto 0 0 0;
  word-wrap: break-word;
  line-height: 1.4;
  max-height: 2.8em; /* Roughly 2 lines */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}


.button-link {
  display: inline-block;
  background-color: #007bff;
  color: white;
  padding: 0.75rem 1.5rem;
  margin-top: 1rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.button-link:hover {
  background-color: #0056b3;
}
/* Sidebar (Tagged Products) */
.sidebar {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0,0,0,0.05);
  margin-top: 2rem;
}

.sidebar h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: #003366;
}

.sidebar a {
  display: block;
  color: #003366;
  margin-bottom: 8px;
  text-decoration: none;
}

.sidebar a:hover {
  text-decoration: underline;
}

.tagged-section {
  margin-top: 2rem;
}

.tag-list {
  list-style: none;
  padding-left: 0;
}

.tag-list li {
  margin: 0.5rem 0;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  background: #003366;
  color: white;
  border-radius: 6px;
}
.related-wrapper {
  margin-top: 3rem;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.05);
}

.related-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
  color: #003366;
}

.related-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: flex-start;
}

/* Responsive Flex Cards */
.related-card {
  flex: 1 1 calc(25% - 1.5rem); /* 4 per row, minus gap */
  max-width: calc(25% - 1.5rem);
  min-width: 160px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-align: center;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.related-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.related-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.related-card-title {
  padding: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: #333;
}
@media (max-width: 768px) {
  .related-card {
    flex: 1 1 calc(50% - 1.5rem); /* 2 per row */
    max-width: calc(50% - 1.5rem);
  }
}

@media (max-width: 480px) {
  .related-card {
    flex: 1 1 100%; /* 1 per row */
    max-width: 100%;
  }
}

/* Admin Form */
.add-form {
  max-width: 600px;
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 40px;
}

.add-form h2 {
  margin-bottom: 20px;
  color: #003366;
}

.add-form label {
  display: block;
  margin-top: 15px;
  font-weight: bold;
}

.add-form input, 
.add-form textarea {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.add-form button {
  background: #003366;
  color: #fff;
  border: none;
  padding: 12px 25px;
  border-radius: 6px;
  margin-top: 20px;
  cursor: pointer;
}

.add-form button:hover {
  background: #0055aa;
}

/* Table styling (already styled lightly in admin.php, but extend) */
table th, table td {
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

table img {
  border-radius: 6px;
  max-height: 60px;
}

