body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f4f0;
  color: #1c1c1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

.hidden {
  display: none !important;
}

.btn-primary {
  background: #3a6df0;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.btn-primary:hover {
  background: #2555d4;
}

.btn-secondary {
  background: transparent;
  color: #7a7870;
  border: 1px solid #e2e0d8;
  border-radius: 6px;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: #7a7870;
  color: #1c1c1a;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e2e0d8;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 2rem;
}

.image-card {
  background: #ffffff;
  border: 1px solid #e2e0d8;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.image-card__img {
  width: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  display: block;
  background: #f5f4f0;
}

.image-card__body {
  padding: 0.85rem 1rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.image-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-card__author {
  font-size: 0.78rem;
  color: #7a7870;
}

.image-card__actions {
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 1rem 0.75rem;
}

.delete-btn {
  background: transparent;
  color: #d63f3f;
  border: 1px solid #d63f3f;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-family: Arial, Helvetica, sans-serif;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.delete-btn:hover {
  background: #d63f3f;
  color: #ffffff;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1c1c1a;
  background: none;
  border: none;
  padding: 0;
  cursor: default;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.image-count {
  font-size: 0.85rem;
  color: #7a7870;
}

.add-image-panel {
  border-top: 1px solid #e2e0d8;
  background: #f5f4f0;
}

.add-image-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  padding: 1.25rem 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 160px;
}

.form-group--wide {
  flex: 2 1 260px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7a7870;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.required {
  color: #d63f3f;
}

.form-element {
  border: 1px solid #e2e0d8;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #1c1c1a;
  background: #ffffff;
  outline: none;
  width: 100%;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-element:focus {
  border-color: #3a6df0;
  box-shadow: 0 0 0 3px rgba(58, 109, 240, 0.12);
}

.form-element.input-error {
  border-color: #d63f3f;
}

.field-error {
  font-size: 0.75rem;
  color: #d63f3f;
  min-height: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.main-content {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.gallery-feed.row {
  gap: 1.5rem;
}

.empty-state {
  text-align: center;
  padding: 6rem 1rem;
  color: #7a7870;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 60vh;
  justify-content: center;
}

.empty-icon {
  width: 4rem;
  height: 4rem;
  background-image: url("../assets/camera.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-bottom: 1rem;
}

.empty-text {
  font-size: 1rem;
}

.site-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.82rem;
  color: #7a7870;
  border-top: 1px solid #e2e0d8;
  margin-top: auto;
}

.footer-link:hover {
  color: #1c1c1a;
}

.scroll-sentinel {
  height: 40px;
}

.comment-form {
  border-top: 1px solid #e2e0d8;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-form__actions {
  display: flex;
  justify-content: flex-end;
}

.comments-list {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-item {
  font-size: 0.82rem;
  border-bottom: 1px solid #e2e0d8;
  padding-bottom: 0.5rem;
}

.comment-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.comment-item__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.comment-item__author {
  font-weight: 600;
  color: #1c1c1a;
}

.comment-item__date {
  font-size: 0.72rem;
  color: #7a7870;
  margin-left: auto;
}

.comment-item__text {
  color: #1c1c1a;
  line-height: 1.4;
}

.btn-delete-comment {
  background: none;
  border: none;
  color: #7a7870;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0 0.2rem;
}

.btn-delete-comment:hover {
  color: #d63f3f;
}

.btn-more {
  background: none;
  border: none;
  color: #3a6df0;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 1rem 0.75rem;
  display: block;
}

.btn-more:hover {
  text-decoration: underline;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal-box {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  width: min(560px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e0d8;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1rem;
  color: #7a7870;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.btn-close-modal:hover {
  color: #1c1c1a;
  background: #f5f4f0;
}

.modal-comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1.5rem;
  list-style: none;
}

.modal-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid #e2e0d8;
}

.page-indicator {
  font-size: 0.82rem;
  color: #7a7870;
}

@media (max-width: 600px) {
  .add-image-form {
    flex-direction: column;
  }

  .form-group,
  .form-group--wide {
    flex: 1 1 100%;
  }

  .header-inner {
    padding: 0 1rem;
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- error toast ---- */
.error-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #d33;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 1100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ---- a3: view headers ---- */
.view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}
.view-title {
  margin: 0;
  flex: 1;
}

/* ---- a3: auth forms (side by side) ---- */
.form-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}
#auth-panel {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

/* ---- a3: gallery (user) cards on the home view ---- */
.gallery-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.gallery-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}
.gallery-card__name {
  margin: 0 0 0.5rem;
}
.gallery-card__hint {
  margin: 0;
  color: #888;
  font-size: 0.9rem;
}

.updates-indicator {
  position: sticky;
  top: 0;
  z-index: 500;
  background: #2563eb;
  color: #fff;
  text-align: center;
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 0 0 8px 8px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.updates-indicator:hover {
  background: #1d4ed8;
}
