img {
  width: 15rem;
  height: auto;
}

body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
}

header {
  background: white;
  z-index: 10;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* if an element is hidden, it will be hidden! */
[hidden] {
  display: none !important;
}

hr {
  margin: 0;
  border: none;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}

.web-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin: 0rem 0.25rem;
  padding: 1rem;
}

.vertical-scroll-container {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  position: relative;
}

.gallery-feed {
  position: relative;
  gap: 1.5rem;
  padding: 2rem;
  padding-bottom: 3rem;
}

.loadingSpinner {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  z-index: 9999;
}

.gallery-item {
  overflow: hidden;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.gallery-count {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  z-index: 3;
}

.gallery-bottom-message {
  padding: 0.5rem 0.9rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.08);
  color: #444;
  font-size: 0.95rem;
  text-align: center;
  height: min-content;
  white-space: nowrap;
}

.scroll-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
  width: 100%;
}

@media (max-width: 1200px) {
  .gallery-feed,
  .scroll-track {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .gallery-feed,
  .scroll-track {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .gallery-feed,
  .scroll-track {
    grid-template-columns: 1fr;
  }
}

.scroll-track img {
  height: 300px;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
}

.comment-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0;
}

.comment-section {
  margin-top: 1rem;
  padding: 1rem;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.comment-form {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.new-comment-text {
  grid-column: span 7;
}

.comment-form .row {
  display: contents;
}

.comment-form .submit-comment {
  grid-column: span 3;
  align-self: center;
  margin: 0;
  padding: 0.6rem 0.8rem !important;
  height: fit-content;
}

.comment-form input {
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.comment-form input:focus,
.add-image-form input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.comment-profile {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  flex-shrink: 0;
}

.comment-author-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.comment-avatar {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #d9d9d9;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.comment-author {
  font-size: 0.7rem;
  color: #444;
  font-weight: 600;
  line-height: 1.2;
}

.comment-timestamp {
  font-size: 0.55rem;
  color: #999;
  line-height: 1.2;
}

.comment-text {
  font-size: 0.9rem;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
}

.delete-comment {
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #666;
}

.delete-comment:hover {
  color: #b00020;
}

.delete-post {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #666;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.delete-post:hover {
  color: #b00020;
}

.post-content {
  position: relative;
  padding-bottom: 1rem;
  border-bottom: 2px solid #ddd;
}

.image-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.image-upload {
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  background-color: #fff;
  cursor: pointer;
  box-sizing: border-box;
  width: 100%;
}

.image-upload::file-selector-button {
  padding: 0.35rem 0.75rem;
  margin-right: 0.75rem;
  border: none;
  border-radius: 4px;
  background-color: transparent;
  color: #007bff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.no-images-message {
  padding: 1rem;
  text-align: center;
}

.btn {
  padding: 0.2rem 0.3rem;
  border: 2px solid #007bff;
  background-color: transparent;
  text-decoration: none;
  color: #007bff;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.btn:hover {
  background-color: #007bff;
  color: white;
  cursor: pointer;
}

.header-btn {
  font-size: medium;
}

.toggle-add-image-section {
  display: block;
  margin: 1rem auto 0.5rem;
  padding: 0.6rem 1rem;
}

.add-image-section {
  position: relative;
  max-width: 500px;
  margin: 0 auto 2rem;
  padding: 1.5rem;
  padding-bottom: 2rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  border-bottom: 2px solid #ddd;
}

.add-image-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.add-image-form input {
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.add-image-submit {
  margin-top: 0.5rem;
  padding: 0.75rem 1.5rem !important;
  align-self: center;
}

.authentication-section {
  position: fixed;
  top: 1rem;
  right: 3rem;
}

.user-tabs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding-bottom: 0;
}

.user-tab-wrapper {
  flex: 0 0 auto;
}

.user-tab-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 0.625rem 0.625rem 0 0;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  border-top: 2px solid transparent;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  transition: all 0.15s ease;
  position: relative;
}

.user-tab-bar:hover {
  background-color: #007bff;
}

.user-tab-avatar {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #eeecec;
  color: #222;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-tab-avatar .red-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: #ff3b30;
  border-radius: 50%;
  border: 1.5px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.user-tab-username {
  font-size: 0.85rem;
  font-weight: 400;
}

.user-tab-wrapper {
  position: relative;
  display: inline-block;

  /* Reserve a fixed 22px ceiling slot for the badge so buttons always align */
  padding-top: 22px;

  margin: 0 5px;
  vertical-align: top;
}

.unread-count-badge {
  position: absolute;

  /* Drop it exactly into the reserved top padding zone */
  top: 0;
  left: 50%;
  transform: translateX(-50%); /* Centers it horizontally over the button */

  background-color: #dc3545;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInTabs {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* login page */

.login-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin: 0rem 0.25rem;
  padding: 1rem;
  display: block;
  text-decoration: none;
  color: #222;
}

.error-box {
  max-width: 600px;
  margin: 1rem auto;
  padding: 0.75rem 1rem;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
}

.error-box:empty {
  display: none !important;
}

.complex-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 600px;
  margin: 4rem auto;
  padding: 2.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  background-color: #fff;
}

.form-element {
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.form-element:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.complex-form div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: #666;
  margin-top: 0.5rem;
}

.complex-form .btn {
  flex: 1;
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

footer {
  margin-top: auto;
  padding: 1.5rem;
  text-align: center;
  border-top: 1px solid #ddd;
  background-color: #fafafa;
}

footer a {
  color: #666;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

footer a:hover {
  color: #007bff;
}
