/* === RECENT WORKS PAGE CSS === */
.recent-works-page {
  padding: 4rem 2rem;
  background: #fffef8;
  font-family: 'Segoe UI', sans-serif;
  color: #3a2d0f;
  max-width: 1280px;
  margin: 0 auto 6rem;
}

.section-title {
  font-size: 3.4rem;
  font-family: 'Georgia', serif;
  text-align: center;
  margin-bottom: 3.5rem;
  color: #4a3000;
  text-shadow: 1px 1px 3px rgba(198, 169, 0, 0.3);
}

.recent-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2.6rem;
}

.work-card {
  background: #fff;
  border: 2px solid #d6c788;
  border-radius: 1.2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.07);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  outline-offset: 3px;
  position: relative;
  overflow: hidden;
}

.work-card:focus,
.work-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px rgba(198, 169, 0, 0.4);
  border-color: #b88e00;
  outline: none;
}

.work-image-container {
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid #d6c788;
  height: 180px;
}

.work-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.work-card:hover .work-image-container img {
  transform: scale(1.05);
}

.admin-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.admin-controls button {
  background: #d6c788cc;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 1.1rem;
  cursor: pointer;
  color: #4a3000;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.admin-controls button:hover {
  background: #b88e00dd;
  color: white;
}

.work-content {
  padding: 1.3rem 1.6rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.6rem;
}

.work-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #4a3000;
  line-height: 1.2;
  max-height: 3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-description {
  font-size: 1rem;
  color: #555;
  line-height: 1.4;
  max-height: 4.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pagination {
  margin-top: 3rem;
  text-align: center;
}

.pagination .page-numbers {
  display: inline-block;
  margin: 0 0.4rem;
  padding: 0.5rem 0.85rem;
  font-weight: 600;
  color: #4a3000;
  border: 2px solid #d6c788;
  border-radius: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.pagination .page-numbers.current {
  background-color: #b88e00;
  color: white;
  cursor: default;
}

.pagination .page-numbers:hover:not(.current) {
  background-color: #d6c788;
  color: #4a3000;
}

.no-works-message {
  text-align: center;
  font-size: 1.3rem;
  color: #777;
  margin-top: 4rem;
}

/* Modal styles */

.modal {
  display: none;
  position: fixed;
  z-index: 1500;
  inset: 0;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-overflow-scrolling: touch;
}

.modal[aria-hidden="false"] {
  display: block;
}

.modal-content {
  position: relative;
  max-width: 720px;
  margin: 3rem auto 4rem;
  background: #fffef8;
  border-radius: 1.2rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.15);
  padding: 2rem 2.5rem 3rem;
  font-family: 'Segoe UI', sans-serif;
  color: #3a2d0f;
  animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 2.2rem;
  color: #b88e00;
  cursor: pointer;
  font-weight: 700;
  transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
  color: #4a3000;
  outline: none;
}

/* Image preview modal */
.modal-image img {
  width: 100%;
  height: auto;
  max-height: 400px; /* optional max height to limit very tall images */
  border-radius: 0.8rem;
  object-fit: contain;
  margin-bottom: 1.4rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Modal description */
.modal-description {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #4a3000;
  margin-bottom: 2rem;
}

/* Modal buttons container */
.modal-buttons {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-start; /* or center */
  gap: 1.5rem;
  max-width: 400px;
}

/* Shared button styles */
.save-btn,
.cancel-btn {
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  color: #fff;
  user-select: none;
  text-align: center;
  line-height: 1.2;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Save button - green */
.save-btn {
  background-color: #28a745;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.save-btn:hover,
.save-btn:focus {
  background-color: #218838;
  box-shadow: 0 6px 14px rgba(33, 136, 56, 0.6);
  outline: none;
}

/* Cancel button - red */
.cancel-btn {
  background-color: #dc3545;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.cancel-btn:hover,
.cancel-btn:focus {
  background-color: #c82333;
  box-shadow: 0 6px 14px rgba(200, 35, 51, 0.6);
  outline: none;
}

/* Image input spacing */
#edit_featured_image {
  margin-bottom: 1.25rem;
}

/* Image preview */
.image-preview-wrapper img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 0.6rem;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  display: block;
  margin: 0 auto;
}

/* Edit modal form layout */
#editModal form#editForm {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

#editModal label {
  font-weight: 600;
  font-size: 1.1rem;
  color: #4a3000;
}

#editModal input[type="text"],
#editModal textarea {
  padding: 0.7rem 1rem;
  border: 2px solid #d6c788;
  border-radius: 0.6rem;
  font-size: 1rem;
  font-family: 'Segoe UI', sans-serif;
  color: #3a2d0f;
  resize: vertical;
  transition: border-color 0.3s ease;
}

#editModal input[type="text"]:focus,
#editModal textarea:focus {
  outline: none;
  border-color: #b88e00;
  box-shadow: 0 0 6px #b88e00aa;
}

/* Responsive tweaks */
@media (max-width: 600px) {
  .recent-works-page {
    padding: 3rem 1rem;
  }

  .section-title {
    font-size: 2.4rem;
    margin-bottom: 2.2rem;
  }

  .work-image-container {
    height: 140px;
  }

  .work-card {
    border-width: 1.5px;
  }

  .modal-content {
    margin: 2rem 1rem 3rem;
    padding: 1.5rem 1.8rem 2.5rem;
  }

  .modal-image img {
    height: 140px;
  }
}


/* Edit modal buttons container tweaks */
#editModal .modal-buttons {
  display: flex;
  justify-content: flex-start;  /* align buttons to left */
  gap: 1rem;                    /* space between buttons */
  max-width: 320px;             /* limit width */
  margin-top: 1.5rem;
}

/* Save & Cancel buttons smaller but balanced */
#editModal .save-btn,
#editModal .cancel-btn {
  min-width: 120px;             /* smaller width but enough for text */
  padding: 0.45rem 1rem;        /* balanced padding */
  font-size: 1rem;              /* readable font */
  border-radius: 0.5rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Hover/focus tweaks keep consistency */
#editModal .save-btn:hover,
#editModal .save-btn:focus {
  background-color: #218838;
  box-shadow: 0 6px 14px rgba(33, 136, 56, 0.6);
  outline: none;
}

#editModal .cancel-btn:hover,
#editModal .cancel-btn:focus {
  background-color: #c82333;
  box-shadow: 0 6px 14px rgba(200, 35, 51, 0.6);
  outline: none;
}
