/* ============================================
   LAYOUT CSS — CVD Diamonds
   ============================================ */

/* ============================================
   TOP BAR
   ============================================ */
.topbar {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  height: var(--topbar-h);
  font-size: 12px;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 100%;
  max-width: 1800px;
  margin: 0 auto;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.6);
}
.topbar-item a { color: rgba(255,255,255,0.75); transition: color var(--transition); }
.topbar-item a:hover { color: rgba(255,255,255,1); }
.topbar-timing { color: rgba(255,255,255,0.45); font-size: 11px; }

.topbar-welcome { color: rgba(255,255,255,0.55); font-size: 12px; }
.topbar-welcome strong { color: rgba(255,255,255,0.85); }
.topbar-link {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.topbar-link:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9); }
.topbar-signout { border: 1px solid rgba(255,255,255,0.15); }

/* ============================================
   SITE HEADER
   ============================================ */
.site-header {
  background: var(--white);
  border-bottom: var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 100%;
  max-width: 1800px;
  margin: 0 auto;
}

/* Hamburger */
.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: var(--border-md);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--gray-700);
  transition: all var(--transition);
}
.btn-hamburger:hover { background: var(--gray-50); }

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-gem { display: flex; align-items: center; }
.logo-text { line-height: 1.2; }
.logo-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 1.5px;
}
.logo-sub {
  font-size: 9px;
  letter-spacing: 1.8px;
  color: var(--gray-500);
  font-weight: 400;
  text-transform: uppercase;
}

/* Header Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  justify-content: center;
}
.hnav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-600);
  border-radius: var(--radius-pill);
  transition: all var(--transition);
  white-space: nowrap;
}
.hnav-link:hover { color: var(--navy); background: var(--navy-pale); }
.hnav-link.active { color: var(--navy); font-weight: 500; background: var(--navy-pale); }

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

.header-search-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  border: var(--border-md);
  border-radius: var(--radius-md);
  padding: 6px 11px;
  background: var(--gray-50);
  color: var(--gray-400);
  position: relative;
  transition: all var(--transition);
}
.header-search-wrap:focus-within {
  border-color: var(--navy-light);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(13,31,60,0.06);
  color: var(--gray-600);
}
.header-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--gray-900);
  width: 190px;
}
.header-search-input::placeholder { color: var(--gray-400); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--white);
  border: var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
}
.search-dropdown.open { display: block; }
.search-result-item {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.search-result-item:hover { background: var(--navy-pale); }

.header-action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: var(--border-md);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-600);
  transition: all var(--transition);
  text-decoration: none;
}
.header-action-btn:hover { background: var(--gray-50); color: var(--navy); border-color: var(--gray-300); }
.header-action-btn svg { fill: currentColor; }
#btn-wa { color: #25d366; border-color: #c8f5d6; background: #f0fef4; }
#btn-wa:hover { background: #d8fde8; border-color: #a0e4b4; }

.action-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--gold);
  color: var(--white);
  font-size: 9px;
  font-weight: 600;
  min-width: 16px; height: 16px;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--white);
}

/* ============================================
   INFO BAR
   ============================================ */
.info-bar {
  background: linear-gradient(90deg, #fffbeb, #fff8e1);
  border-bottom: 1px solid #ffe082;
  padding: 7px 20px;
  font-size: 12px;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: sticky;
  top: var(--header-h);
  z-index: 99;
}
.info-bar strong { font-weight: 600; }
.info-bar em { font-style: normal; color: var(--navy-light); font-weight: 500; }
.info-dot { color: #c8a020; }
.info-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.info-close:hover { background: rgba(0,0,0,0.06); color: var(--gray-700); }

/* ============================================
   PAGE LAYOUT
   ============================================ */
.page-wrapper {
  display: flex;
  min-height: calc(100vh - 176px);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: 244px;
  min-width: 244px;
  background: var(--white);
  border-right: var(--border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 176px);
  position: sticky;
  top: 176px;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: var(--border);
  flex-shrink: 0;
  background: var(--gray-50);
}
.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 3px;
  border-radius: var(--radius-sm);
}
.sidebar-close-btn:hover { background: var(--gray-200); }

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 13px 14px;
}
.sidebar-foot {
  padding: 11px 13px;
  border-top: var(--border);
  flex-shrink: 0;
  background: var(--white);
}

/* Filter Groups */
.fgroup {
  padding: 11px 0;
  border-bottom: var(--border);
}
.fgroup:last-child { border-bottom: none; }
.flabel {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin-bottom: 8px;
}
.flabel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.flabel-row .flabel { margin-bottom: 0; }
.frange-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  font-family: var(--font-mono);
}

.chips-wrap { display: flex; flex-wrap: wrap; gap: 4px; }

/* Shape Grid */
.shape-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.shape-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 10px;
  color: var(--gray-600);
}
.shape-chip:hover { border-color: var(--navy-light); color: var(--navy); background: var(--navy-pale); }
.shape-chip.active { border-color: var(--navy); background: var(--navy); color: var(--white); }
.shape-chip img { width: 24px; height: 24px; object-fit: contain; }
.shape-chip.active img { filter: brightness(0) invert(1); }

/* Dual range */
.dual-range { position: relative; }
.dual-range .range-slider { display: block; width: 100%; }

/* Two inputs */
.two-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.two-inputs .input { flex: 1; }

/* Toggles */
.toggles-list { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Page title bar */
.page-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: var(--white);
  border-bottom: var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 11px;
  color: var(--gray-400);
  display: block;
  margin-top: 1px;
}
.title-right { display: flex; align-items: center; gap: 8px; }

/* Active filters */
.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--navy-pale);
  border-bottom: 1px solid var(--ice-deep);
  flex-wrap: wrap;
}
.af-label { font-size: 11px; color: var(--navy-mid); font-weight: 500; flex-shrink: 0; }
.af-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.af-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 500;
}
.af-tag-remove {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 0 0 2px;
  transition: color var(--transition);
}
.af-tag-remove:hover { color: white; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 16px;
  background: var(--gray-50);
  border-bottom: var(--border);
  flex-wrap: wrap;
}
.toolbar-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.toolbar-right   { display: flex; align-items: center; gap: 10px; }
.toolbar-sep { width: 1px; height: 20px; background: var(--gray-200); margin: 0 1px; }

.result-info { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.result-info strong { color: var(--gray-900); font-weight: 600; }

.view-toggle { display: flex; border: var(--border-md); border-radius: var(--radius-md); overflow: hidden; }
.view-btn { padding: 6px 9px; border: none; background: var(--white); cursor: pointer; color: var(--gray-500); transition: all var(--transition); }
.view-btn.active { background: var(--navy); color: var(--white); }

/* Content Section */
.content-section {
  padding: 14px 16px;
  flex: 1;
}

/* ============================================
   DETAIL DRAWER
   ============================================ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,31,60,0.4);
  z-index: 300;
  backdrop-filter: blur(2px);
}
.overlay.open { display: block; }

.detail-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 500px;
  max-width: 95vw;
  height: 100vh;
  background: var(--white);
  box-shadow: var(--shadow-xl);
  z-index: 301;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform var(--transition-md);
}
.detail-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: var(--border);
  background: var(--navy);
  flex-shrink: 0;
}
.drawer-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--white);
  font-weight: 500;
}

.drawer-media {
  background: linear-gradient(145deg, var(--navy-pale), var(--ice));
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.diamond-placeholder { text-align: center; }
.diamond-viz {
  font-size: 64px;
  filter: drop-shadow(0 4px 16px rgba(79,195,247,0.5));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.media-label { font-size: 11px; color: var(--gray-400); margin-top: 4px; display: block; }
.drawer-media-actions { display: flex; gap: 8px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-section { margin-bottom: 18px; }
.drawer-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: var(--border);
}
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer-field label { font-size: 11px; color: var(--gray-400); display: block; margin-bottom: 3px; }
.drawer-field value { font-size: 13px; font-weight: 600; color: var(--gray-900); display: block; font-family: var(--font-mono); }
.drawer-field value.large { font-size: 18px; color: var(--navy); font-weight: 700; }

.drawer-footer {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: var(--border);
  flex-shrink: 0;
  background: var(--white);
}

/* ============================================
   COMPARE BAR
   ============================================ */
.compare-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(90deg, var(--navy), var(--navy-mid));
  color: var(--white);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100%);
  transition: transform var(--transition-md);
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.compare-bar.visible { transform: translateY(0); }
.compare-label { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.8); white-space: nowrap; }
.compare-slots { display: flex; gap: 8px; flex: 1; overflow-x: auto; }
.cslot {
  background: rgba(255,255,255,0.08);
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 11px;
  min-width: 110px;
  text-align: center;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  transition: all var(--transition);
}
.cslot.filled { background: rgba(255,255,255,0.15); border-style: solid; border-color: rgba(255,255,255,0.4); color: var(--white); font-weight: 500; }
.compare-clear-btn { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.6); background: transparent; }
.compare-clear-btn:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9); }

/* ============================================
   COMPARE MODAL
   ============================================ */
.compare-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 401;
  width: min(900px, 95vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-md);
}
.compare-modal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: all; }
.compare-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: var(--border);
  background: var(--navy);
  color: var(--white);
}
.compare-modal-header h2 { font-family: var(--font-display); font-size: 18px; }
.compare-modal-body { overflow-x: auto; overflow-y: auto; padding: 20px; flex: 1; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: var(--border); }
.compare-table td { padding: 10px 14px; border-bottom: var(--border); }
.compare-table tr:last-child td { border-bottom: none; }
.compare-table .label-col { font-weight: 500; color: var(--gray-600); background: var(--gray-50); }
.compare-table .highlight { color: var(--navy); font-weight: 700; font-family: var(--font-mono); }

/* ============================================
   SIDEBAR OVERLAY (mobile)
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}
.sidebar-overlay.open { display: block; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1180px) {
  .sidebar { display: none; position: fixed; top: 0; left: 0; height: 100vh; z-index: 160; width: 280px; transform: translateX(-100%); transition: transform var(--transition-md); }
  .sidebar.open { display: flex; transform: translateX(0); }
  .sidebar-close-btn { display: flex; }
  .btn-hamburger { display: flex; }
  .header-nav { display: none; }
  .topbar-timing { display: none; }
}

@media (max-width: 768px) {
  .header-search-wrap { display: none; }
  .topbar-left { gap: 8px; }
  .toolbar { gap: 4px; padding: 6px 10px; }
  .content-section { padding: 10px; }
}
