
/* ==========================================================================
   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%;
  margin: 0;
  overflow: hidden;
}

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;
}

.content h1{
  text-align: center;
}
.logo {
  display: flex;
  align-items: center;   
  gap: 1rem;              
  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: #ffffff;
  color: var(--text-dark);
  border-color: #ffffff;
}

/* 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 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: minmax(0, var(--dimension-size)) 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "sidebar content";
  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);

  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;
}

/* --------------------------------------------------------------------------
   4. DEALERS CONTENT MAIN LAYOUT (UNIFIED & CLEANED)
   -------------------------------------------------------------------------- */
.content {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 5vh 5vh;
}

.content, h1{
  color:black;
}
.dealertitle {
  margin: 5vh 0 3vh;
}

.main {
  display: grid;
  /* Fixed: Forces exactly 3 columns with mathematically identical widths */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: "location list map";
  gap: 2rem;
  width: 100%;
  min-width: 0;
  /* Fixed: Forces all 3 child panels to stretch to the exact same height */
  align-items: stretch;
}

.dealer-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: #ffffff;
  padding: 1.25rem;
  box-shadow: 0 6px 20px rgba(0, 80, 80, 0.06);
}

.dealer-panel h5 {
  margin-bottom: 1rem;
  color: var(--theme-teal-hover);
  font-size: 1rem;
  font-weight: 700;
}

.dealer-location-panel {
  grid-area: location;
  /* Fixed: Adds matching min-height so it mirrors the list & map panels on load */
  min-height: 420px;
}

.dealer-list-panel {
  grid-area: list;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.dealer-map-panel {
  grid-area: map;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.location {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.location label {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.main select {
  width: min(100%, 40vh);
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border: 1px solid #c9dada;
  border-radius: 8px;
  background: #fbfefe;
  color: var(--text-dark);
  font: inherit;
}

.main select:focus {
  outline: none;
  border-color: var(--theme-teal);
  box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.12);
}

.main select:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.dealer-status {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   DYNAMIC DEALER RESULTS (CARDS STACKED VERTICALLY)
   -------------------------------------------------------------------------- */
.dealer-results {
  display: grid;
  /* Fixed: Changes from repeat(2, 1fr) to 1fr so cards list 1 by 1 vertically */
  grid-template-columns: 1fr;
  gap: 1rem;
  min-width: 0;
  flex: 1;
  min-height: 260px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.dealer-results::-webkit-scrollbar {
  width: 7px;
}

.dealer-results::-webkit-scrollbar-thumb {
  background: #b7cccc;
  border-radius: 10px;
}

.dealer-card {
  width: 100%;
  flex: 0 0 auto;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 1.1rem;
  background: #ffffff;
  color: var(--text-dark);
  font: inherit;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.dealer-card.active {
  border-color: var(--theme-teal);
  background: #f6fbfb;
  box-shadow: 0 4px 12px rgba(0, 80, 80, 0.08);
}

.dealer-card h3 {
  margin-bottom: 0.6rem;
  color: var(--theme-teal);
  font-size: 1.05rem;
}

.dealer-card p {
  margin-bottom: 0.75rem;
  line-height: 1.5;
  color: var(--text-dark);
}

.dealer-card a,
.dealer-website {
  display: inline-block;
  margin-right: 0.8rem;
  margin-top: 0.25rem;
  color: var(--theme-teal);
  font-weight: 600;
  font-size: 0.88rem;
}

.dealer-card a:hover {
  color: var(--theme-teal-hover);
  text-decoration: underline;
}

.dealer-empty {
  grid-column: 1 / -1;
  padding: 1rem;
  border: 1px dashed var(--border-light);
  color: #64748b;
}

/* --------------------------------------------------------------------------
   EMBEDDED DEALER MAP
   -------------------------------------------------------------------------- */
.dealer-map {
  width: 100%;
  height: 100%;
  min-height: 350px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.dealer-map iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.dealer-map-empty {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 350px;
  padding: 1.5rem;
  text-align: center;
  color: #667777;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.footer {
  width: 100%;
  min-height: 20vh;
  flex: 0 0 auto;
  background-color: var(--theme-teal);
  color: var(--text-white);
  box-sizing: border-box;
  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;
}

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

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

.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;
}

.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);
}

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

/* LOGO IMAGE ALIGNMENTS */
.logo-link {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}

.logo img {
  width: 70px;
  height: 70px;
  min-width: 70px;
  min-height: 70px;
  object-fit: contain;
  display: block;
}

.logo .companyname {
  font-size: 1.4rem;
  font-weight: 700;
  /* letter-spacing: 0.1em;
  white-space: nowrap; */
}

/* --------------------------------------------------------------------------
5. RESPONSIVE OVERRIDES
-------------------------------------------------------------------------- */
/* -- 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;
  }
}

/* -- Medium screens laptop override -- */
@media (max-width: 1100px) and (min-width: 769px) {
  .main {
    grid-template-columns: minmax(200px, 0.9fr) minmax(240px, 1fr);
    grid-template-areas:
      "location list"
      "map map";
  }
}

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

  body {
    height: 100%;
    overflow: hidden;
  }

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

  .mobile-toggle-btn {
    display: block;
    order: 2;
    margin-left: auto;
  }

  .logo {
    order: 1;
  }

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

  .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 {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .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 {
    overflow-y: visible;
    padding: 0 1rem 2rem;
  }

  /* Fixed Mobile Stack: Grid maps down safely onto 1 item columns */
  .main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "location"
      "list"
      "map";
    gap: 1.5rem;
  }

  .main select {
    width: 100%;
  }

  .dealer-list-panel,
  .dealer-map-panel {
    min-height: 320px;
  }

  .dealer-results {
    max-height: 320px;
  }

  .dealer-map,
  .dealer-map iframe,
  .dealer-map-empty {
    min-height: 280px;
  }

  .footer {
    grid-template-columns: 1fr;
    height: auto;
    min-height: var(--dimension-size);
    max-height: none;
    padding: 2rem 1.5rem;
    gap: 1.5rem;
    text-align: center;
  }

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

/* FINAL SCROLL BEHAVIOR */
html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar,
.footer {
  flex-shrink: 0;
}

.herosection {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.content {
  min-height: max-content;
  overflow: visible;
}

.dealer-list-panel {
  min-width: 0;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.dealer-results {
  flex: 0 1 400px;
  min-height: 260px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  body {
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
  }

  .herosection {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .content {
    min-height: max-content;
    overflow: visible;
  }

  .dealer-results {
    max-height: none !important;
    overflow-y: visible !important;
  }
}

/* =========================================================
   DEALER LIST — MOBILE-SAFE VERTICAL SCROLL
   The requested dealer-list-panel itself owns the scrollbar.
   ========================================================= */
.dealer-panel.dealer-list-panel {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 420px !important;
  max-height: 420px !important;
  scrollbar-width: thin !important;
}

.dealer-panel.dealer-list-panel::-webkit-scrollbar {
  width: 7px;
}

.dealer-panel.dealer-list-panel::-webkit-scrollbar-thumb {
  background: #b7cccc;
  border-radius: 10px;
}

.dealer-panel.dealer-list-panel .dealer-results {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  padding-right: 0 !important;
}

/* Each dealer is one row: bullet on the left, dealer information
   stacked on the right, matching the supplied list reference. */
.dealer-panel.dealer-list-panel .dealer-card {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
  padding: 0.95rem 0.9rem 0.95rem 2.35rem !important;
  text-align: left !important;
  border: 0 !important;
  border-radius: 0 !important;
  border-bottom: 1px solid var(--border-light) !important;
  background: #ffffff !important;
  box-shadow: none !important;
  color: var(--text-dark) !important;
}

.dealer-panel.dealer-list-panel .dealer-card::before {
  content: "" !important;
  position: absolute !important;
  left: 0.45rem !important;
  top: 1.2rem !important;
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  background: #000000 !important;
}

.dealer-panel.dealer-list-panel .dealer-card.active {
  border-color: transparent !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.dealer-panel.dealer-list-panel .dealer-card h3 {
  margin: 0 0 0.4rem !important;
  color: var(--theme-teal) !important;
  font-size: 1rem !important;
  line-height: 1.35 !important;
}

.dealer-panel.dealer-list-panel .dealer-card p {
  margin: 0 0 0.45rem !important;
  line-height: 1.45 !important;
  color: var(--text-dark) !important;
  overflow-wrap: anywhere !important;
}

.dealer-panel.dealer-list-panel .dealer-card .dealer-website {
  margin: 0 !important;
}

@media (max-width: 768px) {
  .dealer-panel.dealer-list-panel {
    width: 100% !important;
    min-height: 320px !important;
    max-height: 55vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .dealer-panel.dealer-list-panel .dealer-results {
    max-height: none !important;
    overflow: visible !important;
  }

  .dealer-panel.dealer-list-panel .dealer-card {
    padding-left: 2.2rem !important;
  }
}
