:root {
  --bs-primary: #c0392b;
  --bs-danger: #c0392b;
  --bs-primary-rgb: 192, 57, 43;
  --bs-danger-rgb: 192, 57, 43;
}

.btn-primary, .btn-danger {
  background-color: #c0392b;
  border-color: #c0392b;
}
.btn-primary:hover, .btn-danger:hover {
  background-color: #a93226;
  border-color: #a93226;
}
.btn-outline-danger {
  color: #c0392b;
  border-color: #c0392b;
}
.btn-outline-danger:hover {
  background-color: #c0392b;
  border-color: #c0392b;
}

a { color: #c0392b; }

/* Filter Tags */
.filter-tags .btn-sm {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}
.filter-tags .btn-dark {
  background-color: #212529;
  border-color: #212529;
}
.filter-group {
  row-gap: 0.4rem;
}

/* MemoriesLab Layout */
.memorylabs-layout {
  display: flex;
  gap: 1.5rem;
}
.memorylabs-col-left {
  flex: 2;
  min-width: 0;
}
.memorylabs-col-right {
  flex: 1;
  min-width: 0;
}
.memorylabs-grid-left {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.memorylabs-grid-right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* MemoryLab Card */
.memorylab-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
  break-inside: avoid;
  position: relative;
}
.memorylab-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
  z-index: 10;
}
.memorylab-card-img {
  width: 100%;
  overflow: hidden;
  background: #f4f4f6;
}
.memorylab-card-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.memorylab-card-small {
  height: 546px;
}
.memorylab-card-small .memorylab-card-img {
  height: 406px;
}
.memorylab-card-large {
  height: 819px;
}
.memorylab-card-large .memorylab-card-img {
  height: 679px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.memorylab-card-large .memorylab-card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
}
.memorylab-card-large .memorylab-card-img img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.memorylab-card-body {
  height: 140px;
  padding: 0.875rem;
  background: #fff;
  overflow: hidden;
}
.memorylab-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.3;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.memorylab-card-subtitle {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.memorylab-card-body .memorylab-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 2.8em;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.memorylab-card:hover .memorylab-card-body .memorylab-card-tags {
  max-height: 500px;
  overflow: visible;
}
.memorylab-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: #f0f0f0;
  color: #555;
  border-radius: 12px;
  word-break: break-word;
  white-space: normal;
}

/* Mobile Filter Bar */
.mobile-filter-bar {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-filter-bar::-webkit-scrollbar {
  display: none;
}
.mobile-filter-btn {
  flex: 1 0 auto;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid #c0392b;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s ease;
}
.mobile-filter-btn.unselected {
  background-color: #c0392b;
  color: #fff;
}
.mobile-filter-btn.selected {
  background-color: #fff;
  color: #c0392b;
}

/* Mobile Filter Modal */
.filter-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0,0,0,0.5);
  align-items: flex-end;
  justify-content: center;
}
.filter-modal-content {
  background: #fff;
  width: 100%;
  max-height: 70vh;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.filter-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
}
.filter-modal-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.filter-modal-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  line-height: 1;
}
.filter-modal-body {
  overflow-y: auto;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}
.filter-modal-option {
  display: block;
  padding: 0.75rem 1.25rem;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 1px solid #f5f5f5;
}
.filter-modal-option.active {
  color: #c0392b;
  font-weight: 600;
  background: #fdf2f2;
}
.filter-modal-option:last-child {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 991px) {
  .memorylabs-layout {
    flex-direction: column;
  }
  .memorylabs-grid-left {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }
  .memorylabs-grid-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }
  .memorylab-card-small,
  .memorylab-card-large {
    height: auto;
  }
  .memorylab-card {
    display: block;
    border-radius: 8px;
  }
  .memorylab-card-small .memorylab-card-img {
    height: auto;
    flex: none;
    position: relative;
    aspect-ratio: 4 / 5;
  }
  .memorylab-card-large .memorylab-card-img {
    height: auto;
    flex: none;
    position: relative;
    aspect-ratio: 4 / 5;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .memorylab-card-large .memorylab-card-img img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  .memorylab-card-img img {
    height: auto;
  }
  .memorylab-card-body {
    height: auto;
  }
  .memorylab-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.5rem 0.4rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
    color: #fff;
  }
  .memorylab-card-overlay .memorylab-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
  }
  .memorylab-card-overlay .memorylab-card-subtitle {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.85);
    margin-bottom: 0.25rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .memorylab-card-overlay .memorylab-card-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    overflow: hidden;
  }
  .memorylab-card-overlay .memorylab-tag {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
    flex-shrink: 0;
  }
  .memorylab-card-overlay .memorylab-tag:nth-child(n+4) {
    display: none;
  }
}

@media (min-width: 992px) {
  .memory-detail-title {
    text-align: center;
    margin-bottom: 20px;
  }
  .memory-detail-image {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
  }
  .memory-detail-image img {
    width: 50%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 12px;
  }
}

/* Cookie consent banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #dee2e6;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  z-index: 9999;
}
.cookie-banner p {
  flex: 1 1 auto;
}
@media (max-width: 767px) {
  .cookie-banner .container {
    flex-direction: column;
    text-align: center;
  }
}
