/* ==========================================================================
   C-Sky Photonic - STYLESHEET
   Theme: #008080 (Teal) Navbar, Sidebar & Footer | White Background & Text
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GLOBAL VARIABLES & RESET
   -------------------------------------------------------------------------- */
:root {
  /* Strict Equation: Header Height = Sidebar Width = Footer Height (20% of page) */
  --dimension-size: 20vh;

  /* User Specified Color Scheme */
  --theme-teal: #008080;
  --theme-teal-hover: #006666;
  --bg-page: #ffffff;
  --text-white: #ffffff;
  --text-dark: #1e293b;
  --border-light: #e2e8f0;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page); /* White background */
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

/* --------------------------------------------------------------------------
   2. NAVBAR (#008080 Background, White Text, Full Width, Height = 20vh)
   -------------------------------------------------------------------------- */
.navbar {
  width: 100%;
  height: var(--dimension-size);        /* 20vh */
  background-color: var(--theme-teal);  /* #008080 */
  color: var(--text-white);             /* White text */

  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  gap: 1.5rem;
  flex-shrink: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;   /* <-- add this */
  gap: 1rem;              /* vh for a horizontal gap is unusual, use rem/px instead */
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-white);
  white-space: nowrap;
}


.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-links a {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-white);
  position: relative;
  padding: 0.25rem 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background-color: var(--text-white);
  transition: width 0.2s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

.search-box {
  padding: 0.55rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-white);
  font-size: 0.9rem;
  outline: none;
  min-width: 140px;
  max-width: 200px;
  transition: background-color 0.2s, border-color 0.2s;
}

.search-box::placeholder {
  color: rgba(255, 255, 255, 0.8);
}

.search-box:focus {
  background: #000000;
  color: var(--text-dark);
  border-color: #000000;
}



/* --------------------------------------------------------------------------
   BURGER BUTTON: Hidden on desktop, visible on mobile (=768px)
   -------------------------------------------------------------------------- */
.mobile-toggle-btn {
  display: none;
  background: none;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  color: var(--text-white);
  font-size: 1.5rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.mobile-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
/* --------------------------------------------------------------------------
   3. HERO SECTION & SIDEBAR (#008080 Sidebar, White Background Area)
   -------------------------------------------------------------------------- */
.herosection {
  flex: 1 ;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, var(--dimension-size)) 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "sidebar content";
  overflow: hidden;
  background-color: var(--bg-page);
	
}


/* SIDEBAR: Starts below navbar on the left, Width = 20vh, Background = #008080 */
.sidebar {
  grid-area: sidebar;
  width:20vh;
  min-width: 20vh;
  max-width: var(--dimension-size);

  /* ? Pinned on the left across the 60vh middle area */
  position: sticky;
  top: 0;
  height: calc(100vh - (var(--dimension-size) * 2));
  align-self: start;
  background-color: var(--theme-teal);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0.75rem;
  gap: 0.75rem;
  overflow-y: auto;
  z-index: 10;
}


.breadcrumb {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size:0.8rem;
}

.breadcrumb li + li::before {
    content: "/";
    margin: 0 10px;
    color: #888;
}

.content {
    

	margin-top:5vh;
	margin-left:5vh;
	margin-right:5vh;
	margin-bottom:5vh;
    	
    
}




.product-category {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 5vh;
  width: 100%;
  gap: 2.5vh;
}

.card {
  height: 35vh;
  border: 1px solid var(--border-light); /* Cleaned up harsh black border */
  border-radius: 8px;                    /* Soft modern corners */
  display: grid;
  grid-template-rows: 3fr 1fr;
  overflow: hidden;
  background-color: var(--bg-page);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Elegant card hover interaction */
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  border-color: var(--theme-teal);       /* Highlights card with your theme color */
}

.product-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 1.5rem;                       /* Prevents the image from hitting the card borders */
  background-color: #f8fafc;             /* Subtle light grey backdrop behind the product */
  overflow: hidden;
}

/* CRITICAL FIX: Ensures the dynamic product image scales cleanly without breaking layout */
.product-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;                   /* Guarantees the optics product never distorts */
  transition: transform 0.3s ease;
}

/* Subtle zoom effect on the image when the container is hovered */
.card:hover .product-image img {
  transform: scale(1.05);
}

.product-name {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  background-color: var(--bg-page);
}

.product-name a {
  width: 100%;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;               /* Gracefully cuts off overly long product names */
}

.product-name a:hover {
  color: var(--theme-teal); 
}         

/* --------------------------------------------------------------------------
   NEATLY ARRANGED & ALIGNED FOOTER
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   FOOTER (NO SCROLLBAR)
   -------------------------------------------------------------------------- */
.footer {
  width: 100%;
  min-height: var(--dimension-size);    /* At least 20vh */
  flex: 0 0 auto;

  background-color: var(--theme-teal);  /* #008080 */
  color: var(--text-white);             /* White text */
  box-sizing: border-box;

  /* 5 Equal Columns */
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.75rem;

  padding: 1.5rem 2.5rem;
  align-items: start;
  align-content: center;

  overflow: hidden;
  z-index: 20;
}

/* ?? 2. Chrome, Safari, and Opera: hides scrollbar */
.footer::-webkit-scrollbar {
  display: none;
}

/* Each Column */
.footer div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  align-items: flex-start;
}

/* Column Headings */
.footer h4 {
  color: var(--text-white);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
  padding-bottom: 0.2rem;
 
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Links */
.footer a {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease, transform 0.15s ease;
  display: inline-block;
}

.footer a:hover {
  color: var(--text-white);
  text-decoration: none;
  transform: translateX(3px);
}

/* Contact Details */
.footer p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.76rem;
  line-height: 1.3;
  word-break: break-word;
}
/* --------------------------------------------------------------------------
   5. RESPONSIVE
   -------------------------------------------------------------------------- */

/* -- Tablet (= 1024px) -- */
@media (max-width: 1024px) {
  .nav-links {
    gap: 1rem;
  }
  .nav-links a {
    font-size: 0.85rem;
  }
  .footer {
    grid-template-columns: repeat(3, 1fr);
    height: auto;
    min-height: var(--dimension-size);
    max-height: none;
  }
}

/* -- Mobile (= 768px) -- */
@media (max-width: 768px) {
  :root {
    --dimension-size: clamp(65px, 12vh, 85px);
  }

  body {
    height: auto;
    overflow-y: auto;
  }

  /* -- Navbar: row layout with burger -- */
  .navbar {
    height: auto;
    min-height: var(--dimension-size);
    padding: 0.8rem 1rem;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Show burger button */
  .mobile-toggle-btn {
    display: block;
    order: 2;
    margin-left: auto;
  }

  .logo {
    order: 1;
  }

  .search-box {
    order: 4;
    width: 100%;
    max-width: none;
  }

  /* Nav links: hidden by default, shown on .open */
  .nav-links {
    order: 3;
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 0;
    background-color: var(--theme-teal-hover);
    border-radius: 8px;
    overflow: hidden;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    flex-shrink: 0;
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-links a:last-child {
    border-bottom: none;
  }

  .nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }

  /* -- Herosection stacks vertically -- */
  .herosection {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: visible;
  }

  /* Sidebar ? horizontal scroll bar */
  .sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.6rem 0.8rem;
    gap: 0.5rem;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar a {
    flex: 1 0 auto;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
  }

  /* Content wrapper: no scroll lock on mobile, flows normally */
  .content {
    overflow-y: visible;
  }
@media (max-width: 900px) {
    .product-category {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* Mobile */
@media (max-width: 600px) {
    .product-category {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "address"
      "map";
  }

  @media (max-width: 768px) {
  .map {
    height: clamp(180px, 30vh, 300px);
  }
}

  .category {
    grid-template-columns: repeat(2, 1fr);
    padding: 1rem;
    gap: 0.75rem;
  }

  /* -- Footer stacks cleanly -- */
  .footer {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 20vh;
    max-height: none;
    padding: 2rem 1.5rem;
    gap: 1.5rem;
    text-align: center;
  }

  .footer div {
    align-items: center;
  }
}

/* ========================================================================== 
   DYNAMIC PRODUCT CARDS
   Product data comes from /api/products. Images are PNGs from /product_images/.
   The image has no HTML width/height attributes; CSS controls its display size.
   ========================================================================== */
.product-category {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 2rem;
  width: 100%;
  margin-top: 2.5rem;
  align-items: stretch;
}

.dynamic-product-card {
  min-width: 0;
  height: 360px;
  border: 1px solid #c8c8c8;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-sizing: border-box;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.dynamic-product-card:hover {
  transform: translateY(-4px);
  border-color: #008080;
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
}

.product-card-link {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.dynamic-product-card .product-image {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 1.25rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  overflow: hidden;
}

.dynamic-product-card .product-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.dynamic-product-card .product-name {
  min-height: 76px;
  width: 100%;
  padding: .85rem 1rem;
  box-sizing: border-box;
  border-top: 1px solid #d7d7d7;
  background: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dynamic-product-card .product-name span {
  display: block;
  max-width: 100%;
}

.dynamic-product-card:hover .product-name {
  color: #008080;
}

.dynamic-product-card .image-unavailable::after {
  content: "Product image unavailable";
  font-size: .85rem;
  color: #777;
}

.dynamic-empty-state {
  padding: 2rem;
  border: 1px solid #ddd;
  border-radius: 6px;
}

@media (max-width: 1100px) {
  .product-category { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

@media (max-width: 600px) {
  .product-category { grid-template-columns: 1fr; }
  .dynamic-product-card { height: 340px; }
}



/* ==========================================================================
   DYNAMIC PRODUCT CARDS
   Product image and product name are separate layout areas.
   Images are real PNGs from /product_images and never overlap the text.
   ========================================================================== */
.product-category {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  width: 100%;
  align-items: stretch;
}

.dynamic-product-card {
  min-width: 0;
  height: 360px;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  display: block;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dynamic-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.product-card-link {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.dynamic-product-card .product-image {
  flex: 1 1 auto;
  min-height: 0;
  height: 290px;
  width: 100%;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  overflow: hidden;
  border: 0;
}

.dynamic-product-card .product-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.dynamic-product-card .product-name {
  flex: 0 0 70px;
  min-height: 70px;
  width: 100%;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-top: 1px solid var(--border-light, #e2e8f0);
  background: #fff;
  color: var(--text-dark, #1e293b);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.dynamic-product-card .product-name span {
  display: block;
  width: 100%;
}

.dynamic-product-card .product-card-link:focus-visible {
  outline: 3px solid #008080;
  outline-offset: -3px;
}

.dynamic-product-card .image-unavailable::before {
  content: "Product image unavailable";
  color: #64748b;
  font-size: 0.9rem;
  text-align: center;
}

.dynamic-empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
}

@media (max-width: 1100px) {
  .product-category { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .product-category { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .product-category { grid-template-columns: 1fr; gap: 1rem; }
  .dynamic-product-card { height: 340px; }
  .dynamic-product-card .product-image { height: 270px; }
}
}

/* Requested product card sizing: 200px total = 150px image + 50px name. */
.product-category .dynamic-product-card {
  height: 200px;
}
.product-category .dynamic-product-card .product-image {
  flex: 0 0 150px;
  height: 150px;
  padding: 10px;
  box-sizing: border-box;
}
.product-category .dynamic-product-card .product-name {
  flex: 0 0 50px;
  height: 50px;
  min-height: 50px;
  padding: 10px;
  box-sizing: border-box;
  visibility: visible;
  opacity: 1;
}
.content {
  overflow-y: scroll;
  min-height: 0;
}
