/* Gallery Page Custom CSS */

/* Import base styles */
:root {
  --iraq-orange: #f97316;
  --iraq-orange-dark: #ea580c;
  --iraq-orange-darker: #c2410c;
  --sand-light: #fdf2e7;
  --sand-medium: #f7cd9f;
  --sand-dark: #ed9455;
  --emerald: #10b981;
  --emerald-dark: #059669;
}

/* Base Styles */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
}

html {
  scroll-behavior: smooth;
}

/* Custom Utilities */
.text-primary-custom {
  color: var(--iraq-orange) !important;
}

.bg-primary-custom {
  background-color: var(--iraq-orange) !important;
}

.btn-primary-custom {
  background: linear-gradient(
    135deg,
    var(--iraq-orange),
    var(--iraq-orange-dark)
  );
  border: none;
  color: white;
  font-weight: 500;
  padding: 0.5rem 1.5rem;
  border-radius: 0.75rem;
  transition: all 0.3s ease;
}

.btn-primary-custom:hover {
  background: linear-gradient(
    135deg,
    var(--iraq-orange-dark),
    var(--iraq-orange-darker)
  );
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
  color: white;
}

.btn-primary-custom.active {
  background: linear-gradient(
    135deg,
    var(--iraq-orange-dark),
    var(--iraq-orange-darker)
  );
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.hero-gradient {
  background: linear-gradient(
    135deg,
    var(--iraq-orange) 0%,
    var(--iraq-orange-dark) 50%,
    var(--iraq-orange-darker) 100%
  );
}

/* Glass Effect */
.glass-nav {
  backdrop-filter: blur(16px) saturate(180%);
  background-color: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(251, 226, 199, 0.3);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-out;
}

.animate-zoom-in {
  animation: zoomIn 0.6s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out;
}

/* Navigation */
.navbar-brand .brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--iraq-orange-darker);
  margin: 0;
}

.navbar-brand .brand-subtitle {
  font-size: 0.75rem;
  color: var(--sand-dark);
  margin: -0.25rem 0 0 0;
}

.logo-icon {
  background: linear-gradient(
    135deg,
    var(--iraq-orange),
    var(--iraq-orange-dark)
  );
  padding: 0.5rem;
  border-radius: 0.75rem;
}

.logo-icon i {
  color: white;
  font-size: 1.5rem;
}

.nav-link {
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.nav-link.active {
  color: var(--iraq-orange) !important;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--iraq-orange),
    var(--iraq-orange-dark)
  );
  border-radius: 1px;
}

/* Page Header */
.page-header {
  padding: 120px 0 80px;
  position: relative;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.text-white-75 {
  color: rgba(255, 255, 255, 0.75);
}

/* Stats Section */
.stats-section {
  border-bottom: 1px solid #e5e7eb;
}

.stat-item {
  padding: 1rem;
  transition: transform 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-5px);
}

.stat-item i {
  font-size: 2rem;
  display: block;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--iraq-orange);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* Filter Section */
.filter-section .btn {
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

/* Search Section */
.search-section .input-group-text {
  background: white;
  border-right: none;
  color: var(--iraq-orange);
}

.search-section .form-control {
  border-left: none;
  border-radius: 0 0.5rem 0.5rem 0;
}

.search-section .form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(249, 115, 22, 0.25);
  border-color: var(--iraq-orange);
}

/* Gallery Grid */
.gallery-section {
  min-height: 60vh;
}

.gallery-item {
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.6s ease-out forwards;
}

.gallery-item:nth-child(1) {
  animation-delay: 0.1s;
}
.gallery-item:nth-child(2) {
  animation-delay: 0.2s;
}
.gallery-item:nth-child(3) {
  animation-delay: 0.3s;
}
.gallery-item:nth-child(4) {
  animation-delay: 0.4s;
}
.gallery-item:nth-child(5) {
  animation-delay: 0.5s;
}
.gallery-item:nth-child(6) {
  animation-delay: 0.6s;
}
.gallery-item:nth-child(7) {
  animation-delay: 0.7s;
}
.gallery-item:nth-child(8) {
  animation-delay: 0.8s;
}

.gallery-card {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.gallery-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.images-container {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* aspect-ratio: 1;  تم التعطيل لعرض الصورة بالحجم الفعلي */
}

.gallery-images {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-images {
  transform: scale(1.1);
}

.images-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.3) 50%,
    rgba(0, 0, 0, 0.8) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
}

.gallery-card:hover .images-overlay {
  opacity: 1;
}

.overlay-content {
  align-self: flex-end;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.gallery-card:hover .overlay-content {
  transform: translateY(0);
}

.images-title {
  color: white;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.images-location {
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  font-size: 0.875rem;
}

.overlay-icons {
  align-self: flex-start;
  display: flex;
  gap: 0.5rem;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.gallery-card:hover .overlay-icons {
  transform: translateY(0);
}

.overlay-icons .btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  transition: all 0.3s ease;
}

.overlay-icons .btn:hover {
  background: white;
  transform: scale(1.1);
}

.zoom-btn:hover {
  color: var(--iraq-orange) !important;
}

.like-btn:hover {
  color: #ef4444 !important;
}

.like-btn.liked {
  color: #ef4444 !important;
  background: white !important;
}

.like-btn.liked i {
  font-weight: 900;
}

/* Filter States */
.gallery-item.hidden {
  opacity: 0;
  transform: translateY(-20px) scale(0.8);
  pointer-events: none;
  position: absolute;
  z-index: -1;
}

.gallery-item.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

/* Load More Button */
#loadMoreBtn {
  border-radius: 2rem;
  padding: 0.75rem 2rem;
  font-weight: 500;
  border: 2px solid var(--iraq-orange);
  color: var(--iraq-orange);
  transition: all 0.3s ease;
}

#loadMoreBtn:hover {
  background: var(--iraq-orange);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
}

#loadMoreBtn.loading {
  position: relative;
  color: transparent;
}

#loadMoreBtn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--iraq-orange);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* No Results */
.no-results {
  padding: 3rem 0;
}

.no-results i {
  font-size: 4rem;
  display: block;
}

/* Gallery Modal */
.modal-content {
  border: none;
  border-radius: 0;
}

.modal-body img {
  border-radius: 0.5rem;
}

#prevBtn,
#nextBtn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7) !important;
  border: none;
  color: white;
  transition: all 0.3s ease;
}

#prevBtn:hover,
#nextBtn:hover {
  background: rgba(0, 0, 0, 0.9) !important;
  transform: scale(1.1);
}

.modal-body .bg-dark {
  backdrop-filter: blur(10px);
}

/* Masonry Effect for larger screens */
@media (min-width: 992px) {
  .gallery-item:nth-child(4n + 1) .images-container {
    aspect-ratio: 4/5;
  }

  .gallery-item:nth-child(4n + 3) .images-container {
    aspect-ratio: 5/4;
  }
}

/* CTA Section */
.cta-section {
  position: relative;
}

/* Footer */
.footer-section {
  background: linear-gradient(135deg, #1f2937 0%, #111827 50%, #0f172a 100%);
}

.footer-section a {
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: var(--iraq-orange);
}

.contact-links a {
  transition: all 0.3s ease;
}

.contact-links a:hover {
  color: var(--iraq-orange) !important;
  transform: translateX(5px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .page-header {
    padding: 100px 0 60px;
  }

  .page-header h1 {
    font-size: 2.5rem;
  }

  .stat-item {
    padding: 0.5rem;
  }

  .stat-item i {
    font-size: 1.5rem;
  }

  .stat-number {
    font-size: 1.25rem;
  }

  .filter-section .d-flex {
    justify-content: center;
  }

  .filter-section .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
  }

  .images-title {
    font-size: 0.875rem;
  }

  .images-location {
    font-size: 0.75rem;
  }

  .overlay-icons .btn {
    width: 32px;
    height: 32px;
  }

  #prevBtn,
  #nextBtn {
    width: 40px;
    height: 40px;
  }

  .modal-body .row {
    flex-direction: column;
  }

  .modal-body .col-md-4 {
    text-align: center;
    margin-top: 1rem;
  }
}

@media (max-width: 576px) {
  .page-header h1 {
    font-size: 2rem;
  }

  .navbar-brand .brand-title {
    font-size: 1.1rem;
  }

  .navbar-brand .brand-subtitle {
    font-size: 0.7rem;
  }

  .gallery-item {
    margin-bottom: 1rem;
  }

  .images-container {
    aspect-ratio: 1.2 !important;
  }

  .overlay-content {
    padding: 0.5rem;
  }

  .overlay-icons {
    padding: 0.5rem;
    gap: 0.25rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for better accessibility */
.btn:focus,
.nav-link:focus,
.gallery-card:focus {
  outline: 2px solid var(--iraq-orange);
  outline-offset: 2px;
}

.gallery-card {
  cursor: pointer;
}

.gallery-card:focus {
  transform: translateY(-4px);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .images-overlay {
    background: linear-gradient(
      to bottom,
      transparent 0%,
      rgba(0, 0, 0, 0.5) 50%,
      rgba(0, 0, 0, 0.9) 100%
    );
  }

  .gallery-card {
    border: 1px solid #333;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .filter-section,
  .search-section,
  .overlay-icons,
  .cta-section,
  .footer-section {
    display: none !important;
  }

  .gallery-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
    margin-bottom: 1rem;
  }

  .images-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
  }

  .images-title,
  .images-location {
    color: #333 !important;
  }
}

/* Loading Animation for images */
.gallery-images {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.gallery-images[src] {
  background: none;
  animation: none;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
