/* ======================================================
   DLCPrice Responsive UI — shared across all apps
   ~/shared/css/responsive.css
   ====================================================== */

/* App accent color — override per-app in base.html <style> */
:root {
  --dlc-accent: #007bff;
  --dlc-accent-dark: #0056b3;
  --dlc-bg-filter: #343a40;
}

/* -------------------------------------------------------
   Filter bar
   ------------------------------------------------------- */
.dlc-filter {
  padding: 0;
}

/* Row 1: title search */
.dlc-search-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 8px 4px;
}
.dlc-search-row .form-control,
.dlc-search-row .btn {
  min-height: 36px;
}
.dlc-search-btn {
  min-height: 36px;
  min-width: 36px;
  background: var(--dlc-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0 10px;
  flex-shrink: 0;
}
.dlc-search-btn:hover {
  background: var(--dlc-accent-dark);
  color: #fff;
}
.dlc-clear-btn {
  min-height: 36px;
  min-width: 36px;
  background: transparent;
  border: 1px solid #6c757d;
  border-radius: 6px;
  color: #adb5bd;
  padding: 0 8px;
  flex-shrink: 0;
}
.dlc-clear-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* Row 2: autocomplete inputs */
.dlc-autocomplete-row {
  padding: 0 8px 4px;
  gap: 6px;
}
.dlc-autocomplete-row .form-control {
  min-height: 36px;
  font-size: 14px;
}
@media (max-width: 767px) {
  .dlc-autocomplete-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  /* 3-item row: first item spans full width */
  .dlc-autocomplete-row.three-items > div:first-child {
    grid-column: 1 / -1;
  }
}
@media (min-width: 768px) {
  .dlc-autocomplete-row {
    display: flex;
  }
  .dlc-autocomplete-row > div {
    flex: 1;
  }
}

/* Autocomplete suggestion box */
.dlc-suggest-box {
  position: absolute;
  z-index: 1000;
  width: 100%;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

/* Row 3: chip bar */
.dlc-chip-bar {
  display: flex;
  gap: 6px;
  padding: 4px 8px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dlc-chip-bar::-webkit-scrollbar {
  display: none;
}
@media (min-width: 768px) {
  .dlc-chip-bar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* Chip pill button */
.dlc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: #e9ecef;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.dlc-chip:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.dlc-chip.has-options:not(.has-selection) {
  border-color: #FB02FF;
  color: #FB02FF;
  font-weight: 600;
}
.dlc-chip.has-selection {
  background: var(--dlc-accent);
  border-color: var(--dlc-accent);
  color: #fff;
}
.dlc-chip.is-open {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.dlc-chip-count {
  background: rgba(255,255,255,0.3);
  border-radius: 10px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: bold;
}
.has-selection .dlc-chip-count {
  background: rgba(0,0,0,0.2);
}
.dlc-chip-caret {
  font-size: 9px;
  opacity: 0.7;
}

/* Chip dropdown panel — positioned via JS (position:fixed, appended to body) */
.dlc-chip-dropdown {
  z-index: 1050;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 10px;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.dlc-chip-dropdown-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 5px 8px;
  min-height: 32px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  font-size: 13px;
  box-sizing: border-box;
}
.dlc-chip-dropdown-search:focus {
  outline: none;
  border-color: var(--dlc-accent);
  box-shadow: 0 0 0 2px rgba(0,123,255,.15);
}

.dlc-chip-dropdown-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.dlc-chip-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  color: #212529;
}
.dlc-chip-dropdown-item:hover {
  background: #f8f9fa;
}
.dlc-chip-dropdown-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--dlc-accent);
  flex-shrink: 0;
  cursor: pointer;
}
.dlc-chip-dropdown-item input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--dlc-accent);
  flex-shrink: 0;
  cursor: pointer;
}

.dlc-chip-dropdown-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid #dee2e6;
}
.dlc-chip-dropdown-selall,
.dlc-chip-dropdown-clear {
  flex: 1;
  padding: 5px;
  font-size: 12px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  cursor: pointer;
  color: #495057;
}
.dlc-chip-dropdown-selall:hover,
.dlc-chip-dropdown-clear:hover { background: #e9ecef; }
.dlc-chip-dropdown-apply {
  flex: 2;
  padding: 5px;
  font-size: 12px;
  border: none;
  border-radius: 5px;
  background: var(--dlc-accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.dlc-chip-dropdown-apply:hover { background: var(--dlc-accent-dark); }

/* -------------------------------------------------------
   Product card grid
   ------------------------------------------------------- */
.dlc-grid {
  display: grid;
  gap: 10px;
  padding: 10px 0;
}
@media (max-width: 767px) {
  .dlc-grid { grid-template-columns: 1fr; }
}
@media (min-width: 768px) {
  .dlc-grid { grid-template-columns: 1fr 1fr; }
}

/* -------------------------------------------------------
   Product card
   ------------------------------------------------------- */
.dlc-card {
  display: flex;
  border: 1px solid rgba(0,0,0,.13);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  min-height: 140px;
}
.dlc-card-img-wrap {
  width: 110px;
  flex-shrink: 0;
  background: #f8f9fa;
}
.dlc-card-img-wrap img {
  width: 100%;
  height: 100%;
  min-height: 140px;
  object-fit: cover;
  display: block;
}

.dlc-card-body {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Campaign badge */
.dlc-card-campaign {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--dlc-accent);
  color: #fff;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dlc-card-campaign a {
  color: inherit;
  text-decoration: none;
}

/* Title */
.dlc-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #212529;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dlc-card-title a {
  color: inherit;
  text-decoration: none;
}
.dlc-card-title a:hover { text-decoration: underline; }

/* Meta */
.dlc-card-meta {
  font-size: 11px;
  color: #6c757d;
  overflow: hidden;
}
.dlc-card-meta a {
  color: #6c757d;
  text-decoration: none;
}
.dlc-card-meta a:hover { text-decoration: underline; color: var(--dlc-accent); }
/* Restore Bootstrap badge text colors overridden by the meta link color */
.dlc-card-meta .badge { color: #fff !important; }
.dlc-card-meta .badge-light,
.dlc-card-meta .badge-warning { color: #212529 !important; }

/* Price + button row */
.dlc-card-footer-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
  gap: 6px;
}
.dlc-card-price-wrap {
  font-size: 12px;
  line-height: 1.3;
}
.dlc-card-price {
  font-size: 13px;
  font-weight: bold;
  color: #dc3545;
}
.dlc-card-price-del {
  font-size: 10px;
  color: #adb5bd;
  text-decoration: line-through;
  margin-right: 2px;
}
.dlc-card-price-regular {
  font-size: 12px;
  color: #495057;
}
.dlc-card-price-off {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  background: #dc3545;
  border-radius: 3px;
  vertical-align: middle;
  line-height: 1.5;
}
.dlc-card-btn {
  display: inline-block;
  min-height: 30px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--dlc-accent);
  color: #fff !important;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 24px;
  border: none;
}
.dlc-card-btn:hover {
  background: var(--dlc-accent-dark);
  color: #fff;
  text-decoration: none;
}

/* Dark mode: cards in dark bg context */
.bg-dark .dlc-card,
.container-fluid .dlc-card {
  border-color: rgba(255,255,255,.1);
}

/* Image popup cursor */
.dlc-img-popup {
  cursor: zoom-in;
}

/* Card action buttons column (detail + affiliate) */
.dlc-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  flex-shrink: 0;
}
.dlc-card-btn-ext {
  display: inline-block;
  min-height: 28px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  border: 1px solid var(--dlc-accent);
  color: var(--dlc-accent) !important;
  background: transparent;
  text-decoration: none !important;
  white-space: nowrap;
  line-height: 22px;
}
.dlc-card-btn-ext:hover {
  background: var(--dlc-accent);
  color: #fff !important;
}

/* Lightbox overlay */
.dlc-lightbox-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.dlc-lightbox-overlay.active {
  display: flex;
}
.dlc-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: default;
}
.dlc-lightbox-close {
  position: absolute;
  top: 12px;
  right: 18px;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  user-select: none;
}
.dlc-lightbox-close:hover { opacity: 1; }

/* -------------------------------------------------------
   Favorites (お気に入り) feature
   ------------------------------------------------------- */

/* Heart button on product cards */
.dlc-fav-btn {
  background: transparent;
  border: none;
  padding: 2px 6px;
  cursor: pointer;
  color: #adb5bd;
  font-size: 1.1rem;
  line-height: 1;
  transition: color 0.15s;
  vertical-align: middle;
}
.dlc-fav-btn:hover { color: #dc3545; }
.dlc-fav-btn.dlc-fav-active { color: #dc3545; }

/* Navbar favorites count badge */
.dlc-fav-nav-count {
  display: none;
  background: #dc3545;
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 2px;
}

/* -------------------------------------------------------
   Filter Presets bar
   ------------------------------------------------------- */
.dlc-preset-bar {
  padding: 6px 8px 4px;
}
.dlc-preset-bar .gap-1 { gap: 0.35rem !important; }
.dlc-preset-item {
  display: inline-flex;
  align-items: stretch;
}
.dlc-preset-item .btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.dlc-preset-del {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding: 0 .35rem;
  font-size: 1rem;
  line-height: 1;
}

/* 関連作品カルーセル (詳細ページ) */
.related-axis {
  margin: 8px 0 14px;
}
.related-axis-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
}
.related-axis-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #495057;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.related-more {
  flex-shrink: 0;
  font-size: 12px;
  color: #0d6efd;
  text-decoration: none;
  white-space: nowrap;
}
.related-more:hover {
  text-decoration: underline;
}
.related-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px;
}
.related-carousel::-webkit-scrollbar {
  height: 6px;
}
.related-carousel::-webkit-scrollbar-thumb {
  background: #dee2e6;
  border-radius: 3px;
}
.related-card {
  flex: 0 0 130px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #212529;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 4px;
  background: #fff;
  transition: box-shadow .12s ease;
}
.related-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  text-decoration: none;
  color: #212529;
}
.related-card-img-wrap {
  width: 100%;
  aspect-ratio: 3/4;
  background: #f8f9fa;
  overflow: hidden;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.related-card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.related-card-title {
  font-size: 11px;
  line-height: 1.3;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.related-card-price {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
  color: #495057;
}
.related-card-price-dc {
  color: #dc3545;
}
.related-card-price-del {
  font-size: 10px;
  font-weight: 400;
  color: #adb5bd;
  text-decoration: line-through;
  margin-right: 3px;
}
.related-card-price-tier {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: #6c757d;
  background: #e9ecef;
  border-radius: 2px;
  padding: 0 3px;
  margin-right: 3px;
  vertical-align: 1px;
}
