/* ============================================
   Zaitun Mehendi - Designs Page Styles
   Free Design Gallery with Masonry Layout
   ফ্রি ডিজাইন ডাউনলোড ও শেয়ার ফিচার সহ
   Updated: 2 designs per row on mobile
   ============================================ */

/* ===== Gallery Header ===== */
.gallery-header {
  padding: 40px 0 30px;
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, var(--cream-50) 0%, var(--cream-200) 100%);
  border-radius: 0 0 50px 50px;
  margin-bottom: 30px;
  overflow: hidden;
}

.islamic-pattern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 20% 30%, var(--pattern-gold) 2px, transparent 2px);
  background-size: 50px 50px;
  opacity: 0.1;
  pointer-events: none;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.gallery-title {
  font-size: clamp(2rem, 6vw, 2.8rem);
  color: var(--olive-900);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.title-icon {
  font-size: 2rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.gallery-subtitle {
  font-size: 1.1rem;
  color: var(--ink-600);
  margin-bottom: 30px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Gallery Stats */
.gallery-stats {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.stat-item {
  text-align: center;
  background: white;
  padding: 12px 18px;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gold-200);
  min-width: 100px;
}

.stat-number {
  display: block;
  font-size: 1.6rem;
  font-weight: var(--font-bold);
  color: var(--olive-700);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--ink-600);
}

/* ===== Categories Section ===== */
.categories-section {
  margin-bottom: 30px;
}

.categories-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 20px;
  padding-bottom: 5px;
}

.categories-wrapper::-webkit-scrollbar {
  display: none;
}

.categories-scroll {
  display: flex;
  gap: 10px;
  padding: 5px 2px;
}

.category-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid rgba(47, 79, 47, 0.2);
  border-radius: 50px;
  background: white;
  color: var(--ink-700);
  font-size: 0.9rem;
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.category-btn i {
  color: var(--olive-600);
  font-size: 0.9rem;
}

.category-btn .count {
  background: var(--cream-200);
  color: var(--olive-700);
  padding: 2px 6px;
  border-radius: 50px;
  font-size: 0.75rem;
  margin-left: 4px;
}

.category-btn:hover {
  background: var(--cream-200);
  border-color: var(--gold-400);
  transform: translateY(-2px);
}

.category-btn.active {
  background: var(--olive-700);
  color: white;
  border-color: var(--olive-700);
  box-shadow: 0 4px 12px rgba(47, 79, 47, 0.3);
}

.category-btn.active i {
  color: var(--gold-300);
}

.category-btn.active .count {
  background: var(--gold-500);
  color: var(--olive-900);
}

/* Gallery Search */
.gallery-search {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrapper {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  font-size: 0.95rem;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 2px solid transparent;
  border-radius: 50px;
  font-size: 0.95rem;
  background: white;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.search-input:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.sort-wrapper {
  min-width: 140px;
}

.sort-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--ink-200);
  border-radius: 50px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%232F4F2F" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--gold-500);
}

/* ===== Masonry Grid ===== */
.gallery-section {
  min-height: 60vh;
  padding: 20px 0 40px;
}

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 0;
  width: 100%;
}

/* Design Card */
.design-card {
  background: white;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  border: 1px solid rgba(212, 175, 55, 0.1);
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.design-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--gold-300);
}

.design-image-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: pointer;
}

.design-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.design-card:hover .design-image {
  transform: scale(1.05);
}

/* Design Actions Overlay */
.design-actions-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.design-card:hover .design-actions-overlay {
  opacity: 1;
}

.action-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: white;
  color: var(--olive-700);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(15px);
  opacity: 0;
}

.design-card:hover .action-btn {
  transform: translateY(0);
  opacity: 1;
}

.action-btn:nth-child(1) { transition-delay: 0.1s; }
.action-btn:nth-child(2) { transition-delay: 0.15s; }

.action-btn:hover {
  background: var(--olive-700);
  color: white;
  transform: translateY(-2px) scale(1.05);
}

.download-btn:hover {
  background: var(--gold-500);
  color: var(--olive-900);
}

/* Category Badge */
.design-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  color: var(--olive-800);
  padding: 4px 8px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: var(--font-semibold);
  border: 1px solid var(--gold-300);
  z-index: 2;
}

/* Design Info */
.design-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.design-title {
  font-size: 0.9rem;
  font-weight: var(--font-semibold);
  color: var(--ink-900);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.design-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.7rem;
  color: var(--ink-500);
}

.design-stats {
  display: flex;
  align-items: center;
  gap: 3px;
}

.design-stats i {
  color: var(--gold-500);
  font-size: 0.7rem;
}

.design-category-text {
  background: var(--cream-200);
  padding: 2px 6px;
  border-radius: 50px;
  margin-left: auto;
  font-size: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.design-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  background: var(--cream-100);
  color: var(--olive-600);
  padding: 3px 8px;
  border-radius: 50px;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.tag:hover {
  background: var(--olive-100);
  border-color: var(--gold-400);
}

/* ===== Lightbox Modal ===== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  display: none;
}

.lightbox.open {
  display: block;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease;
}

.lightbox-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 1400px;
  max-height: 95vh;
  background: white;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-2xl);
  animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cream-300);
  background: white;
}

.lightbox-title {
  font-size: 1.1rem;
  color: var(--olive-800);
  margin: 0;
}

.lightbox-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--cream-200);
  border-radius: 50%;
  color: var(--ink-600);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: var(--error);
  color: white;
  transform: rotate(90deg);
}

.lightbox-body {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  max-height: calc(90vh - 70px);
  overflow-y: auto;
  background: var(--cream-50);
}

/* Lightbox Image */
.lightbox-image-container {
  position: relative;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.lightbox-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.lightbox-image.zoomed {
  cursor: zoom-out;
  transform: scale(1.5);
}

.image-zoom-tooltip {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.lightbox-image-container:hover .image-zoom-tooltip {
  opacity: 1;
}

/* Lightbox Details */
.lightbox-details {
  padding: 20px;
  overflow-y: auto;
}

.design-info {
  margin-bottom: 20px;
}

.design-info h4 {
  font-size: 1.5rem;
  color: var(--olive-900);
  margin-bottom: 8px;
}

.design-meta {
  display: flex;
  gap: 15px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--ink-600);
}

.design-category {
  background: var(--gold-100);
  color: var(--olive-800);
  padding: 3px 10px;
  border-radius: 50px;
}

.design-description {
  line-height: 1.7;
  color: var(--ink-700);
  margin-bottom: 18px;
  font-size: 0.95rem;
}

/* Design Actions */
.design-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.share-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.share-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-btn.whatsapp { background: #25D366; }
.share-btn.facebook { background: #1877F2; }
.share-btn.twitter { background: #000000; }
.share-btn.copy { background: var(--olive-700); }

.share-btn:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Design Tags */
.design-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 15px 0;
}

.design-tag {
  background: var(--cream-200);
  color: var(--olive-700);
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--gold-200);
}

.design-tag:hover {
  background: var(--olive-700);
  color: white;
  border-color: var(--olive-700);
}

/* Related Designs */
.related-designs {
  margin-top: 25px;
}

.related-designs h5 {
  font-size: 1rem;
  color: var(--olive-800);
  margin-bottom: 12px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.related-item {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
  aspect-ratio: 4/5;
}

.related-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-item span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.8), transparent);
  color: white;
  padding: 8px;
  font-size: 0.75rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.related-item:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-lg);
}

.related-item:hover span {
  transform: translateY(0);
}

/* ===== Inspiration Section ===== */
.inspiration-section {
  padding: 30px 0 50px;
}

.inspiration-card {
  background: linear-gradient(135deg, var(--olive-900) 0%, var(--olive-700) 100%);
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  color: white;
  box-shadow: var(--shadow-xl);
}

.inspiration-content {
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.inspiration-content h2 {
  color: white;
  margin-bottom: 12px;
  font-size: 1.5rem;
}

.inspiration-content p {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.inspiration-image {
  height: 100%;
}

.inspiration-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Loading & Empty States ===== */
.loading-state,
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

.loading-state .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--cream-300);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state i {
  font-size: 3rem;
  color: var(--ink-300);
  margin-bottom: 15px;
}

.empty-state h3 {
  color: var(--ink-700);
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.empty-state p {
  color: var(--ink-500);
  margin-bottom: 15px;
  font-size: 0.9rem;
}

/* ===== Load More Button ===== */
.load-more-container {
  text-align: center;
  margin-top: 25px;
}

.btn-large {
  padding: 12px 30px;
  font-size: 1rem;
}

/* ===== Responsive Design ===== */
/* Tablet: 3 designs per row */
@media (min-width: 640px) {
  .masonry-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
  
  .related-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .gallery-stats {
    gap: 20px;
  }
  
  .stat-item {
    padding: 16px 24px;
    min-width: 120px;
  }
  
  .stat-number {
    font-size: 2rem;
  }
}

/* Desktop: 4 designs per row */
@media (min-width: 1024px) {
  .masonry-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
  
  .gallery-search {
    flex-wrap: nowrap;
  }
  
  .design-title {
    font-size: 1rem;
  }
  
  .design-meta {
    font-size: 0.75rem;
  }
}

/* Large Desktop: 5 designs per row */
@media (min-width: 1280px) {
  .masonry-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 768px) {
  .lightbox-body {
    grid-template-columns: 1fr;
    max-height: 90vh;
  }
  
  .lightbox-image-container {
    min-height: 250px;
  }
  
  .lightbox-image {
    max-height: 50vh;
  }
  
  .inspiration-card {
    grid-template-columns: 1fr;
  }
  
  .inspiration-content {
    order: 2;
    padding: 25px;
  }
  
  .inspiration-image {
    order: 1;
    height: 180px;
  }
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .masonry-grid {
    gap: 12px;
  }
  
  .design-info {
    padding: 8px;
  }
  
  .design-title {
    font-size: 0.85rem;
  }
  
  .design-category-text {
    max-width: 70px;
  }
  
  .action-btn {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
  
  .gallery-search {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-wrapper,
  .sort-wrapper {
    width: 100%;
  }
  
  .stat-item {
    padding: 10px 15px;
    min-width: 80px;
  }
  
  .stat-number {
    font-size: 1.4rem;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
}

/* ===== Print Styles ===== */
@media print {
  .design-actions-overlay,
  .design-actions,
  .share-buttons,
  .load-more-container,
  .categories-section,
  .gallery-search {
    display: none;
  }
  
  .design-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .masonry-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

/* ===== Animations ===== */
.animate-fade-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeUp 0.6s ease forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Helper Classes ===== */
.hidden {
  display: none !important;
}

/* Smooth scrolling for modal */
.lightbox-details {
  scrollbar-width: thin;
  scrollbar-color: var(--gold-500) var(--cream-200);
}

.lightbox-details::-webkit-scrollbar {
  width: 5px;
}

.lightbox-details::-webkit-scrollbar-track {
  background: var(--cream-200);
}

.lightbox-details::-webkit-scrollbar-thumb {
  background: var(--gold-500);
  border-radius: 10px;
}