.trapygallery-block {
  --tg-gap: 10px;
  --tg-cols: 4;
  --tg-cols-md: 3;
  --tg-cols-sm: 2;
  --tg-cols-xs: 1;
}

.trapygallery-notice {
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.trapygallery-notice--success { border-color: #bbf7d0; }
.trapygallery-notice--error { border-color: #fecaca; }
.trapygallery-notice--info { border-color: #bfdbfe; }

.trapygallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--tg-cols), minmax(0, 1fr));
  gap: var(--tg-gap);
}

@media (max-width: 1024px) {
  .trapygallery-grid { grid-template-columns: repeat(var(--tg-cols-md), minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .trapygallery-grid { grid-template-columns: repeat(var(--tg-cols-sm), minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .trapygallery-grid { grid-template-columns: repeat(var(--tg-cols-xs), minmax(0, 1fr)); }
}

.trapygallery-item {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  width: 100%;
}

.trapygallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
}

.trapygallery-empty {
  margin: 10px 0 0 0;
}

/* ✅ Centered Upload Area */
.trapygallery-upload {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.08);

  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 36vh;

  /* Ensure centering even if theme has weird layout */
  width: 100%;
  text-align: center;
}

.trapygallery-upload-inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;

  /* hard-center */
  display: flex;
  justify-content: center;
}

.trapygallery-upload-card {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 18px 16px;
  background: rgb(19, 21, 20);
  backdrop-filter: blur(6px);

  /* ✅ Make the card itself centered and center its contents */
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.trapygallery-upload-hint {
  margin: 0 0 12px 0;
  font-size: 1.02em;
}

/* ✅ Login button (pretty + centered) */
.trapygallery-login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(0,0,0,.12);
  background: #998735;
  color: inherit;
  font-weight: 600;
}
.trapygallery-login-button:hover {
  border-color: rgba(0,0,0,0.24);
}

/* ✅ Upload form hard-centered (override theme conflicts) */
.trapygallery-upload .trapygallery-upload-form {
  width: 100% !important;
  max-width: 760px !important;
  margin: 0 auto !important;

  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;

  text-align: center !important;
}

/* ✅ Drag & Drop UI */
.trapygallery-dropzone-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ✅ Always centered dropzone (and not full-stretched weirdly) */
.trapygallery-dropzone {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;

  border: 2px dashed rgba(0,0,0,0.18);
  border-radius: 16px;
  padding: 18px 16px;
  cursor: pointer;
  user-select: none;
  outline: none;

  /* force center even if theme overrides */
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;

  text-align: center !important;

  background: rgba(0,0,0,0.02);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.trapygallery-dropzone:hover {
  border-color: rgba(0,0,0,0.30);
  transform: translateY(-1px);
  background: rgba(0,0,0,0.03);
}

.trapygallery-dropzone.is-dragover {
  border-color: rgba(37,99,235,0.55);
  background: rgba(37,99,235,0.06);
}

.trapygallery-dropzone-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgb(83, 83, 83);
}

.trapygallery-dropzone-text {
  text-align: center;
}

.trapygallery-dropzone-title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.trapygallery-dropzone-subtitle {
  opacity: 0.75;
  margin-top: 2px;
  font-size: 0.95em;
}

/* ✅ Hide ANY default file input inside upload form (prevents "Browse... no files selected") */
.trapygallery-upload .trapygallery-upload-form input[type="file"] {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* keep your class too (extra safety) */
.trapygallery-file-input {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.trapygallery-filemeta {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.trapygallery-filelist {
  font-size: 0.95em;
  opacity: 0.85;
  text-align: center;
}

.trapygallery-clear-files {
  border: 1px solid rgba(0,0,0,0.14);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
}
.trapygallery-clear-files:hover {
  border-color: rgba(0,0,0,0.28);
}

/* ✅ Center the button row HARD */
.trapygallery-upload-actions {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
}

/* Safety: if theme floats buttons, reset */
.trapygallery-upload-actions button,
.trapygallery-upload-actions .trapygallery-upload-button {
  float: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.trapygallery-upload-help {
  margin: 2px 0 0 0;
  opacity: 0.8;
  font-size: 0.95em;
  max-width: 680px;
  text-align: center;
}

/* Lightbox */
.trapygallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.86);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.trapygallery-lightbox.is-open {
  display: flex;
}

.trapygallery-lightbox-figure {
  margin: 0;
  max-width: min(1000px, 92vw);
  max-height: 86vh;
}

.trapygallery-lightbox-img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 86vh;
  display: block;
  border-radius: 10px;
}

.trapygallery-lightbox-close,
.trapygallery-lightbox-prev,
.trapygallery-lightbox-next {
  position: absolute;
  border: 0;
  background: rgba(255,255,255,0.10);
  color: #fff;
  cursor: pointer;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 24px;
  line-height: 1;
}

.trapygallery-lightbox-close {
  top: 16px;
  right: 16px;
  font-size: 28px;
}

.trapygallery-lightbox-prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.trapygallery-lightbox-next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
