:root {
  --primary: #a00000e7;
  --primary-dark: #0c2ab4;
  --secondary: #a00000e7;
  --white: #FFFFFF;
  --light: #f8f5f5;
  --light-2: #f2eaea;
  --dark: #0e0d0de5;
  --text-muted: #6b6767;
}
*, *::before, *::after {
  box-sizing: border-box;
}
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(180deg, var(--light) 0%, var(--white) 100%);
  color: var(--dark);
}
.bg-soft { background: var(--light); }
.navbar-brand { letter-spacing: 1px; }
.card {
  border: 1px solid rgba(128, 0, 0, 0.1);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(128, 0, 0, 0.08);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.sidebar-panel {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--white);
  min-height: 100vh;
  padding: 1.15rem 0.9rem;
  position: relative;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 320px;
  max-width: 320px;
  width: 100%;
  align-self: flex-start;
  overflow-y: auto;
  max-height: 100vh;
  z-index: 1;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.65rem 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  margin-bottom: 1rem;
}
.sidebar-brand div {
  min-width: 0;
}
.sidebar-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.16);
  font-size: 1.1rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  padding: 0.78rem 0.8rem;
  border-radius: 12px;
  color: rgba(255,255,255,0.95);
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 0.25rem;
  white-space: nowrap;
}
.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(255,255,255,0.17);
  color: #ffffff;
}
.sidebar-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
}
.sidebar-link span {
  flex: 1;
  min-width: 0;
}
.sidebar-panel .sidebar-section {
  flex: 1;
}
.sidebar-panel .sidebar-link.mt-3 {
  margin-top: 1rem;
}
.sidebar-panel .sidebar-brand .sidebar-logo {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.18);
  padding: 0.35rem;
  border-radius: 12px;
}
.school-brand-bar {
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(128,0,0,0.12);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 20px rgba(128,0,0,0.06);
}
.admin-page .school-brand-bar {
  display: none;
}
.container-fluid.px-0 {
  padding-left: 0;
  padding-right: 0;
}
.row.g-0.align-items-start {
  align-items: start;
}
.admin-page .sidebar-panel,
.public-page .sidebar-panel {
  min-height: 100vh;
  flex: 0 0 300px;
  max-width: 320px;
  width: 100%;
}
.admin-page .sidebar-panel {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 320px;
  z-index: 1000;
  overflow-y: auto;
}
.admin-page main,
.public-page main {
  padding: 1.25rem 1.5rem 1.5rem;
  background: #f4f5f9;
}
.admin-page main {
  margin-left: 320px;
}
.admin-page .card {
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 18px 40px rgba(0,0,0,0.04);
}
.admin-page .card h5,
.admin-page .card h6 {
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
}
.admin-page .card h3 {
  font-size: 2rem;
  margin: 0;
  line-height: 1.1;
}
.admin-page .card ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.admin-page .card ul li {
  margin-bottom: 0.6rem;
  color: rgba(0,0,0,0.72);
}
.admin-page .dashboard-summary .card {
  min-height: 140px;
}
.school-logo, .sidebar-logo, .login-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
}
.school-brand-title {
  color: var(--primary);
}
.login-logo {
  width: 72px;
  height: 72px;
}
.sidebar-section { margin-top: 1rem; }
.sidebar-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.78);
  padding: 0 0.7rem 0.45rem;
}
.table-responsive {
  overflow-x: auto;
}
.table {
  width: 100%;
  font-size: 0.85rem;
  table-layout: fixed;
}
.table th,
.table td {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  padding: 0.45rem 0.55rem;
}
.table thead th {
  white-space: normal;
  word-break: break-word;
}
.table th {
  font-size: 0.82rem;
}
.table td {
  font-size: 0.82rem;
}
.table th:nth-child(1),
.table td:nth-child(1) {
  width: 4%;
  min-width: 40px;
}
.table th:nth-child(2),
.table td:nth-child(2) {
  width: 8%;
  min-width: 70px;
}
.table th:nth-child(3),
.table td:nth-child(3) {
  width: 12%;
  min-width: 90px;
}
.table th:nth-child(4),
.table td:nth-child(4) {
  width: 10%;
  min-width: 80px;
}
.table th:nth-child(5),
.table td:nth-child(5) {
  width: 7%;
  min-width: 60px;
}
.table th:nth-child(6),
.table td:nth-child(6) {
  width: 10%;
  min-width: 85px;
}
.table th:nth-child(7),
.table td:nth-child(7) {
  width: 7%;
  min-width: 60px;
}
.table th:nth-child(8),
.table td:nth-child(8) {
  width: 12%;
  min-width: 90px;
}
.table th:nth-child(9),
.table td:nth-child(9) {
  width: 10%;
  min-width: 80px;
}
.table th:nth-child(10),
.table td:nth-child(10) {
  width: 8%;
  min-width: 70px;
}
.table th:nth-child(11),
.table td:nth-child(11) {
  width: 15%;
  min-width: 110px;
}
.table td:last-child {
  text-align: center;
}
.table td.action-buttons {
  white-space: normal;
  overflow: visible;
  min-width: 140px;
}
.table td.action-buttons .btn {
  white-space: nowrap;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  padding: 0.78rem 0.8rem;
  border-radius: 12px;
  color: var(--white);
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 0.25rem;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,0.18);
  color: var(--white);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}
.page-title {
  color: var(--primary);
  font-weight: 700;
}
.user-page .page-title,
.user-page .card-title,
.user-page p,
.user-page li,
.user-page strong,
.user-page .form-label,
.user-page .form-text,
.user-page .table,
.user-page .table td,
.user-page .table th,
.user-page .alert {
  color: #000000 !important;
}
.profile-page .page-title,
.profile-page label {
  color: #000000;
}
.school-brand-title {
  color: #000000 !important;
}
.school-brand-bar .small,
.school-brand-bar a,
.school-brand-bar .badge {
  color: #000000 !important;
}
.table thead {
  background: var(--primary);
  color: var(--white);
}

/* Compact table variant for denser displays */
.table-sm-custom th,
.table-sm-custom td {
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
}

/* Narrow numeric columns (Jumlah) */
.col-jumlah { width: 90px; max-width: 110px; text-align: center; }
.col-jumlah td, .col-jumlah th { text-align: center; }

/* Wider status column (slimmer for proportional layout) */
.col-status {
  width: auto;
  min-width: 120px;
  max-width: 180px;
  white-space: normal;
}
.col-status .badge {
  white-space: normal;
  line-height: 1.2;
}

/* Responsive adjustments: remove fixed widths on small screens */
@media (max-width: 768px) {
  .col-jumlah { width: auto; min-width: 64px; }
  .col-status { max-width: none; min-width: 100px; }
  .col-status .badge { white-space: normal; }
  .table thead { display: table-header-group; }
}

/* Allow long descriptions in Keterangan column to wrap instead of truncating */
.table td.keterangan-cell {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word;
  max-width: none;
}

/* Make Pengguna and Tanggal Pinjam cells wrap and show full content */
.table td.pengguna-cell,
.table td.tanggal-pinjam-cell {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word;
  max-width: none;
}

/* Kode sometimes is long (with prefixes); allow wrapping when needed */
.table td.kode-cell {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-all;
  max-width: none;
}

/* Wrapping for various columns in admin barang list */
.table td.nama-cell,
.table td.merk-cell,
.table td.lokasi-cell,
.table td.kategori-cell,
.table td.satuan-cell,
.table td.jumlah-total-cell,
.table td.jumlah-tersedia-cell {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word;
  max-width: none;
}

/* Emphasize Tanggal Kembali so it's clearly visible */
.table td.tanggal-kembali-cell {
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  font-weight: 600;
  color: var(--primary-dark);
}
.table thead th { border-bottom: none; }
.hero-section-wrapper {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  position: relative;
}
.hero-section {
  background: linear-gradient(135deg, rgba(128,0,0,0.95), rgba(92,0,0,0.9));
  color: var(--white);
  min-height: 420px;
  position: relative;
}
.hero-banner-img {
  display: block;
  object-fit: cover;
  object-position: center;
  min-height: 420px;
  width: 100% !important;
}
.hero-content {
  z-index: 1;
}
.hero-section .btn-light {
  color: var(--primary);
}

@media (max-width: 1199px) {
  .admin-page .sidebar-panel {
    position: static;
    width: 100%;
    max-width: 100%;
    min-height: auto;
    margin-bottom: 1rem;
  }
  .admin-page main {
    margin-left: 0;
  }
}

@media (min-width: 1200px) {
  .admin-page main {
    margin-left: 320px;
    max-width: calc(100% - 320px);
  }
  .admin-page .table-responsive {
    overflow-x: visible;
  }
}

@media (max-width: 991px) {
  .hero-section {
    min-height: 360px;
  }
  .hero-banner-img {
    min-height: 360px;
  }
  .sidebar-panel {
    flex: 1 1 100%;
    width: 100%;
    position: static;
    min-height: auto;
    margin-bottom: 1rem;
    max-height: none;
  }
  .admin-page main,
  .public-page main {
    padding: 1rem;
    margin-left: 0;
  }
}

.admin-page .card canvas {
  width: 100% !important;
  display: block;
}

.admin-page .card-chart {
  min-height: 360px;
}

.admin-page .card-chart canvas {
  min-height: 320px;
  height: 100% !important;
}

.admin-page .dashboard-summary .card {
  min-height: 140px;
}

.admin-page .card h6 {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.admin-page .card h3 {
  margin-top: 0.65rem;
}

@media (max-width: 576px) {
  .hero-section {
    min-height: 320px;
  }
  .hero-banner-img {
    min-height: 320px;
  }
}

.navbar-custom {
  background-color: #800000 !important;
  background-image: none !important;
}
.navbar-custom .navbar-brand,
.navbar-custom .nav-link {
  color: #ffffff !important;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-item.active .nav-link {
  color: #f2eaea !important;
}
.navbar-custom .btn-outline-light {

  color: #800000 !important;
  border-color: rgba(255,255,255,0.8) !important;
}
.navbar-custom .btn-outline-light:hover {
  background-color: rgba(255,255,255,0.92) !important;
}
.section-heading {
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 1rem;
}
.stat-pill {
  background: var(--light-2);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  color: var(--primary);
  font-weight: 600;
}

.password-input-group {
  position: relative;
}
.password-input-group .form-control {
  padding-right: 2.8rem;
}
.password-toggle-btn {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #6c757d;
  padding: 0;
  cursor: pointer;
}
.password-toggle-btn:hover {
  color: #000000;
}

/* Gallery Styling */
.gallery-item {
  aspect-ratio: 1 / 1;
  background: #f0f0f0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-item img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-overlay {
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}
