html {
  height: 100%;
}

body {
  margin: 0;
  font-family: sans-serif;
  height: 100%;
  background-color: rgba(239, 146, 255, 0.722);
  box-sizing: border-box;
  position: relative;
}

.title {
  font-weight: bold;
  color: rgb(239, 226, 239);
  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr 1fr 1fr;
  gap: 10px;
  min-height: 0;

  .grid-item {
    position: relative;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    min-width: 0;
    min-height: 0;
    transition: all 100ms ease-in-out;

    .img-container {
      display: flex;
      align-items: center;
      justify-content: center;

      width: 100%;
      height: 100%;
      border-radius: 8px;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
        z-index: 0;
        object-fit: cover;
      }
    }

    .grid-item-title {
      z-index: 1;
      position: absolute;
      top: -8px;
      left: -8px;
      background: rgba(239, 146, 255, 0.722);
      backdrop-filter: blur(2px);
      border-radius: 12px;
      padding: 2px 18px;
    }
  }

  .grid-item:hover {
    transform: scale(1.05);
  }
}

.container {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(
    0deg,
    rgb(171, 101, 206) 0%,
    rgb(175, 22, 221) 100%
  );
  box-sizing: border-box;
  height: 100%;
}

.modal-container {
  display: none;
}

.modal-container.visible {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;

  .modal {
    display: block;
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    position: relative;
    min-width: min(500px, 90vw);
    min-height: min(400px, 90vh);

    .close-button {
      position: absolute;
      top: 10px;
      right: 10px;
      cursor: pointer;
      font-size: 1.5rem;
      font-weight: bold;
      color: #666;
      transition: color 0.2s;
    }

    .close-button:hover {
      color: #000;
    }

    h2 {
      margin-top: 0;
      color: rgb(175, 22, 221);
    }

    input[type="file"] {
      margin: 1rem 0;
      padding: 0.5rem;
      border: 2px dashed rgba(239, 146, 255, 0.722);
      border-radius: 8px;
      width: 100%;
      box-sizing: border-box;
      cursor: pointer;
      transition: all 0.3s ease;
    }

    input[type="file"]:hover {
      border-color: rgb(175, 22, 221);
      background-color: rgba(239, 146, 255, 0.1);
    }

    button {
      background: linear-gradient(
        135deg,
        rgb(171, 101, 206) 0%,
        rgb(175, 22, 221) 100%
      );
      color: white;
      border: none;
      padding: 0.75rem 2rem;
      border-radius: 8px;
      font-size: 1rem;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      width: 100%;
    }

    button:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 12px rgba(175, 22, 221, 0.3);
    }

    button:active {
      transform: translateY(0);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* Tabs */
    .tabs {
      display: flex;
      gap: 0.5rem;
      margin-bottom: 1rem;
      border-bottom: 2px solid rgba(239, 146, 255, 0.3);
    }

    .tab-button {
      background: none;
      border: none;
      padding: 0.75rem 1.5rem;
      cursor: pointer;
      font-weight: bold;
      color: #666;
      border-bottom: 3px solid transparent;
      transition: all 0.3s ease;
      width: auto;
      box-shadow: none;
    }

    .tab-button:hover {
      color: rgb(175, 22, 221);
      transform: none;
      box-shadow: none;
    }

    .tab-button.active {
      color: rgb(175, 22, 221);
      border-bottom-color: rgb(175, 22, 221);
    }

    .tab-content {
      display: none;
    }

    .tab-content.active {
      display: block;
    }

    /* Search */
    .search-container {
      display: flex;
      gap: 0.5rem;
      margin-bottom: 1rem;
    }

    .search-container input[type="text"] {
      flex: 1;
      padding: 0.75rem;
      border: 2px solid rgba(239, 146, 255, 0.722);
      border-radius: 8px;
      font-size: 1rem;
      transition: border-color 0.3s ease;
    }

    .search-container input[type="text"]:focus {
      outline: none;
      border-color: rgb(175, 22, 221);
    }

    .search-container button {
      width: auto;
      padding: 0.75rem 1.5rem;
    }

    .search-results {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.5rem;
      max-height: 900px;
      overflow-y: auto;
    }

    .search-result-item {
      cursor: pointer;
      border-radius: 8px;
      overflow: hidden;
      border: 2px solid transparent;
    }

    .search-result-item img {
      width: 100%;
      height: 100px;
      object-fit: cover;
      display: block;
    }
  }

}

@media screen and (min-width: 768px) {
  .container {
    margin: 0 auto;
    max-width: 860px;
    border-radius: 12px;
  }

  body {
    padding: 1rem;
  }
}
