/* Custom styles */
.nav-link {
  border: 1px solid transparent;
  font-weight: 500;
}

.nav-link.active {
  background-color: #fef2f4;
  border-color: #fbd0da;
  color: #d33f65;
  font-weight: 600;
}

.nav-link.active i {
  color: #d33f65;
}

.sidebar-section-label {
  margin-bottom: 0.5rem;
  padding: 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.page-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #fff7f9 100%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.page-eyebrow {
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d33f65;
}

.page-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.page-section-description {
  margin-top: 0.35rem;
  max-width: 42rem;
  font-size: 0.92rem;
  color: #64748b;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  width: 100%;
  max-width: 460px;
}

.summary-tile {
  border: 1px solid #f1f5f9;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.85rem 0.95rem;
}

.summary-tile-label {
  font-size: 0.72rem;
  color: #64748b;
}

.summary-tile-value {
  margin-top: 0.2rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.section-card {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.section-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fcfcfd;
}

.section-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.section-card-description {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: #64748b;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  width: 100%;
}

.toolbar-search {
  grid-column: span 2;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.pagination-summary {
  font-size: 0.82rem;
  color: #64748b;
}

.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.pagination-limit-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: #475569;
}

.pagination-limit-select {
  min-width: 4.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.65rem;
  background: #ffffff;
  padding: 0.4rem 0.65rem;
  color: #0f172a;
}

.pagination-page-indicator {
  min-width: 5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #d1d5db;
  border-radius: 0.65rem;
  background: #ffffff;
  color: #475569;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  border-color: #f8a9bb;
  background: #fff7f9;
  color: #d33f65;
}

.pagination-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.empty-state-panel {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #94a3b8;
}

.empty-state-panel i {
  margin-bottom: 0.75rem;
  font-size: 2rem;
}

.table-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: #64748b;
}

.password-field input {
  padding-right: 3rem;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  color: #94a3b8;
  transition: color 0.2s ease;
}

.password-toggle-btn:hover {
  color: #475569;
}

.password-toggle-btn:focus-visible {
  outline: 2px solid #f27a95;
  outline-offset: 2px;
  border-radius: 9999px;
}

.action-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  background: #ffffff;
  color: #64748b;
  transition: all 0.2s;
}

.action-menu-trigger:hover,
.action-menu-trigger[aria-expanded='true'] {
  color: #0f172a;
  border-color: #f8a9bb;
  background: #fff7f9;
}

.action-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 15;
  min-width: 12rem;
  padding: 0.4rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.action-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.65rem;
  border-radius: 0.7rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.82rem;
  color: #334155;
  transition: background 0.2s, color 0.2s;
}

.action-menu-item:hover {
  background: #f8fafc;
  color: #0f172a;
}

.action-menu-item--danger {
  color: #dc2626;
}

.action-menu-item--danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.scanner-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 9999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.45rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.scanner-video-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid #dbe4f0;
  border-radius: 1rem;
  background: radial-gradient(circle at top left, #14213d 0%, #0f172a 50%, #1e293b 100%);
  min-height: 15rem;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.25rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
}

.scanner-placeholder h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.scanner-placeholder p {
  max-width: 26rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.78);
}

.scanner-placeholder-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.1rem;
}

.scanner-overlay-ring {
  position: absolute;
  inset: 14%;
  border: 2px dashed rgba(255, 255, 255, 0.78);
  border-radius: 1rem;
  pointer-events: none;
}

.scanner-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #334155;
  padding: 0.55rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.scanner-status-pill--success {
  background: #dcfce7;
  color: #166534;
}

.scanner-status-pill--error {
  background: #fee2e2;
  color: #b91c1c;
}

.scanner-tip-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.55rem;
  color: #475569;
  font-size: 0.84rem;
}

.scanner-empty-state {
  min-height: 15rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #fff7f9 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  padding: 1.5rem;
  color: #64748b;
}

.scanner-empty-state h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #334155;
}

.scanner-empty-state p {
  max-width: 28rem;
  font-size: 0.88rem;
}

.scanner-empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #94a3b8;
  font-size: 1rem;
}

/* Image gallery */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.image-card {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 1;
  background: #f3f4f6;
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.image-card:hover img {
  transform: scale(1.05);
}

.image-card .delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-card:hover .delete-btn {
  opacity: 1;
}

/* Loading spinner */
.spinner {
  border: 3px solid #e5e7eb;
  border-top-color: #e8688a;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  animation: spin 0.6s linear infinite;
}

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

/* Toast animations */
.toast-enter {
  animation: slideIn 0.3s ease-out;
}

.toast-exit {
  animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Drag and drop upload area */
.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #e8688a;
  background-color: #fef2f4;
}

/* Table styles */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  background: #f9fafb;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.data-table th.text-center,
.data-table td.text-center {
  text-align: center;
}

.data-table tr:hover td {
  background: #f9fafb;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Responsive helpers */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.modal-open {
  overflow: hidden;
}

.modal-panel {
  width: min(100%, 42rem);
  max-height: 90vh;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.modal-panel--wide {
  width: min(100%, 72rem);
}

.modal-panel--image {
  width: min(100%, 64rem);
  background: transparent;
  border: none;
  box-shadow: none;
}

.detail-card {
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #ffffff;
  padding: 1rem;
}

.detail-stat-card {
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.image-grid--detail {
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
}

.image-card--detail {
  aspect-ratio: 4 / 3;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}

.image-empty-state {
  grid-column: 1 / -1;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  background: #f8fafc;
  padding: 1.5rem 1rem;
  text-align: center;
  color: #94a3b8;
}

/* Sidebar submenu under Barang */
.nav-sub-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  color: #4b5563;
  background: #ffffff;
  border: 1px solid transparent;
  font-size: 0.72rem;
  line-height: 1rem;
  transition: all 0.2s;
}

.nav-sub-link:hover {
  border-color: #f8a9bb;
  background: #fef7f9;
  color: #952949;
}

.nav-sub-link.active {
  border-color: #f27a95;
  background: #fef2f4;
  color: #b22e52;
  font-weight: 600;
}

@media (max-width: 767px) {
  .data-table th,
  .data-table td {
    padding: 0.625rem 0.75rem;
    white-space: nowrap;
  }

  .table-scroll .data-table {
    min-width: 620px;
  }

  #page-title {
    font-size: 1.125rem;
    line-height: 1.5rem;
  }

  #page-actions {
    width: 100%;
  }

  #page-actions > * {
    width: 100%;
  }

  .page-hero {
    padding: 1rem;
  }

  .toolbar-grid {
    grid-template-columns: 1fr;
  }

  .pagination-bar,
  .pagination-controls {
    width: 100%;
    justify-content: flex-start;
  }

  #toast-container {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
  }

  #toast-container > div {
    width: 100%;
    min-width: 0;
  }

  #modal {
    align-items: flex-end;
  }

  .modal-panel {
    width: calc(100% - 1rem);
    max-height: 92vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .image-grid--detail {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1023px) {
  #items-sidebar-list {
    max-height: 13rem;
  }
}
