body {
  font-family: 'Poly Sans Bulky', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #fff;
  color: #000;
  overflow: hidden;
}

@font-face {
  font-family: "Poly Sans";
  src: url('fonts/PolySansNeutral.ttf');
  format: ('truetype');
}

@font-face {
  font-family: "Poly Sans Bulky";
  src: url('fonts/PolySansBulky.ttf');
  format: ('truetype');
}

@font-face {
  font-family: "Poly Sans Slim";
  src: url('fonts/PolySansSlim.ttf');
  format: ('truetype');
}

img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

header {
  background-color: #f5f5f7;
  border-bottom: 1px solid #e6e6ea;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#headerTitleLink {
    text-decoration: none;
    color: inherit;
}

#headerTitleLink:hover {
    text-decoration: underline;
}

h1 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0;
}

#welcomeMessage, #login, #signup {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
}

.welcome-title {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.welcome-subtitle {
  font-size: 1.5rem;
  color: #666;
}

#notFoundMessage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
}

.not-found-title {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.not-found-subtitle {
  font-size: 1.5rem;
  color: #666;
}

main {
  margin: 0 auto;
  height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  /* justify-content: center; */
}

#pageOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

#pageOverlay.active {
  display: flex;
}

.drop-overlay {
  border: 4px dashed #fff;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.1);
}

.drop-overlay i {
  font-size: 4rem;
  color: #fff;
  margin-bottom: 1rem;
}

.drop-overlay p {
  margin: 0;
  color: #fff;
  font-size: 1.5rem;
}

.custom-context-menu {
  display: none;
  position: fixed;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  padding: 8px;
  z-index: 1000;
}

.menu-item {
  padding: 8px 16px;
  font-family: 'Poly Sans';
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.menu-item:hover {
  background-color: #f0f0f0;
}

.menu-item i {
  margin-right: 8px;
}

#downloadMenuItem {
  color: black;
}

#deleteMenuItem {
  color: red;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.3rem;
  background-color: #fff;
  font-family: 'Poly Sans';
}

.toolbar-left, .toolbar-center, .toolbar-right {
  display: flex;
  align-items: center;
}

.toolbar-left {
  justify-content: flex-start;
}

.toolbar-center {
  justify-content: center;
  flex-direction: column;
}

.toolbar-right {
  justify-content: flex-end;
}

.media-date-time {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.media-index {
  font-size: 0.9rem;
  color: #707070;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#backBtn {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toolbar-icon {
  font-size: 1.3rem;
  cursor: pointer;
  padding: 7px;
  border-radius: 10px;
  transition: color 0.3s ease, opacity 0.3s ease;
  margin-left: 5px;
  color: #0071e3;
  opacity: 1;
}

.toolbar-icon.disabled {
  color: #d4d4d4;
  cursor: initial;
  opacity: 0.5;
}

.toolbar-icon:not(.disabled):hover {
  background-color: #ebebeb;
}

#backBtn {
  display: inline-block;
  opacity: 0;
  margin-right: auto;
}

.media-item.animating {
  position: fixed;
  z-index: 1001;
  transition: all 0.3s ease;
}

#mediaGalleryContainer.blurred {
  filter: blur(5px);
  transition: filter 0.3s ease;
}

#infoIcon {
  font-size: 1.3rem;
  cursor: pointer;
  padding: 7px;
  border-radius: 10px;
  transition: color 0.3s ease, background-color 0.3s ease;
  color: #0071e3;
  margin-right: 5px;
}

#infoIcon:hover {
  color: #333;
  background-color: #ebebeb;
}

.info-content p {
  margin: 0;
  margin-bottom: 0.5rem;
}

.info-content p:last-child {
  margin-bottom: 0;
}

.info-content strong {
  margin-right: 0.5rem;
}

.description-line {
  display: flex;
  align-items: center;
}

.description-line #descriptionText {
  flex: 1;
}

.description-line .skeleton-text {
  width: 100%;
}

#mediaGalleryContainer {
  position: relative;
  flex: 1;
  overflow-y: auto;
}

#mediaGallery {
  padding: 1rem 2rem 0rem;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

.placeholder-thumbnail {
  width: 120px;
  height: 120px;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #999;
  font-size: 14px;
  text-align: center;
}

.media-popup {
  display: none;
  position: relative;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 999;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.media-popup.active {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
}

.popup-media {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.popup-media img,
.popup-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.media-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: #fff;
  background-color: rgba(0,0,0,0.4);
  padding: 0.5rem 1rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1003; /* Ensure they sit above the media */
  transition: background-color 0.3s ease;
}

.media-nav-btn:hover {
  background-color: rgba(0,0,0,0.7);
}

#prevMediaBtn {
  left: 1rem;
}

#nextMediaBtn {
  right: 1rem;
}

.info-window {
  position: absolute;
  top: 50px;
  left: 50px;
  width: 300px;
  background-color: white;
  border: 1px solid #ccc;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  border-radius: 8px;
  z-index: 1002;
  display: none;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #e6e6ea;
  cursor: move;
  -webkit-user-select: none;
  user-select: none;
}

.info-title {
  font-size: 1.2rem;
  font-weight: 500;
}

.close-btn {
  font-size: 1.2rem;
  cursor: pointer;
}

.info-content {
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
  font-family: 'Poly Sans';
}

.media-item {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 6px;
}

.media-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
  transition: all .2s ease-in-out;
  cursor: pointer;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
}

.media-thumbnail {
  display: block;
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  border-radius: 4px;
}

.media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 4px;
  background: transparent;
  transition: background 0.3s ease;
}

.media-wrapper:hover {
  transform: scale(1.05);
}

.media-item.selected:hover .media-wrapper {
  transform: none;
}

.media-wrapper:hover .media-overlay {
  background: rgba(0, 0, 0, 0.1);
}

.media-item.selected .media-wrapper::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 3px solid #0071eb;
  border-radius: 6px;
  pointer-events: none;
}

.media-summary {
  text-align: center;
  padding: 1rem;
}

#mediaCountText {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  padding-top: 60px;
}

.modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 30px;
  border: 1px solid #e6e6ea;
  width: 80%;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
  margin: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 500;
  color: #333;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover,
.close:focus {
  color: #000;
}

#fileList {
  margin-top: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  flex-direction: column;
  background-color: #f8f8f8;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.file-info {
  display: flex;
  align-items: center;
}

.file-thumbnail {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  margin-right: 1rem;
  object-fit: cover;
}

.file-name {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.file-remove {
  color: #aaa;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
}

.file-remove:hover,
.file-remove:focus {
  color: #000;
}

.progress-container {
  width: 100%;
  height: 6px;
  background-color: #e6e6ea;
  border-radius: 4px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background-color: #0071e3;
  border-radius: 4px;
  transition: width 0.3s ease-in-out, background-color 0.3s ease;
}

#authButtons {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.upload-btn {
  background-color: #0071e3;
  color: #fff;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.upload-btn:hover {
  background-color: #0056b3;
}

.upload-btn.processing {
  background-color: #e6e6ea;
  color: #333;
  cursor: default;
}

.upload-btn.processing:hover {
  background-color: #f44336;
  color: #fff;
}

.upload-btn.processing:hover:after {
  content: "Cancel";
}

.upload-btn.processing:after {
  content: "Processing...";
}

.upload-btn.disabled {
  background-color: #e6e6ea;
  color: #999;
  cursor: not-allowed;
}

.upload-btn.disabled:hover {
  background-color: #e6e6ea;
}

.upload-btn,
.auth-btn {
  background-color: #f5f5f7;
  font-family: 'Poly Sans';
  color: #000;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.upload-btn:hover,
.auth-btn:hover {
  background-color: #e2e2e4;
}

.auth-form {
  max-width: 300px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-form h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-form input {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e6e6ea;
  border-radius: 4px;
  font-size: 1rem;
}

.auth-form .auth-btn {
  width: 100%;
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
  font-family: 'Poly Sans';
}

.auth-link a {
  color: #000;
  text-decoration: none;
  font-weight: 500;
}

.auth-link a:hover {
  text-decoration: underline;
}

.skeleton-text {
  display: inline-block;
  vertical-align: middle;
  height: 20px;
  background: #eee;
  margin-bottom: 0;
  background: linear-gradient(270deg, #f1f1f1, #e1e1e1, #f1f1f1);
  background-size: 200% 100%;
  border-radius: 4px;

  -webkit-animation: gradientMoves 800ms linear infinite;
  -moz-animation: gradientMoves 800ms linear infinite;
  animation: gradientMoves 800ms linear infinite;
}

@-webkit-keyframes gradientMoves {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:200% 50%}
}
@-moz-keyframes gradientMoves {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:200% 50%}
}
@keyframes gradientMoves { 
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:200% 50%}
}
