/* =========================================================
   Poosting - ÁLBUNS E FOTOS
   ========================================================= */

.photos-page-shell {
  width: min(1180px, calc(100% - 20px));
  margin: 14px auto 28px;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.photos-main-card {
  min-height: 560px;
  overflow: hidden;
  border-radius: 0 38px 0 0;
}

.photos-page-header,
.album-topbar {
  min-height: 84px;
  padding: 14px 18px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #c7d5e3;
}

.photos-page-header h1,
.album-topbar h1 {
  margin: 0;
  color: #111;
  font-size: 30px;
  font-weight: 400;
}

.photos-page-header p,
.album-topbar p {
  margin: 5px 0 0;
  color: #6f7b85;
  line-height: 1.4;
}

.photos-primary-button,
.photos-secondary-button,
.photos-danger-button {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
}

.photos-primary-button {
  border: 1px solid #4f7da5;
  background: linear-gradient(#79a8cf, #5385af);
  color: #fff;
}

.photos-secondary-button {
  border: 1px solid #a9bdcd;
  background: linear-gradient(#fff, #e8f0f6);
  color: #47718f;
}

.photos-danger-button {
  border: 1px solid #ba9696;
  background: linear-gradient(#fff, #f2e3e3);
  color: #9a3838;
}

.photos-primary-button:disabled,
.photos-secondary-button:disabled,
.photos-danger-button:disabled {
  opacity: .6;
  cursor: wait;
}

.photos-status {
  min-height: 20px;
  padding: 10px 14px 0;
  color: #6d7b86;
  font-size: 12px;
}

.albums-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.album-card {
  min-width: 0;
  padding: 8px;
  background: #eef6fc;
  border: 1px solid #c1d2e0;
}

.album-card-link {
  color: inherit;
  text-decoration: none;
}

.album-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1.25 / 1;
  overflow: hidden;
  background:
    linear-gradient(135deg, #e6f0f8, #c4d9e9);
  border: 1px solid #b5c6d4;
}

.album-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.album-cover-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #6a87a0;
  font-size: 38px;
}

.album-card h3 {
  margin: 7px 0 2px;
  color: #2f6f96;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.album-card-meta {
  color: #78858f;
  font-size: 11px;
}

.album-card-description {
  margin: 5px 0 0;
  color: #59666f;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.photos-empty {
  min-height: 300px;
  padding: 45px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #74818b;
  text-align: center;
}

.photos-empty-icon {
  margin-bottom: 8px;
  font-size: 36px;
}

.photos-empty strong {
  margin-bottom: 5px;
  color: #536875;
}


/* MODAL */

.photos-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(22, 42, 61, .65);
  overflow-y: auto;
}

.photos-modal-backdrop.show {
  display: flex;
}

.photos-modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid #9fb6c9;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0,0,0,.27);
}

.photos-upload-modal {
  width: min(760px, 100%);
}

.photos-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(#f8fbfe, #e4eff8);
  border-bottom: 1px solid #c8d5e1;
}

.photos-modal-header h2 {
  margin: 0;
  color: #426f91;
  font-size: 20px;
}

.photos-modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #55748e;
  font-size: 28px;
  cursor: pointer;
}

.photos-modal-form {
  padding: 15px;
}

.photos-modal-form label {
  display: block;
  margin: 0 0 5px;
  color: #526b7d;
  font-size: 12px;
  font-weight: 700;
}

.photos-modal-form input,
.photos-modal-form textarea {
  width: 100%;
  margin-bottom: 12px;
  padding: 9px 10px;
  border: 1px solid #b9c9d7;
  border-radius: 3px;
  outline: 0;
}

.photos-modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.photos-form-message {
  min-height: 18px;
  margin-top: 7px;
  color: #6d7a84;
  font-size: 12px;
}

.photos-form-message.error {
  color: #b42f2f;
}

.photos-form-message.success {
  color: #28703e;
}


/* ÁLBUM */

.album-owner-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.photos-back-link {
  display: inline-block;
  margin-bottom: 5px;
  color: #2f6f97;
  text-decoration: underline;
  font-size: 12px;
}

.photos-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.photo-thumb-card {
  min-width: 0;
}

.photo-thumb-link {
  display: block;
  text-decoration: none;
}

.photo-thumb-image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e7eff6;
  border: 1px solid #b7c7d4;
}

.photo-thumb-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-thumb-description {
  margin: 5px 1px 0;
  color: #53616b;
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.photo-thumb-meta {
  margin-top: 3px;
  color: #84909a;
  font-size: 10px;
}


/* UPLOAD */

.photos-upload-help {
  margin-top: 0;
  color: #687681;
  font-size: 12px;
  line-height: 1.4;
}

.photos-choose-files {
  margin-bottom: 12px;
}

.pending-photos-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.pending-photo-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid #cedbe6;
  background: #f5f9fc;
}

.pending-photo-preview {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border: 1px solid #b9c8d4;
  background: #e9f0f5;
}

.pending-photo-fields {
  min-width: 0;
}

.pending-photo-fields textarea {
  margin: 0;
  min-height: 58px;
  resize: vertical;
}

.pending-photo-status {
  margin-top: 4px;
  color: #74818b;
  font-size: 11px;
}

.pending-photo-status.loading {
  color: #7b681c;
}

.pending-photo-status.approved {
  color: #2d7142;
}

.pending-photo-status.rejected,
.pending-photo-status.error {
  color: #a93636;
}


/* FOTO INDIVIDUAL */

.photo-view-shell {
  width: min(960px, calc(100% - 20px));
  margin: 14px auto 28px;
}

.photo-view-card {
  overflow: hidden;
}

.photo-view-topbar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f5f9fc;
  border-bottom: 1px solid #cedae5;
}

.photo-view-image-wrap {
  padding: 16px;
  display: flex;
  justify-content: center;
  background: #eef4f9;
  position: relative;
  min-height: 180px;
  align-items: center;
}

.photo-view-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(26, 40, 52, 0.28);
  color: #fff;
  text-decoration: none;
  font-size: 46px;
  line-height: 1;
  font-family: Arial, sans-serif;
  transition: background 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.photo-view-nav:hover,
.photo-view-nav:focus-visible {
  background: rgba(26, 40, 52, 0.58);
  color: #fff;
  outline: none;
}

.photo-view-nav-prev {
  left: 26px;
}

.photo-view-nav-next {
  right: 26px;
}

.photo-view-position {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 3;
  padding: 4px 9px;
  border-radius: 10px;
  background: rgba(26, 40, 52, 0.52);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
}

.photo-view-nav[hidden],
.photo-view-position[hidden] {
  display: none !important;
}

.photo-view-image {
  max-width: 100%;
  max-height: 760px;
  display: block;
  object-fit: contain;
  background: #fff;
}

.photo-view-info {
  padding: 13px 16px;
  border-bottom: 1px solid #d0dce6;
}

.photo-view-info h1 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 400;
  color: #2f6f96;
}

.photo-view-description {
  margin: 0 0 6px;
  color: #3e4850;
  line-height: 1.45;
  white-space: pre-wrap;
}

.photo-view-date {
  color: #87929a;
  font-size: 11px;
}


/* COMMENTS */

.comments-section {
  padding-bottom: 14px;
}

.comments-title-row {
  padding: 11px 14px 7px;
}

.comments-title-row h2 {
  margin: 0;
  color: #111;
  font-size: 17px;
}

.comments-title-row span {
  color: #47718f;
  font-weight: 400;
}

.comment-form {
  margin: 0 14px 12px;
  padding: 10px;
  background: #edf6fc;
  border: 1px solid #cad9e5;
}

.comment-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px 9px;
  border: 1px solid #aac0d2;
  resize: vertical;
}

.comment-form-footer {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#commentCounter {
  color: #7c8992;
  font-size: 11px;
}

.comments-list {
  border-top: 1px solid #ccd9e4;
}

.comment-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  border-bottom: 1px solid #cad9e5;
}

.comment-card:nth-child(odd) {
  background: #eaf4fc;
}

.comment-card:nth-child(even) {
  background: #dfeef9;
}

.comment-author {
  padding: 10px 5px;
  text-align: center;
  border-right: 1px solid #c4d4e1;
}

.comment-avatar {
  width: 50px;
  height: 50px;
  margin: 0 auto 4px;
  display: block;
  object-fit: cover;
  border: 1px solid #aebfcd;
}

.comment-author-name {
  display: block;
  color: #397091;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.comment-body {
  min-width: 0;
  padding: 10px;
}

.comment-meta {
  margin-bottom: 6px;
  color: #84909a;
  font-size: 10px;
}

.comment-text {
  margin: 0;
  color: #30373d;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-delete-button {
  margin-top: 8px;
  padding: 4px 7px;
  border: 1px solid #bc9f9f;
  background: #fff;
  color: #9a4141;
  font-size: 10px;
  cursor: pointer;
}

.comments-empty {
  padding: 25px 14px;
  text-align: center;
  color: #77848e;
  font-size: 12px;
}


/* RESPONSIVO */

@media (max-width: 900px) {
  .albums-grid,
  .photos-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .photos-page-shell {
    width: calc(100% - 12px);
    display: flex;
    flex-direction: column;
    margin-top: 8px;
  }

  .photos-page-shell .left-column {
    width: 100%;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
  }

  .photos-main-card {
    width: 100%;
    border-radius: 7px;
  }

  .photos-page-header,
  .album-topbar {
    padding: 12px;
  }

  .photos-page-header h1,
  .album-topbar h1 {
    font-size: 24px;
  }

  .albums-grid,
  .photos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 10px;
  }

  .photos-modal-backdrop {
    padding: 8px;
  }

  .pending-photo-item {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .pending-photo-preview {
    width: 62px;
    height: 62px;
  }

  .photo-view-shell {
    width: calc(100% - 12px);
    margin-top: 8px;
  }

  .photo-view-image-wrap {
    padding: 8px;
  }

  .photo-view-nav {
    width: 40px;
    height: 58px;
    font-size: 38px;
  }

  .photo-view-nav-prev {
    left: 12px;
  }

  .photo-view-nav-next {
    right: 12px;
  }

  .photo-view-position {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 420px) {
  .photos-page-header,
  .album-topbar {
    flex-direction: column;
  }

  .album-owner-actions {
    justify-content: flex-start;
  }

  .albums-grid,
  .photos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* CORREÇÃO: respeitar atributo hidden nos estados vazios */
.photos-empty[hidden],
.comments-empty[hidden] {
  display: none !important;
}


/* ===== Legenda de fotos ===== */
.photo-owner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-view-description {
  margin: 10px 0 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.photo-caption-editor {
  margin: 12px 0 8px;
  padding: 12px;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  background: #f8fafc;
}

.photo-caption-editor label,
.pending-photo-caption-label {
  display: block;
  margin-bottom: 6px;
  color: #536476;
  font-size: 12px;
  font-weight: 700;
}

.photo-caption-editor textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 9px 10px;
  box-sizing: border-box;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  resize: vertical;
  outline: none;
  font: inherit;
  line-height: 1.45;
}

.photo-caption-editor textarea:focus {
  border-color: #7b59ae;
}

.photo-caption-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.photo-caption-editor-footer > span,
.pending-photo-caption-counter {
  color: #8190a0;
  font-size: 11px;
}

.photo-caption-editor-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.pending-photo-caption-counter {
  margin-top: -3px;
  margin-bottom: 6px;
  text-align: right;
}

@media (max-width: 720px) {
  .photo-owner-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .photo-caption-editor-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .photo-caption-editor-actions {
    width: 100%;
  }

  .photo-caption-editor-actions button {
    flex: 1;
  }
}


.photo-report-button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:17px;
  height:17px;
  min-width:17px;
  padding:0;
  border:1px solid #c2ccd6;
  border-radius:50%;
  background:#f7f9fb;
  color:#7a8792;
  font:inherit;
  font-size:9px;
  font-weight:800;
  line-height:1;
  cursor:pointer;
}
.photo-report-button:hover { color:#9c3448; background:#eef3f7; }
.comment-actions { display:flex; align-items:center; gap:6px; margin-top:8px; flex-wrap:wrap; }
.comment-actions .comment-delete-button { margin-top:0; }

.photo-report-overlay {
  position:fixed; inset:0; z-index:10100; display:none;
  align-items:center; justify-content:center; padding:20px;
  background:rgba(18,25,34,.62);
}
.photo-report-overlay.open { display:flex; }
.photo-report-modal {
  width:min(500px,100%); max-height:calc(100vh - 40px); overflow:auto;
  border-radius:10px; background:#fff; box-shadow:0 20px 60px rgba(0,0,0,.24);
}
.photo-report-header {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:15px 17px; border-bottom:1px solid #e1e7ed;
}
.photo-report-header h2 { margin:0; font-size:18px; }
.photo-report-close {
  width:34px; height:34px; border:0; border-radius:50%;
  background:#eef2f6; font-size:22px; cursor:pointer;
}
.photo-report-form { padding:17px; }
.photo-report-target-label {
  margin:0 0 12px; padding:9px 10px; border-radius:6px;
  background:#f5f8fa; color:#536473; font-size:12px;
}
.photo-report-form label { display:block; margin:10px 0 6px; color:#526273; font-size:12px; font-weight:700; }
.photo-report-form select,.photo-report-form textarea {
  box-sizing:border-box; width:100%; border:1px solid #c8d3df;
  border-radius:6px; background:#fff; color:#3e5062; font:inherit;
}
.photo-report-form select { height:40px; padding:0 9px; }
.photo-report-form textarea { min-height:100px; padding:9px; resize:vertical; }
.photo-report-message { min-height:18px; margin-top:8px; font-size:12px; }
.photo-report-message.error { color:#9f2942; }
.photo-report-message.success { color:#25723e; }
.photo-report-modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:15px; }

@media (max-width:520px) {
  .photo-report-modal-actions { flex-direction:column-reverse; }
  .photo-report-modal-actions button { width:100%; }
}


/* PAGINAÇÃO DO ÁLBUM */
.photos-pagination {
  padding: 4px 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.photos-pagination[hidden] {
  display: none !important;
}

.photos-page-button {
  min-width: 32px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #aac0d2;
  border-radius: 3px;
  background: linear-gradient(#fff, #e8f0f6);
  color: #397091;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.photos-page-button:hover:not(:disabled):not(.active) {
  background: #e3f1fb;
}

.photos-page-button.active {
  border-color: #4f7da5;
  background: #5b8db6;
  color: #fff;
  font-weight: 700;
  cursor: default;
}

.photos-page-button:disabled {
  opacity: .45;
  cursor: default;
}

.photos-page-button.nav {
  min-width: 82px;
}

@media (max-width: 520px) {
  .photos-pagination {
    padding: 3px 10px 14px;
    gap: 4px;
  }

  .photos-page-button {
    min-width: 30px;
    height: 30px;
    padding: 0 7px;
    font-size: 11px;
  }

  .photos-page-button.nav {
    min-width: 76px;
  }
}
