@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;600;700&display=swap");

@layer theme, base, infopanel, select;

@layer theme {
  :root {
    --primary-green: #10b981;
    --accent-mint: #34d399;
    --bg-deep: #061712;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(16, 185, 129, 0.15);
  }
}

@layer select {
  select,
  ::picker(select) {
    appearance: base-select;
  }

  .genre-select {
    display: block;
    inline-size: 100%;
    background: transparent;
    border: none;
    block-size: fit-content;

    @supports (appearance: base-select) {
      &,
      &::picker(select) {
        appearance: base-select;
      }

      .options-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;

        option {
          position: relative;
          aspect-ratio: 1;
          background: var(--glass-bg);
          backdrop-filter: blur(10px);
          border: 1px solid var(--glass-border);
          border-radius: 28px;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          gap: 15px;
          cursor: pointer;
          transition: all 0.3s ease;
          overflow: hidden;

          svg {
            inline-size: 38px;
            block-size: 38px;
            color: rgb(255 255 255 / 0.5);
            transition: all 0.3s ease;
          }

          span {
            font-weight: 500;
            font-size: 1rem;
            color: rgb(255 255 255 / 0.8);
            transition: all 0.3s ease;
          }

          &::checkmark {
            content: "✓";
            position: absolute;
            inset-block-start: 15px;
            inset-inline-end: 15px;
            inline-size: 22px;
            block-size: 22px;
            background: var(--primary-green);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: bold;
            opacity: 0;
            transition: opacity 0.3s ease;
          }

          &::before {
            content: "";
            position: absolute;
            inset-block-start: 0;
            inset-inline-start: -150%;
            inline-size: 100%;
            block-size: 100%;
            background: linear-gradient(
              120deg,
              transparent,
              rgb(255 255 255 / 0.08),
              transparent
            );
            pointer-events: none;
          }

          &:hover {
            background: rgb(16 185 129 / 0.08);
            border-color: rgb(16 185 129 / 0.4);
            box-shadow: 0 0 20px rgb(16 185 129 / 0.1);

            svg {
              color: var(--accent-mint);
            }

            &::before {
              inset-inline-start: 150%;
              transition: inset-inline-start 0.7s ease-in-out;
            }
          }

          &:checked {
            background: rgb(16 185 129 / 0.15);
            border-color: var(--primary-green);
            box-shadow: 0 0 30px rgb(16 185 129 / 0.1);

            svg {
              color: var(--primary-green);
              filter: drop-shadow(0 0 5px rgb(16 185 129 / 0.4));
            }
            span {
              color: white;
              font-weight: 600;
            }
            &::checkmark {
              opacity: 1;
            }
          }

          &:active {
            background: rgb(16 185 129 / 0.25);
            box-shadow: inset 0 0 15px rgb(0 0 0 / 0.2);
          }
        }
      }
    }
  }
}

@layer base {
  body {
    margin: 0;
    min-block-size: 100vh;
    font-family: "Instrument Sans", sans-serif;
    color: white;
    background: var(--bg-deep);
    background-image: radial-gradient(
        circle at 10% 10%,
        hsla(160, 100%, 50%, 0.1) 0%,
        transparent 40%
      ),
      radial-gradient(
        circle at 90% 90%,
        hsla(140, 100%, 50%, 0.05) 0%,
        transparent 40%
      ),
      url("data:image/svg+xml,%3Csvg viewBox='0 0 911 911' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    display: flex;
    justify-content: center;
  }

  .wrapper {
    inline-size: 100%;
    max-inline-size: 1000px;
    padding-block: 40px;
    padding-inline: 20px;
  }
}

@layer infopanel {
  .info-panel {
    position: sticky;
    inset-block-start: 20px;
    z-index: 100;
    background: rgb(6 23 18 / 0.8);
    backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-block-end: 30px;
    box-shadow: 0 10px 40px rgb(0 0 0 / 0.4);

    .status-box {
      display: flex;
      flex-direction: column;
      gap: 2px;
      max-inline-size: 60%;

      .label {
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--primary-green);
        font-weight: 700;
      }

      .genre-tag-list {
        font-weight: 600;
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }

    .submit-button {
      position: relative;
      overflow: hidden;
      background: linear-gradient(135deg, #059669 0%, #10b981 100%);
      border: none;
      color: white;
      padding: 12px 24px;
      border-radius: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 4px 15px rgb(16 185 129 / 0.3);

      &::before {
        content: "";
        position: absolute;
        inset-block: 0;
        inset-inline-start: -100%;
        inline-size: 100%;
        background: linear-gradient(
          90deg,
          transparent,
          rgb(255 255 255 / 0.2),
          transparent
        );
      }

      &:hover {
        box-shadow: 0 0 20px rgb(16 185 129 / 0.6);
        &::before {
          inset-inline-start: 100%;
          transition: inset-inline-start 0.6s ease;
        }
      }

      &:active {
        background: #059669;
        box-shadow: inset 0 2px 8px rgb(0 0 0 / 0.3);
      }
    }
  }
}