/*
	Cameron's Rocks -- mineral-museum.css
	Styles specific to mineralmuseum.html: the museum layout, sidebar
	category list, mineral grid/cards, modal + gallery, filters panel,
	"Load More" button, and the dark-mode theme used only on this page.
	Link this AFTER main.css/base.css on the mineral museum page only.
*/

/* ---------------- Mineral Museum Container ---------------- */
.museum-container {
  display: flex;
  gap: 20px;
  padding: 20px;
  flex-wrap: wrap;
}

/* Sidebar for categories */
.sidebar {
  width: 200px;
  flex-shrink: 0;
}

/* Main content area */
.museum-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Search bar */
#search {
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
  max-width: 400px;
}

/* ---------------- Mineral Grid ---------------- */
.mineral-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 220px); /* fixed card width */
  justify-content: start;   /* align cards to the left */
  gap: 16px 16px;           /* row-gap and column-gap */
  padding: 0;
}
/* ---------------- Mineral Card ---------------- */
.mineral-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  max-width: 250px;         /* card width limit */
  background-color: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
  text-align: center;
  margin: 0 auto;
  cursor: pointer;
}

.mineral-card:hover {
  transform: translateY(-5px);
}

/* Image inside card */
.mineral-card img {
  width: 100%;
  aspect-ratio: 1 / 1;       /* ensures square image */
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* Text inside card */
.mineral-card h3,
.mineral-card p {
  margin: 4px 8px;
  font-size: 0.95rem;
  line-height: 1.2;
  color: #333;
}

/* ---------------- Modal ---------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  border-radius: 10px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

/* Modal main image */
.modal-content img#modal-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 15px;
  object-fit: contain;
}

/* Modal text */
.modal-content h2 {
  margin: 8px 0;
  font-size: 1.5rem;
  text-align: center;
}

.modal-content p {
  margin: 4px 0;
  font-size: 1rem;
  color: #333;
}

/* Modal info section */
.modal-info p {
  margin: 4px 0;
  font-size: 0.95rem;
}

/* Close button */
.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;    /* sized to fit the circle, not stretch it */
  line-height: 1;
  font-weight: bold;
  color: #222;          /* dark icon for contrast against the light badge */
  cursor: pointer;
  z-index: 1010;
  user-select: none;
  border-radius: 50%;   /* a fixed-size flex box makes this a true circle */
  background: rgba(255,255,255,0.9);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.2s ease, background 0.2s ease;
}

.close:hover {
  background: #ffffff;
  transform: scale(1.08);
}


/* ---------------- Modal Gallery Thumbnails ---------------- */
.modal-gallery {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.modal-gallery img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal-gallery img:hover,
.modal-gallery img.active {
  opacity: 1;
  transform: scale(1.05);
  border: 2px solid #007BFF; /* highlight for active thumbnail */
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .museum-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    margin-bottom: 16px;
  }

  .museum-main {
    width: 100%;
  }
}

@media (max-width: 500px) {
  .mineral-card {
    max-width: 100%;
  }

  .modal-content {
    width: 95%;
    padding: 16px;
  }

  .modal-gallery img {
    width: 60px;
    height: 60px;
  }

  #search {
    max-width: 100%;
  }
}

/* Sidebar + layout */
.museum-container {
  display: flex;
  gap: 20px;
  padding: 10px;
  flex-wrap: wrap;
}

.sidebar {
  width: 400px;
  flex-shrink: 0;
  padding: 20px;
  background-color: #f5f5f5;
  border-radius: 70px;
}

.sidebar h3 {
  margin-bottom: 10px;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar ul li {
  padding: 5px 4px;
  margin-bottom: 2px;
  border-radius: 4px;
  transition: background-color 0.2s;
  cursor: pointer;
  /* Text size is untouched -- it inherits the site's normal type.
     Only line-height is tightened: the site's base paragraph
     line-height (1.75em) is what was padding every single-line
     sidebar item with extra height, not the font size itself. */
  line-height: 1.2;
}

.sidebar ul li:hover {
  background-color: #e0e0e0;
}

.sidebar ul li.active {
  background-color: #007BFF;
  color: #fff;
}

/* ---------------- Subcategory nesting ---------------- */
/* Indent nested (subcategory) lists a full tab-stop past their parent
   category, and prefix each one with a small folder icon so the
   parent/child relationship is obvious at a glance. */
.sidebar ul li ul {
  padding-left: 28px;
  padding-top: 0;
  margin-top: 0;
}

.sidebar ul li ul li {
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
  /* Override the parent .sidebar ul li rule's 5px vertical padding --
     that padding is sized for the clickable category rows above, and
     doubles up with margin-bottom here to create the leftover gap
     between a subcategory and the next category. */
  padding: 1px 4px;
  margin-bottom: 0;
}

.sidebar ul li ul li .icon {
  font-size: 0.85em;
  opacity: 0.7;
}

/* Search bar */
#search {
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
  max-width: 400px;
  margin-bottom: 16px;
}

/* Grid and cards */
.mineral-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 220px);
  justify-content: start;
  gap: 16px;
  padding: 0;
}

.mineral-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 250px;
  background-color: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
  text-align: center;
  margin: 0 auto;
  cursor: pointer;
}

.mineral-card:hover {
  transform: translateY(-5px);
}

.mineral-card img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}

.mineral-card h3,
.mineral-card p {
  margin: 4px 8px;
  font-size: 0.95rem;
  line-height: 1.2;
  color: #333;
}

/* Museum header */
.museum-header {
  text-align: center;        /* center title and search bar */
  margin-bottom: 30px;       /* space between header and grid */
}

.museum-header h1 {
  font-size: 2.5rem;         /* larger title */
  margin-bottom: 16px;       /* space between title and search */
  font-family: 'Segoe UI', sans-serif;
  color: #333;
}

/* Mineral Museum Search Bar */
.museum-header #search {
  display: inline-block;     /* inline-block so it stays centered */
  width: 60%;                /* adjust width */
  max-width: 500px;          /* optional max width */
  padding: 12px 20px;        /* larger input */
  font-size: 1.2rem;         /* bigger text */
  border: 2px solid #ccc;    /* subtle border */
  border-radius: 8px;        /* rounded corners */
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  outline: none;
  transition: all 0.2s ease;
}

.museum-header #search:focus {
  border-color: #666;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ---------------- Filters Panel ---------------- */
.filters-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  margin-bottom: 16px;
}

/* Each label + control is grouped so they can never be split across
   a line wrap, and each control gets a sane, compact width instead
   of stretching across the row. */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-weight: bold;
  font-size: 0.8rem;
  white-space: nowrap;
}

.filter-group input,
.filter-group select {
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  height: 34px;
  width: 140px;          /* compact, consistent control width */
}

.filter-group select {
  line-height: 1.2;
  appearance: none;
}

.filter-group select option {
  padding: 4px 6px;
}

/* Locality gets a little extra room since it's free text */
.filter-wide input {
  width: 180px;
}

/* Number filters (weight/price min/max) can be narrower */
.filter-narrow input {
  width: 100px;
}

/* Toggle groups (Personally Collected / For Sale) lay out as a single
   inline checkbox + label instead of a stacked field. */
.filter-toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.filter-toggle label {
  font-size: 0.9rem;
  cursor: pointer;
}

/* Custom checkbox: a visible box with a clear checked state, since the
   site-wide "appearance: none" reset otherwise strips the native
   checkmark and leaves no way to tell it's toggled. */
.filter-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid #9dadbe;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.filter-toggle input[type="checkbox"]:checked {
  background: #3fb1a3;
  border-color: #3fb1a3;
}

.filter-toggle input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-reset-group {
  justify-content: flex-end;
}

.filters-panel button {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: bold;
  padding: 8px 16px;
  height: 34px;
  border-radius: 6px;
  border: none;
  background-color: #9dadbe;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.filters-panel button:hover {
  background-color: #0056b3;
}


/* ---------------- Load More button ---------------- */
.load-more {
  margin: 30px auto;
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
}


/* ---------------- DARK MODE ---------------- */

body.dark-mode {
  background: #0f0f10;
  color: #e6e6e6;
}

/* Header / layout */
body.dark-mode #header,
body.dark-mode .sidebar,
body.dark-mode .museum-header,
body.dark-mode .filters-panel {
  background: #161618;
  color: #e6e6e6;
  border-color: #2a2a2a;
}

/* Cards */
body.dark-mode .mineral-card {
  background: #1a1a1d;
  color: #e6e6e6;
  border: 1px solid #2a2a2a;
}

/* Inputs */
body.dark-mode input,
body.dark-mode select,
body.dark-mode button {
  background: #1a1a1d;
  color: #e6e6e6;
  border: 1px solid #333;
}

/* Links / hover */
body.dark-mode a {
  color: #9ad1ff;
}

body.dark-mode .mineral-card:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}

/* Modal */
body.dark-mode .modal-content {
  background: #161618;
  color: #e6e6e6;
}

/* Sidebar category hover fix */
.sidebar ul li {
    color: #eaeaea;
}

.sidebar ul li:hover {
    background: rgba(255, 255, 255, 0.08); /* soft highlight instead of white block */
    color: #ffffff;
}

/* Fix submenu hover (subcategories) */
.sidebar ul li ul li:hover {
    background: rgba(255, 255, 255, 0.06);
}

.museum-header h1 {
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 1px;
}

.mineral-card h3 {
    color: #f2f2f2;
    margin-top: 8px;
}

.mineral-card p {
    color: #cfcfcf;
}

/* ---------------- MODAL DARK MODE FIX ---------------- */

.modal-content {
    background: #141821;   /* dark panel */
    color: #eaeaea;        /* default text */
}

/* All modal text blocks (but not the close button badge, which needs
   its own dark-on-light color for contrast against its light circle) */
.modal-content h2,
.modal-content p,
.modal-content strong,
.modal-content span:not(.close) {
    color: #eaeaea !important;
}

/* Optional: make labels slightly softer than values */
.modal-content strong {
    color: #ffffff;
}

/* Gallery background consistency */
.modal-gallery {
    background: transparent;
}

/* ---------------- Card price ---------------- */
.mineral-card .mineral-price {
  font-weight: bold;
  margin: 0 8px 8px;
  font-size: 0.95rem;
}

body.dark-mode .mineral-card .mineral-price {
  color: #f2f2f2;
}

/* ---------------- Modal Buy Now ---------------- */
/* Shown only in the opened detail modal, directly under the Price row --
   not on the grid card itself. */
#modal-buy-now {
  margin: 6px 0 12px;
}

.buy-now-btn {
  display: inline-block;
  padding: 8px 22px;
  background-color: #3fb1a3;
  color: #fff !important;
  text-align: center;
  font-weight: bold;
  text-decoration: none;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.buy-now-btn:hover {
  background-color: #339287;
}
