/* =========================================================
   Font Setup: Calibri (Luxury Humanist Sans-Serif)
   ========================================================= */
@font-face {
  font-family: 'Calibri';
  src: local('Calibri Light'),
       url('/fonts/calibril.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Calibri';
  src: local('Calibri'),
       url('/fonts/Calibri.ttf') format('truetype');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Calibri';
  src: local('Calibri Bold'),
       url('/fonts/Calibrib.ttf') format('truetype');
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

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

body {
  font-family: 'Calibri', 'Carlito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #FFFFFF;
  color: #1E293B;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.top-header {
  background-color: #FFFFFF;
  border-bottom: 2px solid #E60012; /* Garis Merah Yamaha */
  padding: 0.85rem 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.yamaha-official-logo {
  height: 36px;
  max-height: 36px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

.brand-divider {
  width: 2px;
  height: 26px;
  background-color: #E2E8F0;
  flex-shrink: 0;
}

.brand-heading {
  font-family: 'Calibri', sans-serif;
  font-size: clamp(1.1rem, 3.2vw, 1.35rem);
  font-weight: 700;
  color: #002D72;
  letter-spacing: 0.2px;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}


/* Update Info Bar & Button */
.update-info-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.update-text-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #475569;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.update-text-group:hover {
  background-color: #F1F5F9;
}

.update-icon {
  font-size: 0.85rem;
}

.update-label {
  font-family: 'Calibri', sans-serif;
  font-weight: 600;
  color: #64748B;
  letter-spacing: 0.3px;
}

.update-date-value {
  font-family: 'Calibri', sans-serif;
  color: #002D72;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.btn-upload-db {
  font-family: 'Calibri', sans-serif;
  background-color: #FFFFFF;
  color: #002D72;
  border: 1px solid #002D72;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-upload-db:hover {
  background-color: #002D72;
  color: #FFFFFF;
}

.btn-logout-db {
  background-color: transparent;
  color: #64748B;
  border: 1px solid #CBD5E1;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout-db:hover {
  background-color: #FEE2E2;
  color: #DC2626;
  border-color: #FCA5A5;
}


/* Main Container */
.main-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
  flex: 1;
  box-sizing: border-box;
}

/* Kotak Pencarian */
.search-card {
  margin-bottom: 1.75rem;
  width: 100%;
}

.search-form {
  display: flex;
  align-items: stretch;
  border: 2px solid #002D72;
  border-radius: 8px;
  overflow: hidden;
  background-color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.95rem 1.15rem;
  font-family: 'Calibri', sans-serif;
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.2px;
  border: none;
  outline: none;
  color: #0F172A;
  background-color: #FFFFFF;
  box-sizing: border-box;
}

.search-input::placeholder {
  color: #94A3B8;
  font-weight: 400;
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  letter-spacing: 0;
}

.btn-scan {
  font-family: 'Calibri', sans-serif;
  background-color: #F8FAFC;
  color: #002D72;
  border: none;
  border-left: 1px solid #CBD5E1;
  padding: 0 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-scan:hover {
  background-color: #EEF2F6;
  color: #E60012;
}

.btn-search {
  font-family: 'Calibri', sans-serif;
  background-color: #E60012; /* Merah Resmi Yamaha */
  color: #FFFFFF;
  border: none;
  border-left: 1px solid #CC0010;
  padding: 0 1.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-search:hover {
  background-color: #CC0010;
}

/* State Messages */
.state-message {
  text-align: center;
  padding: 2.25rem 1rem;
  color: #64748B;
  font-size: 0.95rem;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  margin-top: 1rem;
  box-sizing: border-box;
}

/* Card Khusus: Kode Part Tidak Tersedia di Database */
.not-found-card {
  text-align: center;
  padding: 2.25rem 1.5rem;
  background-color: #FFFFFF;
  border: 1.5px solid #FCA5A5;
  border-radius: 12px;
  margin-top: 1.25rem;
  box-shadow: 0 4px 14px rgba(230, 0, 18, 0.05);
  box-sizing: border-box;
}

.not-found-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 0.95rem auto;
  background: #FFF1F2;
  border: 1.5px solid #FECDD3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.not-found-title {
  font-family: 'Calibri', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #991B1B;
  letter-spacing: 0.1px;
  margin-bottom: 0.65rem;
}

.not-found-code-badge {
  display: inline-block;
  background-color: #FEE2E2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-family: 'Calibri', monospace, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.not-found-desc {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 580px;
  margin: 0 auto;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E2E8F0;
  border-top-color: #E60012;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem auto;
}

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

/* Tabel Hasil Pencarian (Desktop & Laptop) */
.desktop-table-wrapper {
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

@media (max-width: 768px) {
  .desktop-table-wrapper {
    display: none !important;
  }
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.result-table thead th {
  font-family: 'Calibri', sans-serif;
  background-color: #F8FAFC;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.9rem 1.15rem;
  border-bottom: 2px solid #CBD5E1;
  white-space: nowrap;
}

.result-table tbody td {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #E2E8F0;
  font-size: 0.95rem;
  color: #0F172A;
  vertical-align: middle;
}

.result-table tbody tr:hover {
  background-color: #F8FAFC;
}

.text-right {
  text-align: right;
}

/* Format Kolom Spesifik */
.col-code {
  font-family: 'Calibri', monospace, sans-serif;
  font-size: 1.18rem;
  font-weight: 700;
  color: #002D72;
  letter-spacing: 0.5px;
}

.col-partname {
  font-weight: 600;
  color: #0F172A;
  line-height: 1.35;
  letter-spacing: 0.2px;
}

.col-category {
  font-family: 'Calibri', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  background-color: #F1F5F9;
  border: 1px solid #E2E8F0;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}

.col-price {
  font-family: 'Calibri', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #047857;
  display: block;
  white-space: nowrap;
}

/* Superseeding Code Badge */
.col-supercede {
  font-family: 'Calibri', monospace, sans-serif;
  display: inline-flex;
  align-items: center;
  background-color: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.col-supercede:hover {
  background-color: #FDE68A;
}

.col-supercede-none {
  color: #94A3B8;
  font-weight: 500;
}

/* Tampilan Mobile (Khusus Layar HP/Smartphone) */
.mobile-cards-container {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

@media (max-width: 768px) {
  .mobile-cards-container {
    display: flex !important;
  }
}

.mobile-part-card {
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 0.95rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

.m-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.m-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Responsif Khusus Tablet & Handphone */
@media (max-width: 768px) {
  .top-header {
    padding: 0.75rem 1rem;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
  .brand-box {
    width: 100%;
  }
  .update-info-bar {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .main-container {
    padding: 1.25rem 1rem;
  }
  .btn-search {
    padding: 0 1.35rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .top-header {
    padding: 0.65rem 0.75rem;
  }
  .yamaha-official-logo {
    height: 28px;
    max-height: 28px;
  }
  .brand-divider {
    height: 22px;
  }
  .brand-heading {
    font-size: 0.98rem;
    line-height: 1.2;
  }
  .update-text-group {
    font-size: 0.76rem;
    padding: 0.28rem 0.55rem;
  }
  .btn-upload-db {
    font-size: 0.72rem;
    padding: 0.32rem 0.65rem;
  }
  .main-container {
    padding: 1rem 0.75rem;
  }
  .search-card {
    margin-bottom: 1.25rem;
  }
  .search-input {
    padding: 0.75rem 0.85rem;
    font-size: 0.95rem;
  }
  .btn-scan {
    padding: 0 0.85rem;
    font-size: 0.88rem;
    gap: 0.3rem;
  }
  .btn-scan span {
    display: none; /* Icon scan saja di layar HP agar tidak mempersempit input */
  }
  .btn-search {
    padding: 0 1rem;
    font-size: 0.9rem;
    gap: 0.35rem;
  }
  .mobile-part-card {
    padding: 0.85rem;
    gap: 0.5rem;
  }
  .col-code {
    font-size: 1rem;
  }
  .col-price {
    font-size: 1.05rem;
  }
}

@media (max-width: 360px) {
  .brand-heading {
    font-size: 0.88rem;
  }
  .btn-search span {
    display: none; /* Hanya icon search jika di layar ultra-kecil < 360px */
  }
  .btn-search {
    padding: 0 0.85rem;
  }
  .btn-scan {
    padding: 0 0.75rem;
  }
}

/* Scanner Modal & Camera Viewport */
.scanner-card {
  max-width: 480px;
  width: 100%;
}

.scanner-viewport-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  min-height: 240px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: #0F172A;
  border: 2px solid #002D72;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

#scannerReader {
  width: 100% !important;
  border: none !important;
}

#scannerReader video {
  width: 100% !important;
  height: auto !important;
  border-radius: 8px;
  object-fit: cover;
}

.scanner-status-text {
  font-family: 'Calibri', 'Carlito', sans-serif;
  font-size: 0.9rem;
  color: #64748B;
  margin-top: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #002D72;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #94A3B8;
  line-height: 1;
}

.modal-close:hover {
  color: #0F172A;
}

.modal-body {
  padding: 1.5rem;
}

.modal-info {
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 1rem;
}

.dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: 8px;
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  background: #F8FAFC;
  transition: all 0.15s;
}

.dropzone:hover {
  border-color: #002D72;
  background: #EFF6FF;
}

.drop-file-name {
  display: inline-block;
  margin-top: 0.65rem;
  background: #DBEAFE;
  color: #1E40AF;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-primary {
  background-color: #E60012;
  color: #FFFFFF;
  border: none;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #475569;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}
