/* ==========================================================================
   1. Design System & Global Resets
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', Arial, sans-serif;
}

body {
  background-color: #f6f7fb;
  color: #101426;
  line-height: 1.5;
}

/* ==========================================================================
   2. Application Layout
   ========================================================================== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   3. Sidebar Component
   ========================================================================== */
.sidebar {
  width: 260px;
  background-color: #071124;
  color: #ffffff;
  padding: 24px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  padding: 4px 6px;
}

.logo-img {
  width: 175px;
  max-width: 100%;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  display: block;
}

.wave {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #7c3cff, #4f46e5);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
}

.logo h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.logo small {
  display: block;
  font-size: 9px;
  letter-spacing: 1px;
  color: #d8d8ff;
  text-transform: uppercase;
  margin-top: -2px;
}

.nav-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #9aa7c5;
  margin: 25px 8px 10px;
  letter-spacing: 1px;
  font-weight: 700;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e9edff;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 15px;
  margin: 4px 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.nav a:hover,
.nav a.active {
  background: linear-gradient(135deg, #754cff, #5332ce);
  color: #ffffff;
}

.help {
  background: linear-gradient(135deg, #231a70, #5b3bea);
  padding: 16px;
  border-radius: 12px;
  margin-top: 30px;
}

.help h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.help p {
  font-size: 12px;
  color: #d7d9ff;
  margin-bottom: 14px;
  line-height: 1.4;
}

.help button {
  border: 0;
  background-color: #ffffff;
  color: #4d35d8;
  border-radius: 22px;
  padding: 10px 18px;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  transition: background 0.2s;
}

.help button:hover {
  background-color: #f3f0ff;
}

/* ==========================================================================
   4. Main Content Area
   ========================================================================== */
main {
  margin-left: 260px;
  width: calc(100% - 260px);
  padding: 28px 34px 38px;
}

/* Top Bar Header */
.top {
  text-align: center;
  position: relative;
  margin-bottom: 24px;
}

.top h2 {
  font-size: 29px;
  margin-bottom: 8px;
  font-weight: 800;
}

.top p {
  color: #535a73;
  font-size: 15px;
}

.menu {
  position: absolute;
  left: 0;
  top: 4px;
  font-size: 24px;
  cursor: pointer;
  display: none; /* Mobile navigation trigger */
}

.actions {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  gap: 14px;
  align-items: center;
}

.helpbtn {
  border: 1px solid #e0e3ee;
  background-color: #ffffff;
  border-radius: 10px;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.helpbtn:hover {
  background-color: #f8f9fc;
}

/* ==========================================================================
   5. Search Component
   ========================================================================== */
.search-wrap {
  max-width: 980px;
  margin: 28px auto 16px;
  display: flex;
  border: 1.6px solid #6847ff;
  border-radius: 28px;
  background-color: #ffffff;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(90, 70, 220, 0.1);
  transition: box-shadow 0.3s;
}

.search-wrap:focus-within {
  box-shadow: 0 12px 38px rgba(90, 70, 220, 0.18);
}

.search-wrap input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 18px 24px;
  font-size: 16px;
  color: #1a1d2e;
}

.search-wrap button {
  border: 0;
  background: linear-gradient(135deg, #7154ff, #512bd4);
  color: #ffffff;
  padding: 0 34px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.search-wrap button:hover {
  opacity: 0.95;
}

/* Meta & Sorting */
.meta {
  max-width: 980px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #333a52;
  font-size: 14px;
}

.meta span {
  color: #4f35ff;
  font-weight: 800;
}

.sort {
  background-color: #ffffff;
  border: 1px solid #e1e4ee;
  border-radius: 9px;
  padding: 9px 12px;
  outline: none;
  cursor: pointer;
}

/* ==========================================================================
   6. Category Chips
   ========================================================================== */
.chips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 26px 0;
}

.chip {
  border: 1px solid #e1e4ee;
  background-color: #ffffff;
  border-radius: 22px;
  padding: 11px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.chip.active {
  background: linear-gradient(135deg, #7154ff, #512bd4);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(90, 70, 220, 0.23);
}

/* ==========================================================================
   7. Equipment Card Grid
   ========================================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  background-color: #ffffff;
  border: 1px solid #e8eaf2;
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 10px 26px rgba(35, 42, 70, 0.06);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(35, 42, 70, 0.12);
}

/* Image / SVG Icon Box */
.imgbox {
  height: 240px;
  display: grid;
  place-items: center;
  background-color: #f8f9fc;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
  padding: 12px;
  border: 1px solid #eef0f6;
}

.imgbox svg {
  width: 100%;
  height: 100%;
  padding: 10px;
}

.imgbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease, opacity 0.25s ease;
  border-radius: 8px;
  opacity: 0;
}

.card:hover .imgbox img {
  transform: scale(1.06);
}

.svg-fallback {
  display: none;
  width: 100%;
  height: 100%;
}

/* Card Details */
.card h3 {
  font-size: 16px;
  margin-bottom: 6px;
  font-weight: 700;
  color: #101426;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background-color: #ede8ff;
  color: #5332ce;
  border-radius: 5px;
  padding: 4px 8px;
  margin-bottom: 10px;
  align-self: flex-start;
}

.card p {
  font-size: 13px;
  color: #3f455a;
  line-height: 1.45;
  margin-bottom: 10px;
  flex: 1; /* Pushes technical parameters to bottom */
}

.row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #eef0f6;
}

.row b {
  color: #727a90;
  font-weight: 600;
}

.row span {
  color: #0f1425;
  font-weight: 700;
}

.flow {
  font-size: 11px;
  margin-top: 8px;
  color: #20263a;
  background-color: #f7f6fd;
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1.4;
}

.flow b {
  color: #5332ce;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 2px;
}

/* ==========================================================================
   8. Footer Feature List
   ========================================================================== */
.bottom {
  margin-top: 38px;
  background-color: #eee9ff;
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 20px;
}

.bottom div {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #d8ccff;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bottom h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.bottom p {
  font-size: 12px;
  color: #41465b;
  line-height: 1.35;
}

/* ==========================================================================
   9. Modal Detail Overlay
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  background-color: rgba(6, 10, 25, 0.55);
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal.show {
  display: grid;
}

.modal-card {
  width: min(640px, 100%);
  background-color: #ffffff;
  border-radius: 18px;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.close {
  position: absolute;
  right: 16px;
  top: 12px;
  border: 0;
  background-color: #f0f1f6;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}

.close:hover {
  background-color: #e2e4ed;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 15px;
}

.modal-img {
  width: 100%;
  height: auto;
  background-color: #f8f9fc;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 20px;
  border: 1px solid #eef0f6;
}

.modal-img svg {
  width: 100%;
  height: 100%;
  padding: 15px;
}

.modal-img img {
  max-width: 100%;
  max-height: 380px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  transition: opacity 0.25s ease;
  opacity: 0;
  display: block;
}

.modal h2 {
  margin-bottom: 4px;
  font-size: 24px;
  font-weight: 800;
}

.modal p {
  line-height: 1.55;
  color: #3d4357;
  margin: 8px 0;
  font-size: 14px;
}

.info {
  background-color: #f6f4ff;
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
}

.info p {
  margin: 6px 0;
  font-size: 13px;
}

.info p:first-child {
  margin-top: 0;
}

.info p:last-child {
  margin-bottom: 0;
}

.info b {
  color: #5332ce;
  display: inline-block;
  width: 120px;
}

.no-results {
  padding: 50px;
  text-align: center;
  background-color: #ffffff;
  border-radius: 16px;
  color: #64748b;
  grid-column: 1 / -1;
  border: 1.5px dashed #cbd5e1;
  font-size: 15px;
}

/* ==========================================================================
   10. Responsive Media Queries
   ========================================================================== */
@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bottom {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    width: 260px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .sidebar-close {
    display: block;
    position: absolute;
    right: 18px;
    top: 18px;
    font-size: 26px;
    color: #cbd5e1;
    cursor: pointer;
    line-height: 1;
    z-index: 210;
  }
  
  .sidebar-close:hover {
    color: #ffffff;
  }
  
  main {
    margin-left: 0;
    width: 100%;
    padding: 20px 16px 30px;
  }
  
  .menu {
    display: block;
  }
  
  /* Horizontal Scrolling Category Chips (Premium UX) */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    margin: 16px 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
  }
  
  .chips::-webkit-scrollbar {
    display: none;
  }
  
  .chip {
    flex-shrink: 0;
    padding: 9px 16px;
    font-size: 13px;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .search-wrap {
    border-radius: 18px;
    margin-top: 18px;
  }
  
  .search-wrap button {
    padding: 0 18px;
  }
  
  .meta {
    display: block;
  }
  
  .sort {
    margin-top: 12px;
    width: 100%;
  }
  
  .bottom {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  
  .modal-content {
    grid-template-columns: 1fr;
  }
  
  .modal-img img {
    max-height: 260px;
  }
  
  .actions {
    display: none;
  }
}

.sidebar-close {
  display: none;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(6, 10, 25, 0.45);
  z-index: 150;
  display: none;
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
  display: block;
}

/* ==========================================================================
   11. Preloader Styles
   ========================================================================== */
#preloader {
  position: fixed;
  inset: 0;
  background-color: #060a19; /* Sleek dark background matching sidebar */
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader-content {
  text-align: center;
  color: #ffffff;
  font-family: inherit;
}

.preloader-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.preloader-logo-img {
  max-height: 85px;
  max-width: 260px;
  width: auto;
  object-fit: contain;
  animation: wavePulse 1.6s infinite ease-in-out;
}

.preloader-wave {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #6847ff, #8b6eff);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  animation: wavePulse 1.6s infinite ease-in-out;
}

.preloader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #6847ff;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

.preloader-content p {
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes wavePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(104, 71, 255, 0.4);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 16px 6px rgba(104, 71, 255, 0.25);
  }
}
