:root {
  --app-primary: #0284c7;
  --app-primary-hover: #0369a1;
  --app-soft: #eff6ff;
  --app-text: #0f172a;
  --app-muted: #64748b;
  --app-border: #e5e7eb;
  --app-shadow: 0 .25rem 1rem rgba(15, 23, 42, .06);
  --app-shadow-hover: 0 .5rem 1.5rem rgba(15, 23, 42, .10);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background: #f8fafc;
  color: var(--app-text);
}

a {
  text-decoration: none;
}

img,
video,
iframe {
  max-width: 100%;
}

.btn,
.form-control,
.form-select,
.card,
.modal-content,
.alert,
.badge,
.dropdown-menu,
.input-group-text {
  border-radius: .25rem !important;
}

.btn-primary {
  background: var(--app-primary);
  border-color: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--app-primary-hover);
  border-color: var(--app-primary-hover);
}

.card {
  border: 0;
  box-shadow: var(--app-shadow);
}

.app-loading {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .75);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.app-loading.show,
.app-loading.is-show {
  display: flex;
}

.hero {
  background: linear-gradient(135deg, #e0f2fe, #fff);
  border-radius: .25rem;
}

.text-brand {
  color: var(--app-primary) !important;
}

/* =========================================================
   Product listing cards
   ใช้กับ index.php / products.php / home product card
========================================================= */
.product-grid {
  align-items: stretch;
}

.product-card {
  position: relative;
  height: 100%;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-hover);
}

.product-img-wrap,
.product-no-img {
  width: 100%;
  height: 220px;
  background: linear-gradient(135deg, #f8fbff, #eef7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-no-img {
  color: #0d6efd;
  flex-direction: column;
  text-align: center;
}

.product-no-img i {
  font-size: 3.5rem;
  opacity: .85;
}

.product-no-img span {
  margin-top: .35rem;
  font-size: .9rem;
  color: var(--app-muted);
}

.product-card-title {
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  letter-spacing: .01em;
}

@media (min-width: 1400px) {
  .col-xxl-5th {
    flex: 0 0 auto;
    width: 20%;
  }
}

/* =========================================================
   Product detail page
   กันรูป / thumbnail / video ล้นกรอบบน product.php
========================================================= */
.product-gallery,
.product-detail-gallery,
.product-media-gallery {
  min-width: 0;
}

.product-main-image,
.product-detail-main-image,
.product-gallery-main,
.product-image-main {
  width: 100%;
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: .25rem;
  overflow: hidden;
}

.product-main-image img,
.product-detail-main-image img,
.product-gallery-main img,
.product-image-main img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  background: #fff;
}

.product-thumbs,
.product-thumbnail-list,
.product-gallery-thumbs,
.product-thumb-list {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: .25rem .125rem .5rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.product-thumbs img,
.product-thumbnail-list img,
.product-gallery-thumbs img,
.product-thumb-list img,
.product-thumb,
.product-thumbnail {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: cover;
  border: 1px solid var(--app-border);
  border-radius: .25rem;
  background: #fff;
  cursor: pointer;
  scroll-snap-align: start;
}

.product-thumbs img.active,
.product-thumbnail-list img.active,
.product-gallery-thumbs img.active,
.product-thumb-list img.active,
.product-thumb.active,
.product-thumbnail.active {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 .15rem rgba(2, 132, 199, .12);
}

.product-video-box,
.product-video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: .25rem;
  overflow: hidden;
  background: #000;
}

.product-video-box iframe,
.product-video-wrap iframe,
.product-video-box video,
.product-video-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* =========================================================
   Responsive
========================================================= */
@media (max-width: 575.98px) {
  .container-fluid {
    padding-left: .5rem !important;
    padding-right: .5rem !important;
  }

  .product-grid {
    --bs-gutter-x: .5rem;
    --bs-gutter-y: .5rem;
  }

  .product-card .card-body {
    padding: .65rem;
  }

  .product-card .card-footer {
    padding: .65rem !important;
  }

  .product-card-title {
    font-size: .88rem;
    line-height: 1.25;
    min-height: 2.2em;
  }

  .product-price {
    font-size: 1rem !important;
  }

  .product-no-img,
  .product-img-wrap {
    height: 145px;
  }

  .product-no-img i {
    font-size: 2.4rem;
  }

  .product-no-img span {
    font-size: .75rem;
  }

  .product-card .btn {
    font-size: .82rem;
    padding: .45rem .35rem;
  }

  .product-card .badge {
    font-size: .7rem;
    white-space: normal;
  }

  .product-card .small {
    font-size: .74rem;
  }

  .product-thumbs img,
  .product-thumbnail-list img,
  .product-gallery-thumbs img,
  .product-thumb-list img,
  .product-thumb,
  .product-thumbnail {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .product-no-img,
  .product-img-wrap {
    height: 190px;
  }
}

@media (min-width: 992px) {
  .product-no-img,
  .product-img-wrap {
    height: 220px;
  }
}
