* {
  box-sizing: border-box;
}

body {
  font-family: 'Alef', sans-serif;
  direction: rtl;
  text-align: right;
  margin: 0;
  padding: 0;
  background: #f7f7f7;
}

.header {
  background: #c7e7ff;
  color: #fff;
  padding: 2px;
  display: block;
  align-items: center;
  justify-content: space-between;
}

  .header .brand {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 12px;
  }

    .header .brand .brand-logo {
      height: auto;
      max-height: 70px;
      width: auto;
      max-width: 140px;
      display: block;
    }

/* New layout for multiple small logos in navbar */
.brand-logos {
  display: flex;
  gap: 4px; /* reduced spacing between logos */
  align-items: center;
  /* place first source image at the visual right */
  flex-direction: row;
}

  .brand-logos .brand-logo {
    width: 70px;
    height: 70px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    display: inline-block;
    /* remove any inherited padding/margin from Bootstrap or other libraries */
    padding: 0;
    margin: 0;
  }

/* Large brand image for shop page header replacing the text */
.main-header .brand-main-logo {
  display: block;
  margin: 0 auto 8px auto;
  max-width: 420px; /* keep similar visual size to previous large title */
  width: 100%;
  height: auto;
  padding-top: 25px;
}

.main-header .main-title {
  display: none; /* hidden when replaced by image */
}
/* ensure navbar brand image scales on small screens */
.navbar-brand img {
  height: auto;
  max-height: 48px;
  width: auto;
  max-width: 140px;
}

.header nav a {
  color: #fff;
  margin-left: 12px;
  text-decoration: none;
}

/* Navbar toggler styles */
.navbar-toggler {
  border-color: rgba(0,0,0,0.1);
}

.navbar-toggler-icon {
  display: inline-block;
  width: 24px;
  height: 2px;
  background-color: #2a5d84;
  position: relative;
}

  .navbar-toggler-icon::before, .navbar-toggler-icon::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 2px;
    background-color: #2a5d84;
    position: absolute;
    left: 0;
  }

  .navbar-toggler-icon::before {
    top: -7px;
  }

  .navbar-toggler-icon::after {
    top: 7px;
  }

/* Align navbar items RTL when collapsed */
.navbar-nav {
  margin-left: auto;
}

.nav-item {
  padding: 0 10px;
}

.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center
}

.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px
}

.category {
  padding: 8px 12px;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #ddd
}

  /* selected state for category/status chips (shared look) */
  .category.selected,
  .status-label.selected {
    background: #2a5d84;
    color: #fff;
    border-color: transparent;
  }

.status-label {
  padding: 8px 12px;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #ddd;
  display: inline-block;
}

.loans-table {
  width: 100%;
  border-collapse: collapse;
}

  .loans-table th, .loans-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
  }

  .loans-table th {
    background: #f1f7fb;
    text-align: right;
  }

.manage-loans-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.login-container {
  max-width: 420px;
  width: 100%;
  margin: 28px auto;
  background: #fff;
  padding: 18px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

  .login-container h2 {
    margin-top: 0;
  }

.form-control {
  width: 100%;
  padding: 8px 10px;
  margin-top: 6px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 6px
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end
}

.search {
  flex: 1
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 12px
}

.card {
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e0e0e0
}

.card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Deposit-required banner */
.deposit-banner {
  display: block;
  width: 100%;
  padding: 4px 0;
  text-align: center;
  background: rgb(20, 96, 68);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 4px;
  margin-top: 4px;
}

/* Full-width edit strip at top of the card for admins */
.card .admin-edit-link {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end; /* content grouped to the right */
  direction: ltr; /* avoid inheriting RTL so the strip aligns to the visual right */
  gap: 8px;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  background: rgba(0,0,0,0.7); /* semi-transparent black (0.7) */
  color: #fff;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 10;
  cursor: pointer;
}

.card:hover .admin-edit-link {
  opacity: 1;
  transform: translateY(0);
}

.card .admin-edit-link svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.card .admin-edit-link .admin-edit-text {
  color: #fff;
  margin-left: 8px;
  font-weight: 600;
}

/* Track loans strip for admins */
.card .admin-track-link {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  height: 48px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  direction: ltr;
  gap: 8px;
  background: rgba(42, 93, 132, 0.82);
  color: #fff;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 9;
  cursor: pointer;
  font-size: 0.88rem;
}

.card:hover .admin-track-link {
  opacity: 1;
  transform: translateY(0);
}

.card .admin-track-link svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.card .admin-track-link .admin-track-text {
  color: #fff;
  margin-left: 6px;
  font-weight: 600;
}

.card h3 {
  margin: 0 0 8px 0; /* keep title area fixed to two lines */
  line-height: 1.2em;
  max-height: 2.4em; /* 2 lines */
  min-height: 2.4em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card .meta {
  font-size: 0.9rem;
  color: #666
}

  .card .meta.meta-large {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
  }

    .card .meta.meta-large.meta-quantity {
      color: #5ea927;
    }

      .card .meta.meta-large.meta-quantity.out-of-stock {
        color: #ff0018;
      }

.product-thumb {
  width: 100%;
  display: block;
  margin-bottom: 8px;
}

  .product-thumb img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 6px;
  }

/* Stock alert (bell) button floating inside product card */
.card .stock-alert-btn {
  position: absolute;
  left: 12px;
  bottom: 50px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #c0392b;
  color: #c0392b;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  cursor: pointer;
  z-index: 8;
  /* pivot a bit above center to emulate a ringing bell */
  transform-origin: 50% 18%;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

/* hide by default; JS will toggle the 'show' class to display */
.card .stock-alert-btn {
  display: none;
}

  .card .stock-alert-btn.show {
    display: flex;
  }

/* Card action area and quantity input styling moved from inline to CSS */
.card .card-actions {
  margin-top: auto;
  padding-top: 8px;
  position: relative;
}

.card .card-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card .qty-input {
  width: 70px;
  margin-left: 6px;
}

.card .stock-alert-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.card .stock-alert-btn:hover {
  background: #c0392b;
  color: #fff;
  transform: translateY(-2px);
  /* run a short ringing animation a few times on hover */
  animation: ring 0.9s ease-in-out 0s 3;
}

/* Bell ring keyframes: subtle rotation and vertical nudge to simulate ringing */
@keyframes ring {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  10% {
    transform: translateY(-2px) rotate(-15deg);
  }

  30% {
    transform: translateY(0) rotate(12deg);
  }

  50% {
    transform: translateY(-1px) rotate(-10deg);
  }

  70% {
    transform: translateY(0) rotate(6deg);
  }

  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .card .stock-alert-btn,
  .card .stock-alert-btn:hover {
    transition: none;
    animation: none !important;
    transform: none !important;
  }
}

.btn {
  display: inline-block;
  padding: 8px 12px;
  background: #2a5d84;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer
}

  .btn.secondary {
    background: #6c757d
  }

.cart {
  position: fixed;
  left: 16px;
  bottom: 16px;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12)
}

  .cart h4 {
    margin: 0 0 8px 0
  }

  .cart .item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed #eee
  }

.checkout-panel {
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.checkout-section {
  flex: 1 1 300px;
  min-width: 250px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.checkout-section-title {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

footer.footer {
  text-align: center;
  padding: 24px 0;
  color: #666;
  position: relative !important;
}

.toast {
  position: fixed;
  right: 20px;
  top: 20px;
  background: #2e7d32;
  color: #fff;
  padding: 16px 24px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 9999;
  max-width: 360px;
  line-height: 1.4;
}

  .toast.error {
    background: #c62828;
  }

.btn.secondary.quick-btn {
  background: #4a8db5;
  border-color: #4a8db5;
  color: #fff;
}

  .btn.secondary.quick-btn:hover, .btn.secondary.quick-btn.selected {
    background: #1e4460;
    border-color: #1e4460;
  }


  .btn.secondary.quick-btn.selected {
    background-color: #f39c12 !important;
    border-color: #e67e22 !important;
    color: #fff !important;
  }

.small {
  font-size: 0.9rem
}

/* Search autocomplete dropdown */
#searchAutocomplete {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 10000;
  display: none;
  overflow: hidden;
}

.ac-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.97rem;
}

  .ac-item:last-child {
    border-bottom: none;
  }

  .ac-item:hover, .ac-item.ac-active {
    background: #f1f7fb;
  }

/* Main header title/subtitle centering and sizing */
.main-header {
  text-align: center;
  background-color: antiquewhite
}

.main-title {
  font-size: 2.8rem;
  margin: 8px 0 45px 0;
  color: #ff7343
}

.main-subtitle {
  font-size: 1.5rem;
  color: #333;
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.4;
}

/* New styles for icons row */
.icons-row {
  display: flex;
  gap: 0;
  justify-content: center;
  align-items: flex-start;
  margin: 24px 0 18px 0;
  flex-wrap: wrap;
  background-color: antiquewhite;
  padding: 24px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

  .icons-row a {
    display: inline-flex;
    align-items: stretch;
    color: inherit;
    text-decoration: none;
    flex: 0 0 160px;
    min-width: 120px;
    max-width: 180px;
  }

.icon-card {
  background: transparent;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  border-radius: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}

  .icon-card:hover {
    transform: translateY(-6px) scale(1.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
    background: rgba(255,255,255,0.7);
  }

.icon-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.icon-title {
  font-weight: 700;
  margin-top: 10px;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.icon-desc {
  font-size: 0.88rem;
  color: #666;
  margin-top: 4px;
}

/* Converted icon list (was previously a UL) used for small link icons */
.icon-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 8px 0 18px 0;
}

.icon-list-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
}

  .icon-list-item a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none
  }

.icon-list-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center
}

  .icon-list-icon svg, .icon-list-icon img {
    width: 20px;
    height: 20px;
  }

.icon-list-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2a5d84
}

.icon-list-items.inline-items {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 10px;
}

  .image-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
  }

/* Lightbox */
#lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 999;
}

  #lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Image animation */
  #lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
  }

  #lightbox-overlay.active img {
    transform: scale(1);
  }

/* Close button stays the same */
#lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
}

/* Responsive: stack icons on narrow screens */
@media (max-width:720px) {
  .icons-row {
    gap: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
  }

    .icons-row a {
      flex: 0 0 130px;
      min-width: 110px;
    }

  .icon-card {
    padding: 6px 4px;
  }

  /* Make navbar links stack nicely */
  .navbar-collapse .navbar-nav {
    flex-direction: column;
    gap: 8px;
  }

  /* Reduce cart size and spacing on small screens */
  .cart {
    left: 12px;
    bottom: 12px;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
    max-width: 260px;
    font-size: 0.95rem;
  }

    .cart h4 {
      margin: 0 0 6px 0;
      font-size: 1rem;
    }

    .cart .item {
      gap: 6px;
      padding: 4px 0;
    }
}

/* Increase width on larger screens */
@media (min-width: 860px) {
  .login-container {
    max-width: 600px; /* or 600px, whichever you prefer */
  }
}
