/* Gallery specific styles */

/* Gallery-specific styling for image areas */
.gallery-second-image {
  /* Make second image area clickable */
  cursor: pointer;
}

/* Gallery card modifications */
.gallery-card {
  /* Card itself should not animate or show pointer; only images are interactive */
  cursor: default;
  transition: none;
}

/* Override blog.css/card hover so only images animate, not the whole card */
.gallery-card:hover {
  transform: none !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Make only image areas show pointer */
.gallery-card .card-image,
.gallery-card .gallery-second-image {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Subtle zoom/brightness effect only on hovered image area */
.gallery-card .card-image,
.gallery-card .gallery-second-image {
  overflow: hidden;
}

.gallery-card .card-image .card-image-img,
.gallery-card .gallery-second-image .card-image-img {
  transition: transform 0.35s ease, filter 0.35s ease;
}

.gallery-card .card-image:hover .card-image-img,
.gallery-card .gallery-second-image:hover .card-image-img {
  transform: scale(1.05);
  filter: brightness(0.95) contrast(1.05);
}

/* Gallery second image styling */
.gallery-second-image {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  padding: 0 !important;
  cursor: pointer;
  position: relative;
  display: block !important;
  background: transparent !important;
}

/* IMG presentation inside gallery card containers */
.gallery-card .card-image-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Single-image cards: let the first image fill the card height and remove divider */
.gallery-card.single-image .card-image {
  height: 100% !important;
  min-height: 100% !important;
  border-bottom: none !important;
}

/* Delete buttons for gallery images - exact same style as blog.css delete-post-btn */
.delete-image-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, rgba(151, 80, 30, 0.95) 0%, rgba(188, 108, 37, 0.9) 100%);
  border: 1px solid rgba(188, 108, 37, 0.4);
  border-radius: 50%;
  color: var(--text-color);
  font-size: 16px;
  font-weight: 600;
  font-family: 'Ponomar', 'Times New Roman', 'DejaVu Serif', Georgia, serif;
  cursor: pointer;
  z-index: 5;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.3),
      0 2px 6px rgba(151, 80, 30, 0.2),
      inset 0 1px 0 rgba(249, 245, 235, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.delete-image-btn:hover {
  background: linear-gradient(135deg, rgba(188, 108, 37, 1) 0%, rgba(212, 149, 58, 0.95) 100%);
  border-color: rgba(188, 108, 37, 0.6);
  transform: scale(1.05) translateY(-1px);
  box-shadow:
      0 6px 20px rgba(0, 0, 0, 0.4),
      0 3px 12px rgba(188, 108, 37, 0.4),
      inset 0 1px 0 rgba(249, 245, 235, 0.2);
  color: #fff;
}

.delete-image-btn:active {
  transform: scale(0.95);
}

.delete-image-btn .delete-icon {
  line-height: 1;
  font-size: 20px;
  margin-top: -2px;
}

.delete-first-image {
  top: 12px;
  right: 12px;
}

.delete-second-image {
  top: 12px;
  right: 12px;
}

.gallery-icon {
  font-size: 48px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Gallery cards - uniform height of 560.84px for ALL cards */
.gallery-card:not(.add-new-post-card) {
  height: 560.84px !important;
  min-height: 560.84px !important;
}

/* Gallery placeholder card: same uniform height */
.gallery-card.add-new-post-card {
  height: 560.84px !important;
  min-height: 560.84px !important;
}


.gallery-card.card-type-1 .card-image,
.gallery-card.card-type-3 .card-image {
    height: 55%;
    min-height: 286px;
    /* Updated for 440px total height */
}

.gallery-card.card-type-1 .card-content,
.gallery-card.card-type-3 .card-content {
    height: 45%;
    min-height: 154px;
    /* Updated for 440px total height - compact but adequate */
    padding: 18px 16px 9px 16px;
}

/* Cards 2 and 4 - Smaller image areas (40%), larger text areas (60%) */
.gallery-card.card-type-2 .card-image,
.gallery-card.card-type-4 .card-image {
    height: 45%;
    min-height: 176px;
    /* Updated for 440px total height */
}

.gallery-card.card-type-2 .card-content,
.gallery-card.card-type-4 .card-content {
    height: 55%;
    min-height: 264px;
    /* Updated for 440px total height - good text space */
    padding: 18px 16px 9px 16px;
}


/* Responsive heights - maintain uniform 560.84px across all breakpoints */
@media (max-width: 900px) {
  .gallery-card:not(.add-new-post-card) {
    height: 560.84px !important;
    min-height: 560.84px !important;
  }

  .gallery-card.add-new-post-card {
    height: 560.84px !important;
    min-height: 560.84px !important;
  }

  .gallery-card.card-type-1 .card-image,
  .gallery-card.card-type-2 .card-image,
  .gallery-card.card-type-3 .card-image,
  .gallery-card.card-type-4 .card-image {
    height: 280.42px !important;
    min-height: 280.42px !important;
  }

  .gallery-card.card-type-1 .card-content,
  .gallery-card.card-type-2 .card-content,
  .gallery-card.card-type-3 .card-content,
  .gallery-card.card-type-4 .card-content {
    height: 280.42px !important;
    min-height: 280.42px !important;
  }
}

@media (max-width: 768px) {
  .gallery-card:not(.add-new-post-card) {
    height: 560.84px !important;
    min-height: 560.84px !important;
  }

  .gallery-card.add-new-post-card {
    height: 560.84px !important;
    min-height: 560.84px !important;
  }

  .gallery-card.card-type-1 .card-image,
  .gallery-card.card-type-2 .card-image,
  .gallery-card.card-type-3 .card-image,
  .gallery-card.card-type-4 .card-image {
    height: 280.42px !important;
    min-height: 280.42px !important;
  }

  .gallery-card.card-type-1 .card-content,
  .gallery-card.card-type-2 .card-content,
  .gallery-card.card-type-3 .card-content,
  .gallery-card.card-type-4 .card-content {
    height: 280.42px !important;
    min-height: 280.42px !important;
  }
}

@media (max-width: 480px) {
  .gallery-card:not(.add-new-post-card) {
    height: 560.84px !important;
    min-height: 560.84px !important;
  }

  .gallery-card.add-new-post-card {
    height: 560.84px !important;
    min-height: 560.84px !important;
  }

  .gallery-card.card-type-1 .card-image,
  .gallery-card.card-type-2 .card-image,
  .gallery-card.card-type-3 .card-image,
  .gallery-card.card-type-4 .card-image {
    height: 280.42px !important;
    min-height: 280.42px !important;
  }

  .gallery-card.card-type-1 .card-content,
  .gallery-card.card-type-2 .card-content,
  .gallery-card.card-type-3 .card-content,
  .gallery-card.card-type-4 .card-content {
    height: 280.42px !important;
    min-height: 280.42px !important;
  }
}

/* Note: No separate 360px breakpoint in blog.css; use 480px rules below that width */

/* Ensure dropdown menu overlays sufficiently on gallery page */
.dropdown-menu { z-index: 10050; }

/* Keep header at base stacking level so admin toolbar can appear above it */
.header { z-index: 10; }

/* Mobile burger menu fixes for gallery page */
@media (max-width: 768px) {
  .burger-menu {
    display: flex !important;
  }

  .nav {
    position: fixed !important;
    top: 90px !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 90px) !important;
    background: linear-gradient(135deg, var(--background-color) 0%, #1e2d2b 100%) !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 40px 20px !important;
    gap: 30px !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
  }

  .nav.active {
    transform: translateX(0) !important;
  }

  .nav.active::after {
    content: '' !important;
    display: block !important;
    width: 100% !important;
    height: 1px !important;
    background: rgba(188, 108, 37, 0.2) !important;
    margin: 20px 0 !important;
  }

  .header .btn-primary {
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 1001 !important;
    font-size: 20px !important;
    height: 45px !important;
    padding: 0 20px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: all 0.3s ease !important;
  }

  .nav-link {
    font-size: 28px !important;
    text-align: center !important;
    width: 100% !important;
    padding: 15px 0 !important;
    border-bottom: 1px solid rgba(188, 108, 37, 0.2) !important;
    margin: 0 !important;
  }

  .nav-link:last-child {
    border-bottom: none !important;
  }

  .dropdown {
    width: 100% !important;
    text-align: center !important;
  }

  .dropdown-toggle {
    width: 100% !important;
    justify-content: center !important;
  }

  .dropdown-menu {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    background: rgba(249, 245, 235, 0.1) !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    margin-top: 10px !important;
    width: 100% !important;
    max-height: none !important;
  }

  .dropdown.active .dropdown-menu {
    display: block !important;
  }

  .dropdown-item {
    padding: 15px 20px !important;
    font-size: 24px !important;
    border-bottom: 1px solid rgba(188, 108, 37, 0.1) !important;
  }

  .dropdown-item:last-child {
    border-bottom: none !important;
  }

  /* Dropdown arrow animation */
  .dropdown-arrow {
    display: inline-block !important;
    transition: transform 0.3s ease !important;
    font-size: 20px !important;
  }

  .dropdown.active .dropdown-arrow {
    transform: rotate(180deg) !important;
  }

  .header .nav {
    display: none !important;
  }

  .header .nav.active {
    display: flex !important;
  }

  body.menu-open {
    overflow: hidden !important;
  }
}

@media (max-width: 480px) {
  .dropdown-arrow {
    font-size: 18px !important;
  }
}

/* Modal styles */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20000; /* above header/admin toolbar */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.image-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20001;
}


.modal-close {
    position: absolute;
    top: -60px;
    right: 0;
    background: none;
    border: none;
    font-size: 32px;
    color: #5D4037;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);}

.modal-close:hover {
    background: rgba(93, 64, 55, 0.1);
    color: var(--primary-color);
    transform: scale(1.1);
}

.modal-image {
  max-width: 100%;
  max-height: calc(90vh - 120px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  padding: 0 20px;
}

.modal-nav-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  font-size: 24px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.modal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.modal-caption {
  margin-top: 20px;
  color: white;
  font-size: 18px;
  text-align: center;
  max-width: 80%;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.5);
  padding: 12px 20px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

/* Body modal open state */
body.modal-open {
  overflow: hidden;
}

/* While modal is open, disable header interactions to avoid overlapping clicks */
body.modal-open .header {
  pointer-events: none;
}

/* Prevent admin toolbar interactions while a modal is open */
body.modal-open .admin-toolbar {
  pointer-events: none;
}

/* Admin toolbar styles for gallery */
.admin-toolbar {
  position: fixed;
  top: 90px;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(188, 108, 37, 0.95) 0%, rgba(151, 80, 30, 0.98) 100%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 9998;
  padding: 12px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-toolbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 35px;
}

.admin-label {
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.admin-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 10px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Content offset when admin toolbar is visible is handled globally in admin-toolbar.css */

/* Responsive design */
@media (max-width: 768px) {
  .modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .modal-close {
    top: -50px;
    font-size: 28px;
    padding: 6px 12px;
  }

  .modal-image {
    max-height: calc(95vh - 100px);
  }

  .modal-nav-btn {
    font-size: 20px;
    padding: 10px 12px;
  }

  .modal-caption {
    font-size: 16px;
    margin-top: 15px;
  }

  .gallery-icon {
    font-size: 36px;
  }

  .admin-toolbar-content {
    flex-direction: column;
    gap: 10px;
    padding: 0 20px;
  }

  /* Blog main offset handled in admin-toolbar.css */
}

@media (max-width: 480px) {
  .modal-nav {
    padding: 0 10px;
  }

  .modal-nav-btn {
    font-size: 18px;
    padding: 8px 10px;
  }
}

/* Upload modal styles */
.upload-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20000; /* Above header (10002) and admin toolbar (9998) */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.upload-modal.active {
  opacity: 1;
  visibility: visible;
}

/* Slightly lighter overlay for upload modal than image viewer */
.upload-modal .modal-overlay {
  background: rgba(0, 0, 0, 0.75);
}

.upload-modal .modal-content {
  position: relative;
  background: linear-gradient(135deg, rgba(249, 245, 235, 0.98) 0%, rgba(249, 245, 235, 0.92) 100%);
  border-radius: 16px;
  border: 1px solid rgba(188, 108, 37, 0.3);
  width: 90vw;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(188, 108, 37, 0.25);
}

.upload-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(188, 108, 37, 0.25);
  background: linear-gradient(135deg, rgba(40,61,59,0.9) 0%, rgba(40,61,59,0.8) 100%);
  color: var(--light-text);
}

/* Ensure upload modal close button sits inside header nicely */
.upload-modal .modal-close {
  position: static;
  background: transparent;
  color: var(--light-text);
  border: none;
  font-size: 28px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.upload-modal .modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: none;
}

.upload-modal .modal-header h2 {
  margin: 0;
  color: var(--light-text);
  font-size: 20px;
}

.upload-modal .modal-body {
  padding: 24px 28px;
  overflow-y: auto;
}

.upload-form .file-input-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.upload-form .file-input-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.upload-form .file-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(151, 80, 30, 0.95) 0%, rgba(188, 108, 37, 0.9) 100%);
  color: var(--light-text);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  border: 1px solid rgba(188, 108, 37, 0.4);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.upload-form .file-input-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
  filter: brightness(1.05);
}

.upload-form .file-preview {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.upload-form .preview-item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid rgba(188, 108, 37, 0.25);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.upload-form .preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-form .preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, rgba(188, 37, 37, 0.95) 0%, rgba(212, 58, 58, 0.9) 100%);
  color: white;
  border: 1px solid rgba(188, 108, 37, 0.4);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.upload-form .form-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 15px;
  margin-bottom: 20px;
}

.upload-form .form-group {
  display: flex;
  flex-direction: column;
}

.upload-form .form-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.upload-form .form-group input,
.upload-form .form-group textarea {
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  font-family: inherit;
}

.upload-form .form-group input:focus,
.upload-form .form-group textarea:focus {
  outline: none;
  border-color: #4CAF50;
}

.upload-form .form-group textarea {
  min-height: 90px;
  resize: vertical;
}

.upload-form .upload-btn {
  background: linear-gradient(135deg, rgba(151, 80, 30, 0.95) 0%, rgba(188, 108, 37, 0.9) 100%);
  color: var(--light-text);
  border: 1px solid rgba(188, 108, 37, 0.4);
  padding: 14px 28px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: all 0.3s ease;
  position: relative;
  width: 100%;
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.upload-form .upload-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.upload-form .upload-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  .upload-modal .modal-content {
    width: 95vw;
    max-height: 85vh;
  }

  .upload-form .form-row {
    grid-template-columns: 1fr;
  }
}