/* General Styles */
body {
    font-family: 'Nimbus Sans', 'Roboto', sans-serif;
    background-color: #fafafa;
    margin: 0;
    display: grid;
    grid-template-rows: 1fr 10fr 0fr;
    grid-template-columns: 1fr;
    justify-items: center;
    color: #333;
    height: 100svh;
}

.tag {
  margin-bottom: 1em;
  border-bottom-width: medium;
  border-bottom-style: double;
  border-bottom-color: #fff;
  border-top-width: medium;
  border-top-style: double;
  border-top-color: #fff;
}

.tag p {
  margin: 0;
  padding: 2px;
}

#notification {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: 22rem;
  z-index: 2147483647;
  background: #fff;
  color: #111;
  padding: 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
}

#notification[hidden] { display: none !important; }

#notification .button-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* Authentication Container */
.container {
  margin: 0.5em 0;
  width: calc(100% - 5em);
  background-color: aliceblue;
}

.auth-container {
    display: flex;
    justify-content: space-between;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-container .user-details {
  display: none
}

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

#user-image {
    height: 1em;
    margin: 0 10px;
}

.logo {
  height: 2em;
}

.logo-small {
  display: none;
}

button {
    background-color: slategray;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.5em 1em;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-container span {
  margin-left: 0.5em;
  margin-right: 1em;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#delete-search-button:disabled {
    background-color: #ffb69b;
    cursor: not-allowed;
}

#delete-search-button {
  background-color: coral;
}

#delete-search-button:hover:not(:disabled) {
  background-color: #ff4400;
}

button:hover:not(:disabled) {
    background-color: #0056b3;
}

/* Toggle in search bar (Show Hidden Items) */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-left: 1rem;
  user-select: none;
}

#search-bar { position: relative; }

/* kebab hidden by default (desktop) */
#search-more-btn { display: none; }

/* style checkbox row inside menu */
.card-menu label.menu-check {
  display: block;
  padding: .5rem .75rem;
}

/* phones: show kebab, hide the bar buttons and toggle label */
@media (max-width: 600px) {
  #search-bar .left #add-search-button { display: none; }
  #search-bar .right #delete-search-button { display: none; }
  #search-bar .toggle { display: none; }
  #search-more-btn { display: inline-flex; }
  /* ensure menu positions at the right edge of the bar */
  #search-more-menu { right: 0 !important; left: auto; }

  /* larger tap targets on phones */
  #search-more-btn, .item .menu-btn {
    width: 36px;
    height: 36px;
  }
}

/* Container */
.content-container {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

#search-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

#search-bar label {
    margin-right: 10px;
}

#search-bar select {
    font-size: 16px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-right: 10px;
}

.items-container {
    display: grid;
    grid-gap: 1em;
    justify-items: center;
    width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-template-rows: repeat(auto-fill, minmax(80px, 1fr));
}

.item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.item img {
  max-width: 100%;
  height: 12rem;
  border-radius: 8px;
  margin-bottom: 10px;
  object-fit: contain;
}

.item a {
  display: block;
}

.item-title {
    line-height: 1em;
    min-height: 2em;
    max-height: 2em;
    margin: 10px 0;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-time {
    color: #888;
    font-size: 0.9em;
}

.viewed-message {
    font-size: 1em;
    color: #444;
}

.viewed-message button {
  margin: 0.5em
}

/* Card – modern (no flip) */
.item {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.item-inner {
    display: grid;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    text-align: center;
    background: #fff;
}

/* When showing hidden items, dim them visually */
.item.is-hidden .item-front {
  filter: grayscale(1);
  opacity: .55;
}

.item.is-hidden a { pointer-events: none; }
.item.is-hidden .item-time::after { content: " • Hidden"; color: #999; }

.item-front {
    background-color: #f3f3f3;
    border: 1px solid #ddd;
    padding: 1em;
    box-sizing: border-box;
    text-align: center;
}

.item-actions {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 20
}

#search-more-btn, .item .menu-btn {
    appearance: none;
    border: none;
    background-color: slategray;
    color: white;
    border-radius: 9999px;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    -webkit-tap-highlight-color: transparent;
}

#search-more-btn:focus-visible, .item .menu-btn:focus-visible {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

#search-more-btn:hover, .item .menu-btn:hover {
  background-color: #0056b3;
}

.item .menu-btn:active {
  transform: scale(0.96);
}

.card-menu {
    position: absolute;
    top: 2.25rem;
    right: .5rem;
    min-width: 10rem;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: .5rem;
    box-shadow: 0 .5rem 1.25rem rgba(0,0,0,.12);
    padding: .25rem;
    z-index: 30;
}

.card-menu[hidden] { display: none; }
.card-menu [hidden] { display: none; }

.card-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    color: #333;
    padding: .5rem .75rem;
    border-radius: .375rem;
}

.card-menu button:hover,
.card-menu button:focus-visible {
    background: #f2f6ff;
}

.card-menu .danger { color: #b04700; }
.card-menu .muted  { color: #666; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.page-btn {
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 10px;
    transition: background-color 0.3s;
}

.page-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.page-btn:hover:not(:disabled) {
    background-color: #0056b3;
}

#page-info {
    font-size: 1em;
    color: #555;
}

.status-line {
  position: absolute;
  bottom: 0;
  right: 1em;
  text-align: right;
}

.status-line p {
  margin: 0;
}

@media only screen and (max-width: 800px) {
  .logo-small {
    display: block;
  }

  .logo-large {
    display: none;
  }

  button {
    padding: 5px 2px;
  }

  #search-bar select {
    max-width: 9em;
  }
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  min-height: 220px;
  margin: 1rem;
  padding: 2rem;
  background: #fff;
  border: 1px dashed #d0d7de;
  border-radius: 12px;
  color: #555;
}
.empty-state h3 {
  margin: 0;
  color: #333;
  font-weight: 600;
}
.empty-state p {
  margin: 0;
}
