/* =========================================================
   PSAS GLOBAL IMAGE EDITOR
   File: /public/assets/psas_image_editor.css
   ========================================================= */

.psas-image-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.72);
}

.psas-image-editor-modal.is-open {
  display: flex;
}

.psas-image-editor-panel {
  width: min(760px, 96vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.psas-image-editor-header,
.psas-image-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #ffffff;
}

.psas-image-editor-header {
  border-bottom: 1px solid #e5e7eb;
}

.psas-image-editor-footer {
  border-top: 1px solid #e5e7eb;
}

.psas-image-editor-header h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  color: #111827;
}

.psas-image-editor-stage {
  padding: 18px;
  background: #f8fafc;
}

.psas-image-editor-frame {
  position: relative;
  width: 100%;
  height: min(56vh, 460px);
  overflow: hidden;
  border-radius: 18px;
  background: #111827;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.psas-image-editor-frame:active {
  cursor: grabbing;
}

#psas-crop-image {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: 92%;
  max-height: 92%;
  transform-origin: center center;
  translate: -50% -50%;
  pointer-events: none;
  user-select: none;
}

.psas-crop-box {
  position: absolute;
  inset: 12%;
  border: 2px solid #ffffff;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.psas-image-editor-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 14px 18px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

.psas-img-close,
.psas-img-cancel,
.psas-img-save,
.psas-image-editor-controls button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}

.psas-img-close {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #111827;
  font-size: 26px;
}

.psas-img-cancel,
.psas-img-save,
.psas-image-editor-controls button {
  padding: 10px 15px;
  font-size: 13px;
}

.psas-img-cancel {
  background: #f3f4f6;
  color: #111827;
}

.psas-img-save {
  background: #4cc28a;
  color: #ffffff;
}

.psas-image-editor-controls button {
  background: #eef2ff;
  color: #111827;
}

.psas-img-close:hover,
.psas-img-cancel:hover,
.psas-image-editor-controls button:hover {
  filter: brightness(0.96);
}

.psas-img-save:hover {
  filter: brightness(0.94);
}

/* =========================================================
   FEED IMAGE DISPLAY FIX
   Shows full saved image without squashing or chopping heads off.
   ========================================================= */

.post-media-grid {
  display: grid;
  gap: 10px;
}

.post-media-grid .media-thumb {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  overflow: hidden;
  background: #0f172a;
  border-radius: 18px;
  text-decoration: none;
}

.post-media-grid .media-thumb img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  object-fit: contain;
  object-position: center;
  background: #0f172a;
  border-radius: 18px;
}

/* Keep multi-image grids tidy */
.post-media-grid .media-thumb:nth-child(n+2) img {
  height: 260px;
  object-fit: cover;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 640px) {
  .psas-image-editor-modal {
    padding: 10px;
  }

  .psas-image-editor-panel {
    width: 100%;
    max-height: 96vh;
    border-radius: 18px;
  }

  .psas-image-editor-header,
  .psas-image-editor-footer {
    padding: 12px;
  }

  .psas-image-editor-stage {
    padding: 12px;
  }

  .psas-image-editor-frame {
    height: 390px;
    border-radius: 16px;
  }

  .psas-image-editor-controls {
    gap: 8px;
    padding: 12px;
  }

  .psas-img-cancel,
  .psas-img-save,
  .psas-image-editor-controls button {
    padding: 10px 13px;
    font-size: 12px;
  }

  .post-media-grid .media-thumb img {
    max-height: none;
  }

  .post-media-grid .media-thumb:nth-child(n+2) img {
  height: 190px;
  object-fit: cover;
}
}